Ignore:
Timestamp:
08/24/06 18:05:30 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r1264 r1278  
    3434#include "KdTree.h" 
    3535#include "BvHierarchy.h" 
     36#include "HierarchyManager.h" 
    3637 
    3738 
     
    9192  , mObjects(objects) 
    9293  , mBoundingBoxConverter(bconverter) 
     94  , mHierarchyManager(NULL) 
    9395{ 
    9496        std::stable_sort(mObjects->begin(), mObjects->end(), ilt); 
     
    354356        if (element == "ViewCells") 
    355357        { 
    356                 cout << "parsing view cells" << endl; 
     358                cout << "\nparsing view cells" << endl; 
    357359                 
    358360                mCurrentState = PARSE_VIEWCELLS; 
     
    372374        if (element == "ViewSpaceHierarchy") 
    373375        {                
    374                 cout << "parsing view space hierarchy" << endl; 
     376                cout << "\nparsing view space hierarchy" << endl; 
    375377                mCurrentState = PARSE_VIEWSPACE_HIERARCHY; 
    376378                StartViewSpaceHierarchy(attributes); 
     
    380382        if (element == "ObjectSpaceHierarchy") 
    381383        { 
    382                 cout << "parsing object space hierarchy" << endl; 
     384                cout << "\nparsing object space hierarchy" << endl; 
    383385                mCurrentState = PARSE_OBJECTSPACE_HIERARCHY; 
    384386                StartObjectSpaceHierarchy(attributes); 
     
    565567                if (attrName == "type") 
    566568                { 
    567                         if (strcmp(ptr, "bsp") == 0) 
     569                        if (strcmp(ptr, "osp") == 0) 
    568570                        { 
    569                                 Debug << "view space hierarchy: Bsp" << endl; 
    570                                 mViewSpaceHierarchyType = BSP; 
     571                                Debug << "object space hierarchy: Osp" << endl; 
     572                                mHierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::KD_BASED_OBJ_SUBDIV); 
    571573                        } 
    572                         else if (strcmp(ptr, "vsp") == 0) 
     574                        else if (strcmp(ptr, "bvh") == 0) 
    573575                        { 
    574                                 Debug << "view space hierarchy: Vsp" << endl; 
    575                                 mViewSpaceHierarchyType = VSP; 
     576                                Debug << "object space hierarchy: Bvh" << endl; 
     577                                mHierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV); 
    576578                        } 
    577579                } 
     
    778780 
    779781                mVspTree = new VspTree(); 
     782 
    780783                // set view space box 
    781784                mVspTree->mBoundingBox = mViewSpaceBox; 
     785 
     786                // object space hierarchy already constructed 
     787                if (mHierarchyManager) 
     788                { 
     789                        mHierarchyManager->mVspTree = mVspTree; 
     790                        mVspTree->mHierarchyManager = mHierarchyManager; 
     791                } 
    782792        } 
    783793         
    784794        cout << "\nview space box: " << mViewSpaceBox << endl; 
    785 } 
    786  
    787  
    788 void ViewCellsParseHandlers::CreateObjectSpaceHierarchy() 
    789 { 
    790         if (mViewSpaceHierarchyType == OSP) 
    791         { 
    792                 Debug << "object hierarchy type: Osp" << endl; 
    793  
    794                 mOspTree = new OspTree(); 
    795         } 
    796         else if (mViewSpaceHierarchyType == VSP)  
    797         { 
    798                 Debug << "object hierarchy type: Vsp" << endl; 
    799  
    800                 mVspTree = new VspTree(); 
    801         } 
    802795} 
    803796 
     
    814807        else if (mViewSpaceHierarchyType == VSP)  
    815808        { 
    816                 Debug << "vcreating view cells manager: VsOspp" << endl; 
     809                Debug << "creating view cells manager: VspOsp" << endl; 
    817810 
    818811                // hack 
    819                 mViewCellsManager = new VspOspViewCellsManager(mViewCellsTree, mVspTree, mOspTree); 
     812                mViewCellsManager = new VspOspViewCellsManager(mViewCellsTree, mHierarchyManager); 
    820813        } 
    821814 
     
    978971        else 
    979972        { 
    980                 mOspTree->mRoot = interior; 
     973                mHierarchyManager->mOspTree->mRoot = interior; 
    981974        } 
    982975 
     
    996989        else 
    997990        { 
    998                 mOspTree->mRoot = leaf; 
     991                mHierarchyManager->mOspTree->mRoot = leaf; 
    999992        } 
    1000993} 
     
    1002995 
    1003996void ViewCellsParseHandlers::StartBvhLeaf(AttributeList& attributes) 
    1004 { 
     997{/* 
    1005998        KdLeaf * leaf =  
    1006999                new KdLeaf(dynamic_cast<KdInterior *>(mCurrentKdNode), NULL); 
     
    10121005        else 
    10131006        { 
    1014                 mOspTree->mRoot = leaf; 
    1015         } 
     1007                mHierarchyManager->mBvHierarchy->mRoot = leaf; 
     1008        }*/ 
    10161009} 
    10171010 
    10181011 
    10191012void ViewCellsParseHandlers::StartBvhInterior(AttributeList& attributes) 
    1020 { 
     1013{/* 
    10211014        AxisAlignedPlane plane; 
    10221015        int len = attributes.getLength(); 
     
    10511044        } 
    10521045 
    1053         mCurrentKdNode = interior; 
     1046        mCurrentKdNode = interior;*/ 
    10541047} 
    10551048 
Note: See TracChangeset for help on using the changeset viewer.