Changeset 1284 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
- Timestamp:
- 08/25/06 10:14:56 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r1278 r1284 311 311 AttributeList& attributes) 312 312 { 313 //if (!mViewCellsManager)return;314 315 313 //-- use cell type according to the chosen method 316 317 314 switch (mObjectSpaceHierarchyType) 318 315 { … … 336 333 if (element == "Interior") 337 334 { 338 Debug<< "[";335 cout << "["; 339 336 StartViewCellInterior(attributes); 340 337 } … … 342 339 if (element == "Leaf") 343 340 { 344 Debug<< "l";341 cout << "l"; 345 342 StartViewCellLeaf(attributes); 346 343 } … … 390 387 if (element == "BoundingBox") 391 388 { 392 Debug<< "b";389 cout << "b"; 393 390 StartBoundingBox(attributes); 394 391 } … … 415 412 416 413 417 void ViewCellsParseHandlers:: StartViewCell(ViewCell *viewCell,418 414 void ViewCellsParseHandlers::ParseViewCellPvs(ViewCell *viewCell, 415 AttributeList& attributes) 419 416 { 420 417 int len = attributes.getLength(); … … 468 465 else 469 466 { 470 Debug<< "error: object with id " << objId << " does not exist" << endl;467 cout << "error: object with id " << objId << " does not exist" << endl; 471 468 } 472 469 } … … 524 521 if (strcmp(ptr, "bsp") == 0) 525 522 { 526 cout << " view space hierarchy: Bsp" << endl;523 cout << "\nview space hierarchy: Bsp" << endl; 527 524 mViewSpaceHierarchyType = BSP; 528 525 } 529 526 else if (strcmp(ptr, "vsp") == 0) 530 527 { 531 Debug << "view space hierarchy: Vsp" << endl;528 cout << "\nview space hierarchy: Vsp" << endl; 532 529 mViewSpaceHierarchyType = VSP; 533 530 } … … 557 554 558 555 Vector3 bmin, bmax; 559 556 cout << "here3" << endl; 560 557 for (int i = 0; i < len; ++ i) 561 558 { … … 569 566 if (strcmp(ptr, "osp") == 0) 570 567 { 571 Debug << "object space hierarchy: Osp" << endl; 572 mHierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::KD_BASED_OBJ_SUBDIV); 568 cout << "\nobject space hierarchy: Osp" << endl; 569 mHierarchyManager = 570 new HierarchyManager(mVspTree, HierarchyManager::KD_BASED_OBJ_SUBDIV); 573 571 } 574 572 else if (strcmp(ptr, "bvh") == 0) 575 573 { 576 Debug << "object space hierarchy: Bvh" << endl; 577 mHierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV); 574 cout << "\nobject space hierarchy: Bvh" << endl; 575 mHierarchyManager = 576 new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV); 578 577 } 579 578 } … … 650 649 } 651 650 } 652 653 651 654 652 if (viewCellId >= 0) // valid view cell found … … 665 663 if (viewCell->GetId() == viewCellId) 666 664 { 665 // create new view cell for bsp nodes 667 666 leaf->SetViewCell(viewCell); 668 667 viewCell->mLeaf = leaf; … … 670 669 else 671 670 { 672 Debug<< "error: view cell does not exist" << endl;671 cout << "error: view cell does not exist" << endl; 673 672 } 674 673 } … … 724 723 void ViewCellsParseHandlers::StartViewCellLeaf(AttributeList& attributes) 725 724 { 726 BspViewCell *viewCell = new BspViewCell();725 ViewCellLeaf *viewCell = new ViewCellLeaf(); 727 726 728 727 if (mCurrentViewCell) // replace front or (if not NULL) back child 729 728 { 730 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(mCurrentViewCell); 729 ViewCellInterior *interior = 730 dynamic_cast<ViewCellInterior *>(mCurrentViewCell); 731 731 interior->SetupChildLink(viewCell); 732 732 } … … 736 736 } 737 737 738 StartViewCell(viewCell, attributes);738 ParseViewCellPvs(viewCell, attributes); 739 739 740 740 // collect leaves … … 746 746 { 747 747 ViewCellInterior* interior = new ViewCellInterior(); 748 748 cout << "here7"<<endl; 749 749 if (mCurrentViewCell) // replace NULL child of parent with current node 750 750 { … … 760 760 mCurrentViewCell = interior; 761 761 762 StartViewCell(interior, attributes);762 ParseViewCellPvs(interior, attributes); 763 763 } 764 764 … … 766 766 void ViewCellsParseHandlers::CreateViewSpaceHierarchy() 767 767 { 768 ViewCellContainer::iterator it, it_end = mViewCells.end(); 769 Debug << endl; 770 for (it = mViewCells.begin(); it != it_end; ++ it) 771 { 772 Debug << (*it)->GetId() << " "; 773 } 774 Debug << endl; 768 775 if (mViewSpaceHierarchyType == BSP) 769 776 { … … 774 781 // set view space box 775 782 mVspBspTree->mBox = mViewSpaceBox; 783 784 ViewCellContainer::iterator vit, vit_end = mViewCells.end(); 785 786 // reset view cells using the current node type 787 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 788 { 789 ViewCell *vc = *vit; 790 791 BspViewCell *bspVc = new BspViewCell(); 792 bspVc->SetPvs(vc->GetPvs()); 793 bspVc->SetId(vc->GetId()); 794 795 if (vc->IsRoot()) 796 { 797 mViewCellsTree->mRoot = bspVc; 798 } 799 else 800 { 801 vc->GetParent()->SetupChildLink(bspVc); 802 vc->GetParent()->RemoveChildLink(vc); 803 } 804 805 DEL_PTR(vc); 806 (*vit) = bspVc; 807 } 808 776 809 } 777 810 else if (mViewSpaceHierarchyType == VSP) … … 784 817 mVspTree->mBoundingBox = mViewSpaceBox; 785 818 786 // object space hierarchy already constructed 819 ViewCellContainer::iterator vit, vit_end = mViewCells.end(); 820 821 // reset view cells using the current node type 822 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 823 { 824 ViewCell *vc = *vit; 825 826 VspViewCell *vspVc = new VspViewCell(); 827 vspVc->SetPvs(vc->GetPvs()); 828 vspVc->SetId(vc->GetId()); 829 830 if (vc->IsRoot()) 831 { 832 mViewCellsTree->mRoot = vspVc; 833 } 834 else 835 { 836 vc->GetParent()->SetupChildLink(vspVc); 837 vc->GetParent()->RemoveChildLink(vc); 838 } 839 840 DEL_PTR(vc); 841 (*vit) = vspVc; 842 } 843 844 // if object space hierarchy already constructed 787 845 if (mHierarchyManager) 788 846 { … … 791 849 } 792 850 } 793 851 Debug << "************************" << endl; 852 it_end = mViewCells.end(); 853 for (it = mViewCells.begin(); it != it_end; ++ it) 854 { 855 Debug << (*it)->GetId() << " "; 856 } 857 Debug << endl; 794 858 cout << "\nview space box: " << mViewSpaceBox << endl; 795 859 } … … 879 943 dummyVc.SetId(viewCellId); 880 944 945 cout << "\nsearching view cell with id " << viewCellId << endl; 946 881 947 ViewCellContainer::iterator vit = 882 948 lower_bound(mViewCells.begin(), mViewCells.end(), &dummyVc, vlt); 883 949 950 if (vit == mViewCells.end()) 951 cout << "error: view cell " << viewCellId << " not found" << endl; 952 884 953 VspViewCell *viewCell = dynamic_cast<VspViewCell *>(*vit); 885 954 … … 891 960 else 892 961 { 893 Debug<< "error: view cell does not exist" << endl;962 cout << "error: view cell does not exist" << endl; 894 963 } 895 964 } … … 917 986 if (attrName == "plane") 918 987 { 919 sscanf(ptr, "%d %f", 920 &plane.mAxis, &plane.mPosition); 988 sscanf(ptr, "%d %f", &plane.mAxis, &plane.mPosition); 921 989 } 922 990 }
Note: See TracChangeset
for help on using the changeset viewer.