Changeset 1286


Ignore:
Timestamp:
08/25/06 18:25:09 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
17 edited

Legend:

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

    r1279 r1286  
    14541454 
    14551455 
     1456void BvHierarchy::ExportObjects(BvhLeaf *leaf, OUT_STREAM &stream) 
     1457{ 
     1458        ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 
     1459        for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 
     1460        { 
     1461                stream << (*oit)->GetId() << " "; 
     1462        } 
     1463} 
     1464 
     1465 
    14561466void BvHierarchy::ExportNode(BvhNode *node, OUT_STREAM &stream) 
    14571467{ 
     
    14601470                BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(node); 
    14611471 
    1462                 stream << "<Leaf "; 
    1463                 stream << "objects=\""; 
     1472                stream << "<Leaf" 
     1473                           << " min=\"" << leaf->GetBoundingBox().Min() 
     1474                           << " max=\"" << leaf->GetBoundingBox().Max()  
     1475                           << " objects=\""; 
    14641476                 
    1465                 //-- export objects in kd leaves 
    1466                 //if (mExportObjects) ExportObjects(leaf, stream); 
     1477                //-- export objects 
     1478                ExportObjects(leaf, stream); 
    14671479                 
    14681480                stream << "\" />" << endl; 
    1469                 //stream << " </Leaf>" << endl; 
    14701481        } 
    14711482        else 
     
    14731484                BvhInterior *interior = dynamic_cast<BvhInterior *>(node); 
    14741485         
    1475                 stream << "<Interior box=\"" << interior->GetBoundingBox() << "\">" << endl; 
     1486                stream << "<Interior" 
     1487                           << " min=\"" << interior->GetBoundingBox().Min() 
     1488                           << " max=\"" << interior->GetBoundingBox().Max() 
     1489                           << "\">" << endl; 
    14761490 
    14771491                ExportNode(interior->GetBack(), stream); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r1259 r1286  
    640640        void ExportNode(BvhNode *node, OUT_STREAM &stream); 
    641641 
     642        void ExportObjects(BvhLeaf *leaf, OUT_STREAM &stream); 
     643 
    642644        /** Returns estimated memory usage of tree. 
    643645        */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1284 r1286  
    260260 
    261261 
    262 void HierarchyManager::Construct2(const VssRayContainer &sampleRays, 
    263                                                                   const ObjectContainer &objects, 
    264                                                                   AxisAlignedBox3 *forcedViewSpace) 
    265 { 
    266         // rays clipped in view space and in object space 
    267         RayInfoContainer *viewSpaceRays = new RayInfoContainer(); 
    268         RayInfoContainer *objectSpaceRays = new RayInfoContainer(); 
    269  
    270  
    271         ///////////////////////////////////////////////////////////// 
    272         // view space space partition 
    273         ///////////////////////////////////////////////////////////// 
    274  
    275 #if 0 
    276         // makes no sense otherwise because only one kd cell available 
    277         // during view space partition 
    278         const bool savedCountMethod = mVspTree.mUseKdPvsForHeuristics; 
    279         const bool savedStoreMethod = mVspTree.mStoreObjectPvs; 
    280          
    281         mVspTree.mUseKdPvsForHeuristics = false; 
    282         mVspTree.mStoreObjectPvs = false; 
    283 #endif 
    284         SubdivisionCandidate *vsc =  
    285                 mVspTree->PrepareConstruction(sampleRays, forcedViewSpace, *viewSpaceRays); 
    286          
    287         // add to queue 
    288         mTQueue.Push(vsc); 
    289  
    290         long startTime = GetTime(); 
    291         cout << "starting vsp contruction ... " << endl; 
    292  
    293         mVspTree->mVspStats.Reset(); 
    294         mVspTree->mVspStats.Start(); 
    295  
    296         int i = 0; 
    297  
    298         // all objects can be seen from everywhere 
    299         mTotalCost = (float)dynamic_cast<VspTree::VspSubdivisionCandidate *>(vsc)->mParentData.mPvs; 
    300  
    301         const bool repairQueue = false; 
    302  
    303         // process view space candidates 
    304         RunConstruction(repairQueue); 
    305  
    306         cout << "finished in " << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl; 
    307         mVspTree->mVspStats.Stop(); 
    308  
    309  
    310         ///////////////////////////////////////////////////////////// 
    311         // object space partition 
    312         ///////////////////////////////////////////////////////////// 
    313  
    314  
    315         Debug << "\n$$$$$$$$$ osp tree construction $$$$$$$$$$\n" << endl; 
    316         cout << "starting osp contruction ... " << endl; 
    317  
    318         // start with one big kd cell - all objects can be seen from everywhere 
    319         // note: only true for view space = object space 
    320  
    321         // compute first candidate 
    322         SubdivisionCandidate *osc = 
    323                 mOspTree->PrepareConstruction(sampleRays, objects, forcedViewSpace, *objectSpaceRays); 
    324  
    325         Debug << "reseting cost, new total cost: " << mTotalCost << endl; 
    326         mTotalCost = mOspTree->mTotalCost; 
    327  
    328     mTQueue.Push(osc); 
    329  
    330         mOspTree->mOspStats.Reset(); 
    331         mOspTree->mOspStats.Start(); 
    332  
    333         startTime = GetTime(); 
    334          
    335         // process object space candidates 
    336         RunConstruction(repairQueue); 
    337          
    338         cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    339  
    340         mOspTree->mOspStats.Stop(); 
    341  
    342         ////////////////////////// 
    343         // matt: only for debugging purpose 
    344  
    345         const float rc = mOspTree->EvalRenderCost(sampleRays); 
    346  
    347         Debug << "My render cost evalulation: " << rc << endl; 
    348  
    349 #if 0 
    350         // reset parameters 
    351         mVspTree->mUseKdPvsForHeuristics = savedCountMethod; 
    352         mVspTree->mStoreObjectPvs = savedStoreMethod; 
    353 #endif 
    354 } 
    355  
    356  
    357262void HierarchyManager::Construct3(const VssRayContainer &sampleRays, 
    358263                                                                  const ObjectContainer &objects, 
     
    372277        mTQueue.Push(sc); 
    373278 
    374         cout << "starting vsp contruction ... " << endl; 
     279        cout << "starting vsp construction ... " << endl; 
    375280 
    376281        long startTime = GetTime(); 
     
    552457void HierarchyManager::ExportObjectSpaceHierarchyForViz(const ObjectContainer &objects) const 
    553458{ 
    554         if (mOspTree && mOspTree->GetRoot())  
    555         {        
    556                 //-- export final object partition 
    557                 Exporter *exporter = Exporter::GetExporter("final_object_partition.wrl"); 
     459        switch (mObjectSpaceSubdivisonType) 
     460        { 
     461        case KD_BASED_OBJ_SUBDIV: 
     462                { 
     463                        ExportOspTreeForViz(objects); 
     464                        break; 
     465                } 
     466        case BV_BASED_OBJ_SUBDIV: 
     467                { 
     468                        ExportBvhForViz(objects); 
     469                        break; 
     470                } 
     471        default: 
     472                break; 
     473        } 
     474} 
     475 
     476 
     477void HierarchyManager::ExportBvhForViz(const ObjectContainer &objects) const 
     478{ 
     479} 
     480 
     481 
     482void HierarchyManager::ExportOspTreeForViz(const ObjectContainer &objects) const 
     483{ 
     484        //-- export final object partition 
     485        Exporter *exporter = Exporter::GetExporter("final_object_partition.wrl"); 
    558486                 
    559                 if (exporter) 
    560                 { 
    561                         cout << "exporting object space partition ... "; 
    562  
    563                         if (1) 
    564                         { 
    565                                 exporter->ExportGeometry(objects); 
    566                         } 
     487        if (exporter) 
     488        { 
     489                cout << "exporting object space partition ... "; 
     490 
     491                if (1) exporter->ExportGeometry(objects); 
    567492                         
    568493#if 0            
    569                         // export rays 
    570                         exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     494                // export rays 
     495                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
    571496#endif 
    572  
    573                         exporter->SetWireframe(); 
    574          
    575                         const int colorCode = 0; 
    576                         const int maxPvs = 0;//mOspTree.GetStatistics().maxPvs; 
    577  
    578                         exporter->ExportOspTree(*mOspTree, 0); 
    579  
    580                         delete exporter; 
    581  
    582                         cout << "finished" << endl; 
    583                 } 
    584         } 
    585 } 
    586  
    587 } 
     497                exporter->SetWireframe(); 
     498         
     499                const int colorCode = 0; 
     500                const int maxPvs = 0;//mOspTree.GetStatistics().maxPvs; 
     501 
     502                exporter->ExportOspTree(*mOspTree, 0); 
     503                delete exporter; 
     504 
     505                cout << "finished" << endl; 
     506        } 
     507} 
     508 
     509 
     510void HierarchyManager::Construct2(const VssRayContainer &sampleRays, 
     511                                                                  const ObjectContainer &objects, 
     512                                                                  AxisAlignedBox3 *forcedViewSpace) 
     513{ 
     514        // rays clipped in view space and in object space 
     515        RayInfoContainer *viewSpaceRays = new RayInfoContainer(); 
     516         
     517        ///////////////////////////////////////////////////////////// 
     518        // view space space partition 
     519        ///////////////////////////////////////////////////////////// 
     520 
     521        // use objects for evaluating vsp tree construction 
     522        const int savedobjectSpaceSubdivisionType = mObjectSpaceSubdivisonType; 
     523        mObjectSpaceSubdivisonType = NO_OBJ_SUBDIV; 
     524 
     525        SubdivisionCandidate *vsc =  
     526                mVspTree->PrepareConstruction(sampleRays, forcedViewSpace, *viewSpaceRays); 
     527         
     528        // add to queue 
     529        mTQueue.Push(vsc); 
     530 
     531        long startTime = GetTime(); 
     532        cout << "starting vsp construction ... " << endl; 
     533 
     534        mVspTree->mVspStats.Reset(); 
     535        mVspTree->mVspStats.Start(); 
     536 
     537        int i = 0; 
     538 
     539        // all objects can be seen from everywhere 
     540        mTotalCost = (float)dynamic_cast<VspTree::VspSubdivisionCandidate *>(vsc)->mParentData.mPvs; 
     541 
     542        const bool repairQueue = false; 
     543 
     544        // process view space candidates 
     545        RunConstruction(repairQueue); 
     546 
     547        cout << "finished in " << TimeDiff(startTime, GetTime())*1e-3 << " secs" << endl; 
     548        mVspTree->mVspStats.Stop(); 
     549 
     550        // reset subdivision type 
     551        mObjectSpaceSubdivisonType = savedobjectSpaceSubdivisionType; 
     552 
     553 
     554        ///////////////////////////////////////////////////////////// 
     555        // object space partition 
     556        ///////////////////////////////////////////////////////////// 
     557         
     558         
     559        switch (mObjectSpaceSubdivisonType) 
     560        { 
     561        case KD_BASED_OBJ_SUBDIV: 
     562                { 
     563                        ConstructOspTree(sampleRays, objects, forcedViewSpace); 
     564                        break; 
     565                } 
     566        case BV_BASED_OBJ_SUBDIV: 
     567                { 
     568                        ConstructBvHierarchy(sampleRays, objects, forcedViewSpace); 
     569                        break; 
     570                } 
     571        default: 
     572                break; 
     573        } 
     574} 
     575 
     576 
     577void HierarchyManager::ConstructBvHierarchy(const VssRayContainer &sampleRays, 
     578                                                                                        const ObjectContainer &objects, 
     579                                                                                        AxisAlignedBox3 *forcedViewSpace)  
     580 
     581{ 
     582        Debug << "\n$$$$$$$$$ bv hierarchy construction $$$$$$$$$$\n" << endl; 
     583        cout << "starting bv hierarchy construction ... " << endl; 
     584 
     585        // start with one big kd cell - all objects can be seen from everywhere 
     586        // note: only true for view space = object space 
     587 
     588        ObjectContainer obj = objects; 
     589 
     590        // compute first candidate 
     591        SubdivisionCandidate *sc = 
     592                mBvHierarchy->PrepareConstruction(sampleRays, obj, forcedViewSpace); 
     593 
     594        Debug << "reseting cost, new total cost: " << mTotalCost << endl; 
     595        mTotalCost = mOspTree->mTotalCost; 
     596 
     597    mTQueue.Push(sc); 
     598 
     599        mOspTree->mOspStats.Reset(); 
     600        mOspTree->mOspStats.Start(); 
     601 
     602        const long startTime = GetTime(); 
     603        const bool repairQueue = false; 
     604 
     605        // process object space candidates 
     606        RunConstruction(repairQueue); 
     607         
     608        cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
     609 
     610        mOspTree->mOspStats.Stop(); 
     611 
     612        ////////////////////////// 
     613        // matt: only for debugging purpose 
     614 
     615        const float rc = mOspTree->EvalRenderCost(sampleRays); 
     616 
     617        Debug << "My render cost evalulation: " << rc << endl; 
     618} 
     619 
     620 
     621void HierarchyManager::ConstructOspTree(const VssRayContainer &sampleRays, 
     622                                                                                const ObjectContainer &objects, 
     623                                                                                AxisAlignedBox3 *forcedViewSpace)  
     624 
     625{ 
     626        RayInfoContainer *objectSpaceRays = new RayInfoContainer(); 
     627 
     628        Debug << "\n$$$$$$$$$ osp tree construction $$$$$$$$$$\n" << endl; 
     629        cout << "starting osp tree construction ... " << endl; 
     630 
     631        // start with one big kd cell - all objects can be seen from everywhere 
     632        // note: only true for view space = object space 
     633 
     634        // compute first candidate 
     635        SubdivisionCandidate *osc = 
     636                mOspTree->PrepareConstruction(sampleRays, objects, forcedViewSpace, *objectSpaceRays); 
     637 
     638        Debug << "reseting cost, new total cost: " << mTotalCost << endl; 
     639        mTotalCost = mOspTree->mTotalCost; 
     640 
     641    mTQueue.Push(osc); 
     642 
     643        mOspTree->mOspStats.Reset(); 
     644        mOspTree->mOspStats.Start(); 
     645 
     646        const long startTime = GetTime(); 
     647        const bool repairQueue = false; 
     648         
     649        // process object space candidates 
     650        RunConstruction(repairQueue); 
     651         
     652        cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
     653 
     654        mOspTree->mOspStats.Stop(); 
     655 
     656        ////////////////////////// 
     657        // matt: only for debugging purpose 
     658 
     659        const float rc = mOspTree->EvalRenderCost(sampleRays); 
     660 
     661        Debug << "My render cost evalulation: " << rc << endl; 
     662} 
     663 
     664} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1283 r1286  
    100100        HierarchyManager(VspTree *vspTree, KdTree *kdTree); 
    101101 
     102        ~HierarchyManager(); 
     103 
    102104        /** Constructs the view space and object space subdivision from a given set of rays 
    103105                and a set of objects. 
     
    153155 
    154156        void ExportObjectSpaceHierarchyForViz(const ObjectContainer &objects) const; 
    155     ~HierarchyManager(); 
     157 
    156158 
    157159protected: 
     
    197199        void CollectObjectSpaceDirtyList(SubdivisionCandidateContainer &dirtyList); 
    198200                 
     201        void ExportOspTreeForViz(const ObjectContainer &objects) const; 
     202        void ExportBvhForViz(const ObjectContainer &objects) const; 
     203 
     204        void ConstructBvHierarchy( 
     205                const VssRayContainer &sampleRays, 
     206                const ObjectContainer &objects, 
     207                AxisAlignedBox3 *forcedViewSpace); 
     208 
     209        void ConstructOspTree( 
     210                const VssRayContainer &sampleRays, 
     211                const ObjectContainer &objects, 
     212                AxisAlignedBox3 *forcedViewSpace); 
    199213 
    200214protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp

    r1233 r1286  
    331331        ProcessMultipleRefs(front); 
    332332 
    333   delete leaf; 
    334   return node; 
     333        delete leaf; 
     334        return node; 
    335335} 
    336336 
     
    852852KdNode * 
    853853KdTree::FindRandomNeighbor(KdNode *n, 
    854                                                                                                         bool onlyUnmailed 
    855                                                                                                         ) 
     854                                                  bool onlyUnmailed 
     855                                                  ) 
    856856{ 
    857857  stack<KdNode *> nodeStack; 
     
    12881288        IN_STREAM stream(filename.c_str(), IN_BIN_MODE); 
    12891289 
    1290         //if (!stream.is_open()) return false; 
     1290        if (!stream.is_open()) return false; 
    12911291 
    12921292        std::stable_sort(objects.begin(), objects.end(), ilt); 
     
    12991299        { 
    13001300                Intersectable *obj = *oit; 
    1301  
    13021301                // compute bounding box of view space 
    13031302                mBox.Include(obj->GetBox()); 
     
    13341333 
    13351334                        ++ mStat.splits[interior->mAxis]; 
    1336  
    1337                         //Debug << "plane: " << interior->mAxis << " " << interior->mPosition << endl; 
    1338                         //Debug << "box: " << tData.mBox << endl; 
    13391335 
    13401336                        // compute new bounding box 
     
    13551351                } 
    13561352        } 
    1357  
    13581353        Debug << mStat << endl; 
    13591354 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r1233 r1286  
    576576   
    577577}; 
    578    
    579  
    580578 
    581579 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp

    r1281 r1286  
    158158         
    159159        SceneGraphNode *root = new SceneGraphNode; 
    160         cout<<"HERE2!\n"; 
     160 
    161161        int meshGrouping; 
    162162        Environment::GetSingleton()->GetIntValue("ObjParser.meshGrouping", meshGrouping); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp

    r1264 r1286  
    643643 
    644644        float sum = (float)totalVol * sizeBox; 
    645  
    646645 
    647646        Debug << "here82 render cost: " << renderCost / viewSpaceVol << endl; 
     
    25702569                stream << "objects=\""; 
    25712570                 
    2572                 //-- export objects in kd leaves 
     2571                // export objects in kd leaves 
    25732572                //if (mExportObjects) ExportObjects(leaf, stream); 
    25742573                 
    25752574                stream << "\" />" << endl; 
    2576                 //stream << " </Leaf>" << endl; 
    25772575        } 
    25782576        else 
     
    26582656 
    26592657SubdivisionCandidate * OspTree::PrepareConstruction(const VssRayContainer &sampleRays, 
    2660                                                                                    const ObjectContainer &objects, 
    2661                                                                                    AxisAlignedBox3 *forcedObjectSpace, 
    2662                                                                                    RayInfoContainer &rays) 
     2658                                                                                                        const ObjectContainer &objects, 
     2659                                                                                                        AxisAlignedBox3 *forcedObjectSpace, 
     2660                                                                                                        RayInfoContainer &rays) 
    26632661{ 
    26642662        // store pointer to this tree 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1283 r1286  
    425425                // default view space is the extent of the scene 
    426426                mViewCellsManager->SetViewSpaceBox(mSceneGraph->GetBox()); 
    427  
    428  
    429427        } 
    430428         
     
    12311229} 
    12321230 
     1231 
    12331232int Preprocessor::CastRay( 
    12341233                                                  const Vector3 &viewPoint, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r1283 r1286  
    6161                        <Tool 
    6262                                Name="VCCLCompilerTool" 
    63                                 Optimization="0" 
    64                                 InlineFunctionExpansion="0" 
    65                                 FavorSizeOrSpeed="0" 
     63                                Optimization="3" 
     64                                GlobalOptimizations="TRUE" 
     65                                InlineFunctionExpansion="2" 
     66                                EnableIntrinsicFunctions="TRUE" 
     67                                FavorSizeOrSpeed="1" 
     68                                OmitFramePointers="TRUE" 
     69                                EnableFiberSafeOptimizations="TRUE" 
     70                                OptimizeForProcessor="3" 
    6671                                OptimizeForWindowsApplication="TRUE" 
    6772                                AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost" 
     
    7378                                RuntimeTypeInfo="TRUE" 
    7479                                UsePrecompiledHeader="0" 
     80                                BrowseInformation="1" 
    7581                                WarningLevel="2" 
    7682                                Detect64BitPortabilityProblems="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r1283 r1286  
    7070                        <Tool 
    7171                                Name="VCCLCompilerTool" 
    72                                 Optimization="0" 
     72                                Optimization="3" 
     73                                GlobalOptimizations="TRUE" 
     74                                InlineFunctionExpansion="2" 
     75                                EnableIntrinsicFunctions="TRUE" 
     76                                FavorSizeOrSpeed="1" 
     77                                OptimizeForProcessor="3" 
     78                                OptimizeForWindowsApplication="TRUE" 
    7379                                AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\MultiLevelRayTracing" 
    7480                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 
     
    7682                                RuntimeTypeInfo="TRUE" 
    7783                                UsePrecompiledHeader="0" 
     84                                BrowseInformation="1" 
    7885                                WarningLevel="3" 
    7986                                Detect64BitPortabilityProblems="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1284 r1286  
    304304        else 
    305305                mChildren.erase(it); 
     306} 
     307 
     308 
     309void ViewCellInterior::ReplaceChildLink(ViewCell *prev, ViewCell *cur) 
     310{ 
     311        // erase leaf from old view cell 
     312        ViewCellContainer::iterator it = mChildren.begin(); 
     313 
     314        for (; (*it) != prev; ++ it); 
     315        if (it == mChildren.end()) 
     316        { 
     317                Debug << "error: child link not found" << endl; 
     318        } 
     319        else 
     320        { 
     321                (*it) = cur; 
     322        } 
    306323} 
    307324 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r1284 r1286  
    302302        */ 
    303303        void SetupChildLink(ViewCell *l); 
     304        void ReplaceChildLink(ViewCell *prev, ViewCell *cur); 
     305 
    304306        void RemoveChildLink(ViewCell *l); 
    305307        bool IsLeaf() const; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1284 r1286  
    362362        startTime = GetTime(); 
    363363 
    364         // -- stats after contruction 
     364        // -- stats after construction 
    365365        ResetViewCells(); 
    366366        Debug << "\nView cells after initial sampling:\n" << mCurrentViewCellsStats << endl; 
     
    480480        } 
    481481 
    482  
    483         //-- visualization 
    484  
    485482        if (mShowVisualization) 
    486483        { 
     484                //-- visualization 
    487485                VssRayContainer visualizationSamples; 
    488486 
     
    690688 
    691689        mVspBspTree->Export(stream); 
    692         stream << endl << "</ViewSpaceHierarchy>" << endl; 
     690        stream << "</ViewSpaceHierarchy>" << endl; 
    693691 
    694692        stream << "</VisibilitySolution>" << endl; 
     
    48004798        Debug << "saved rays: " << (int)savedRays.size() << endl; 
    48014799 
    4802         long startTime; 
    4803  
    48044800        //mHierarchyManager->Construct(constructionRays, objects, &mViewSpaceBox); 
    48054801        mHierarchyManager->Construct2(constructionRays, objects, &mViewSpaceBox); 
     
    48274823 
    48284824 
    4829         startTime = GetTime(); 
     4825        const long startTime = GetTime(); 
    48304826 
    48314827        cout << "Computing remaining ray contributions ... "; 
     
    53895385        stream << "<ViewSpaceHierarchy type=\"vsp\"" 
    53905386                   << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
    5391                    << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
     5387                   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\">" << endl; 
    53925388 
    53935389        mHierarchyManager->GetVspTree()->Export(stream); 
    5394         stream << endl << "</ViewSpaceHierarchy>" << endl; 
     5390        stream << "</ViewSpaceHierarchy>" << endl; 
    53955391 
    53965392         
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r1284 r1286  
    8989  , mCurrentBspNode(NULL) 
    9090  , mCurrentVspNode(NULL) 
    91   , mCurrentKdNode(NULL) 
     91  , mCurrentOspNode(NULL) 
     92  , mCurrentBvhNode(NULL) 
    9293  , mObjects(objects) 
    9394  , mBoundingBoxConverter(bconverter) 
     
    114115 
    115116        if (element == "BoundingBoxes") 
     117        { 
    116118                EndBoundingBoxes(); 
     119        } 
    117120 
    118121        if (element == "ViewCells") 
     122        {        
    119123                EndViewCells(); 
    120  
    121         // inside the view cell description 
    122         if (mCurrentState == PARSE_VIEWCELLS) 
    123         { 
    124                 if (element == "Interior") 
    125                         EndViewCellInterior(); 
    126         } 
    127         else 
    128         { 
    129                 if (element == "Interior") 
    130                         EndBspInterior(); 
     124        } 
     125 
     126        if (element == "ObjectSpaceHierarchy") 
     127        { 
     128                EndObjectSpaceHierarchy(); 
    131129        } 
    132130 
    133131        // finished, create view cells manager 
    134132        if (element == "VisibilitySolution") 
     133        { 
    135134                CreateViewCellsManager(); 
     135        } 
     136 
     137        if (element == "Interior") 
     138        { 
     139                switch (mCurrentState) 
     140                { 
     141                case PARSE_VIEWCELLS: 
     142                        EndViewCellInterior(); 
     143                        break; 
     144                case PARSE_OBJECTSPACE_HIERARCHY: 
     145                        EndObjectSpaceHierarchyInterior(); 
     146                        break; 
     147                case PARSE_VIEWSPACE_HIERARCHY:  
     148                        EndViewSpaceHierarchyInterior(); 
     149                        break; 
     150                default: 
     151                        break; 
     152                } 
     153        } 
     154} 
     155 
     156 
     157void ViewCellsParseHandlers::EndObjectSpaceHierarchy() 
     158{ 
     159        if (mObjectSpaceHierarchyType == OSP) 
     160        { 
     161                mHierarchyManager->mOspTree->InsertObjects( 
     162                        mHierarchyManager->mOspTree->mRoot, *mObjects); 
     163        } 
     164} 
     165 
     166 
     167void ViewCellsParseHandlers::EndViewSpaceHierarchyInterior() 
     168{ 
     169        switch (mViewSpaceHierarchyType) 
     170        { 
     171        case BSP: 
     172                EndBspInterior(); 
     173                break; 
     174        case VSP: 
     175                EndVspInterior(); 
     176                break;   
     177        default: 
     178                Debug << "not implemented view space hierarchy type " << mViewSpaceHierarchyType << endl; 
     179                break; 
     180        } 
     181} 
     182 
     183 
     184void ViewCellsParseHandlers::EndObjectSpaceHierarchyInterior() 
     185{ 
     186        switch (mObjectSpaceHierarchyType) 
     187        { 
     188        case OSP: 
     189                EndOspInterior(); 
     190                break; 
     191        case BVH: 
     192                EndBvhInterior(); 
     193                break;   
     194        default: 
     195                Debug << "not implemented object space hierarchy type " << mViewSpaceHierarchyType << endl; 
     196                break; 
     197        } 
    136198} 
    137199 
     
    143205        {       cout << "]"; 
    144206                mCurrentBspNode = mCurrentBspNode->GetParent(); 
     207        } 
     208} 
     209 
     210 
     211void ViewCellsParseHandlers::EndBvhInterior() 
     212{ 
     213        // go one up in the tree 
     214        if (mCurrentBvhNode->GetParent()) 
     215        {       cout << "]"; 
     216                mCurrentBvhNode = mCurrentBvhNode->GetParent(); 
     217        } 
     218} 
     219 
     220 
     221void ViewCellsParseHandlers::EndOspInterior() 
     222{ 
     223        // go one up in the tree 
     224        if (mCurrentOspNode->mParent) 
     225        {       cout << "]"; 
     226                mCurrentOspNode = mCurrentOspNode->mParent; 
    145227        } 
    146228} 
     
    243325                StartVspInterior(attributes); 
    244326        } 
    245  
    246327        if (element == "Leaf")  
    247328        { 
     
    289370                                                                                                                        AttributeList& attributes) 
    290371{ 
    291         //if (!mViewCellsManager)return; 
    292  
    293372        //-- use cell type according to the chosen method 
    294  
    295373        switch (mViewSpaceHierarchyType) 
    296374        { 
    297                 case BSP: 
    298                         StartBspElement(element, attributes); 
    299                         break; 
    300                 case VSP: 
    301                         StartVspElement(element, attributes); 
    302                         break; 
    303                 default: 
    304                         Debug << "not implemented" << endl; 
    305                         break; 
     375        case BSP: 
     376                StartBspElement(element, attributes); 
     377                break; 
     378        case VSP: 
     379                StartVspElement(element, attributes); 
     380                break; 
     381        default: 
     382                Debug << "not implemented" << endl; 
     383                break; 
    306384        } 
    307385} 
     
    412490 
    413491 
    414 void ViewCellsParseHandlers::ParseViewCellPvs(ViewCell *viewCell,  
     492void ViewCellsParseHandlers::StartViewCellPvs(ViewCell *viewCell,  
    415493                                                                                          AttributeList&  attributes) 
    416494{ 
     
    433511                        while (1) 
    434512                        { 
    435                                 int index = strtol(ptr, &endptr, 10); 
    436  
    437                                 if (ptr == endptr) 
    438                                         break; 
     513                                const int index = strtol(ptr, &endptr, 10); 
     514 
     515                                if (ptr == endptr) break; 
    439516 
    440517                                objIndices.push_back(index); 
     
    454531 
    455532                                ObjectContainer::iterator oit = 
    456                                         lower_bound(mObjects->begin(), mObjects->end(), (Intersectable *)&dummyInst, ilt);       
     533                                        lower_bound(mObjects->begin(),  
     534                                                                mObjects->end(),  
     535                                                                (Intersectable *)&dummyInst, ilt);       
    457536                                                         
    458537                                if ((oit != mObjects->end()) && ((*oit)->GetId() == objId)) 
     
    551630void ViewCellsParseHandlers::StartObjectSpaceHierarchy(AttributeList& attributes) 
    552631{ 
    553         int len = attributes.getLength(); 
    554  
     632        const int len = attributes.getLength(); 
    555633        Vector3 bmin, bmax; 
    556 cout << "here3" << endl; 
     634 
    557635        for (int i = 0; i < len; ++ i)  
    558636        { 
     
    567645                        { 
    568646                                cout << "\nobject space hierarchy: Osp" << endl; 
     647 
    569648                                mHierarchyManager =  
    570649                                        new HierarchyManager(mVspTree, HierarchyManager::KD_BASED_OBJ_SUBDIV); 
     650 
     651                                mObjectSpaceHierarchyType = OSP; 
     652 
     653                                //std::stable_sort(objects.begin(), objects.end(), ilt); 
     654                                mHierarchyManager->mOspTree->mBoundingBox.Initialize(); 
     655                                ObjectContainer::const_iterator oit, oit_end = mObjects->end(); 
     656                                 
     657                                //-- compute bounding box 
     658                                for (oit = mObjects->begin(); oit != oit_end; ++ oit) 
     659                                { 
     660                                        Intersectable *obj = *oit; 
     661                                        // compute bounding box of view space 
     662                                        mHierarchyManager->mOspTree->mBoundingBox.Include(obj->GetBox()); 
     663                                } 
    571664                        } 
    572665                        else if (strcmp(ptr, "bvh") == 0) 
    573666                        { 
    574667                                cout << "\nobject space hierarchy: Bvh" << endl; 
     668                                mObjectSpaceHierarchyType = BVH; 
    575669                                mHierarchyManager =  
    576670                                        new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV); 
     
    579673        } 
    580674} 
    581  
    582675 
    583676 
     
    675768        { 
    676769                // add to invalid view space 
    677                 if (mViewSpaceHierarchyType== ViewCellsManager::VSP_BSP) 
    678                 { 
    679                         leaf->SetViewCell(mVspBspTree->GetOrCreateOutOfBoundsCell()); 
    680                         leaf->SetTreeValid(false); 
    681                         mVspBspTree->PropagateUpValidity(leaf); 
    682                 } 
     770                leaf->SetViewCell(mVspBspTree->GetOrCreateOutOfBoundsCell()); 
     771                leaf->SetTreeValid(false); 
     772                mVspBspTree->PropagateUpValidity(leaf); 
    683773        } 
    684774} 
     
    736826        } 
    737827 
    738         ParseViewCellPvs(viewCell, attributes); 
     828        StartViewCellPvs(viewCell, attributes); 
    739829 
    740830        // collect leaves 
     
    746836{ 
    747837        ViewCellInterior* interior = new ViewCellInterior(); 
    748         cout << "here7"<<endl; 
     838         
    749839        if (mCurrentViewCell) // replace NULL child of parent with current node 
    750840        { 
     
    760850        mCurrentViewCell = interior; 
    761851 
    762         ParseViewCellPvs(interior, attributes); 
     852        StartViewCellPvs(interior, attributes); 
    763853} 
    764854 
     
    767857{ 
    768858        ViewCellContainer::iterator it, it_end = mViewCells.end(); 
    769         Debug << endl; 
     859        cout << "\n====================" << endl << endl; 
    770860        for (it = mViewCells.begin(); it != it_end; ++ it) 
    771861        { 
    772                 Debug << (*it)->GetId() << " "; 
    773         } 
    774 Debug << endl; 
     862                cout << (*it)->GetId() << " "; 
     863        } 
     864cout << endl; 
    775865        if (mViewSpaceHierarchyType == BSP) 
    776866        { 
     
    799889                        else 
    800890                        { 
    801                 vc->GetParent()->SetupChildLink(bspVc); 
    802                                 vc->GetParent()->RemoveChildLink(vc); 
     891                vc->GetParent()->ReplaceChildLink(vc, bspVc); 
    803892                        } 
    804893 
     
    806895                        (*vit) = bspVc; 
    807896                } 
    808  
    809897        } 
    810898        else if (mViewSpaceHierarchyType == VSP)  
     
    834922                        else 
    835923                        { 
    836                 vc->GetParent()->SetupChildLink(vspVc); 
    837                                 vc->GetParent()->RemoveChildLink(vc); 
     924                                vc->GetParent()->ReplaceChildLink(vc, vspVc); 
    838925                        } 
    839926                         
     
    849936                } 
    850937        } 
    851         Debug << "************************" << endl; 
     938        cout << "************************" << endl; 
    852939        it_end = mViewCells.end(); 
    853940        for (it = mViewCells.begin(); it != it_end; ++ it) 
    854941        { 
    855                 Debug << (*it)->GetId() << " "; 
    856         } 
    857         Debug << endl; 
     942                cout << (*it)->GetId() << " "; 
     943        } 
     944        cout << endl; 
    858945        cout << "\nview space box: " << mViewSpaceBox << endl; 
    859946} 
     
    862949void ViewCellsParseHandlers::CreateViewCellsManager(/*const char *name*/) 
    863950{ 
    864         if (mViewSpaceHierarchyType == BSP) //  
     951        if (mViewSpaceHierarchyType == BSP) 
    865952        { 
    866953                Debug << "creating view cells manager: VspBsp" << endl; 
    867954 
    868                 //mVspBspTree = new VspBspTree(); 
    869955                mViewCellsManager = new VspBspViewCellsManager(mViewCellsTree, mVspBspTree); 
    870956        } 
     
    9501036                if (vit == mViewCells.end()) 
    9511037                        cout << "error: view cell " << viewCellId << " not found" << endl; 
    952  
     1038         
    9531039                VspViewCell *viewCell = dynamic_cast<VspViewCell *>(*vit); 
    954          
     1040                 
    9551041                if (viewCell->GetId() == viewCellId) 
    9561042                { 
     
    9641050        } 
    9651051        else 
    966         { 
     1052        {        
    9671053                // add to invalid view space 
    9681054                leaf->SetViewCell(mVspTree->GetOrCreateOutOfBoundsCell()); 
     
    9861072                if (attrName == "plane")  
    9871073                { 
    988                         sscanf(ptr, "%d %f", &plane.mAxis, &plane.mPosition); 
     1074                        sscanf(ptr, "%f %d", &plane.mPosition, &plane.mAxis); 
    9891075                } 
    9901076        } 
     
    9941080        if (mCurrentVspNode) // replace NULL child of parent with current node 
    9951081        { 
    996                 VspInterior *current = dynamic_cast<VspInterior *>(mCurrentVspNode); 
    997  
    998                 current->ReplaceChildLink(NULL, interior); 
    999                 interior->SetParent(current); 
     1082                VspInterior *parent = dynamic_cast<VspInterior *>(mCurrentVspNode); 
     1083 
     1084                parent->ReplaceChildLink(NULL, interior); 
     1085                interior->SetParent(parent); 
     1086                 
     1087                AxisAlignedBox3 frontBox, backBox; 
     1088 
     1089                parent->GetBoundingBox().Split(parent->GetPlane().mAxis, parent->GetPlane().mPosition, frontBox, backBox); 
     1090                if (parent->GetFront() == interior) 
     1091                        interior->SetBoundingBox(frontBox); 
     1092                else 
     1093                        interior->SetBoundingBox(backBox); 
    10001094        } 
    10011095        else 
    10021096        { 
    10031097                mVspTree->mRoot = interior; 
     1098                interior->SetBoundingBox(mVspTree->GetBoundingBox()); 
    10041099        } 
    10051100 
     
    10211116                if (attrName == "plane")  
    10221117                { 
    1023                         sscanf(ptr, "%d %f", 
    1024                                    &plane.mAxis, &plane.mPosition); 
     1118                        sscanf(ptr, "%f %d", &plane.mPosition, &plane.mAxis); 
    10251119                } 
    10261120        } 
     
    10311125        interior->mPosition = plane.mPosition; 
    10321126 
    1033         if (mCurrentKdNode) // replace NULL child of parent with current node 
    1034         { 
    1035                 KdInterior *parent = dynamic_cast<KdInterior *>(mCurrentKdNode); 
     1127        if (mCurrentOspNode) // replace NULL child of parent with current node 
     1128        { 
     1129                KdInterior *parent = dynamic_cast<KdInterior *>(mCurrentOspNode); 
    10361130                parent->ReplaceChildLink(NULL, interior); 
    10371131                interior->mParent = parent; 
     1132 
     1133                AxisAlignedBox3 frontBox, backBox; 
     1134 
     1135                parent->mBox.Split(parent->mAxis, parent->mPosition, frontBox, backBox); 
     1136                if (parent->mFront == interior) 
     1137                        interior->mBox = frontBox; 
     1138                else 
     1139                        interior->mBox = backBox; 
    10381140        } 
    10391141        else 
    10401142        { 
    10411143                mHierarchyManager->mOspTree->mRoot = interior; 
    1042         } 
    1043  
    1044         mCurrentKdNode = interior; 
     1144                interior->mBox = mHierarchyManager->mOspTree->mBoundingBox; 
     1145        } 
     1146 
     1147        mCurrentOspNode = interior; 
    10451148} 
    10461149 
     
    10491152{ 
    10501153        KdLeaf * leaf =  
    1051                 new KdLeaf(dynamic_cast<KdInterior *>(mCurrentKdNode), NULL); 
    1052  
    1053         if (mCurrentKdNode) // replace front or (if not NULL) back child 
    1054         { 
    1055                 dynamic_cast<KdInterior *>(mCurrentKdNode)->ReplaceChildLink(NULL, leaf); 
     1154                new KdLeaf(dynamic_cast<KdInterior *>(mCurrentOspNode), NULL); 
     1155 
     1156        if (mCurrentOspNode) // replace front or (if not NULL) back child 
     1157        { 
     1158                dynamic_cast<KdInterior *>(mCurrentOspNode)->ReplaceChildLink(NULL, leaf); 
    10561159        } 
    10571160        else 
     
    10631166 
    10641167void ViewCellsParseHandlers::StartBvhLeaf(AttributeList& attributes) 
    1065 {/* 
    1066         KdLeaf * leaf =  
    1067                 new KdLeaf(dynamic_cast<KdInterior *>(mCurrentKdNode), NULL); 
    1068  
    1069         if (mCurrentKdNode) // replace front or (if not NULL) back child 
    1070         { 
    1071                 dynamic_cast<KdInterior *>(mCurrentKdNode)->ReplaceChildLink(NULL, leaf); 
    1072         } 
    1073         else 
    1074         { 
    1075                 mHierarchyManager->mBvHierarchy->mRoot = leaf; 
    1076         }*/ 
    1077 } 
    1078  
    1079  
    1080 void ViewCellsParseHandlers::StartBvhInterior(AttributeList& attributes) 
    1081 {/* 
    1082         AxisAlignedPlane plane; 
    1083         int len = attributes.getLength(); 
     1168{ 
     1169        const int len = attributes.getLength(); 
     1170        Vector3 minBox, maxBox; 
     1171 
     1172        ObjectContainer objects; 
    10841173 
    10851174        for (int i = 0; i < len; ++ i)  
     
    10891178                const char *ptr = attrValue.LocalForm(); 
    10901179 
    1091                 if (attrName == "plane")  
    1092                 { 
    1093                         sscanf(ptr, "%d %f", 
    1094                                    &plane.mAxis, &plane.mPosition); 
    1095                 } 
    1096         } 
    1097  
    1098         KdInterior* interior = new KdInterior(NULL); 
    1099          
    1100         interior->mAxis = plane.mAxis; 
    1101         interior->mPosition = plane.mPosition; 
    1102  
    1103         if (mCurrentKdNode) // replace NULL child of parent with current node 
    1104         { 
    1105                 KdInterior *parent = dynamic_cast<KdInterior *>(mCurrentKdNode); 
     1180                if (attrName == "min")  
     1181                { 
     1182                        sscanf(ptr, "%f %f %f", &minBox); 
     1183                } 
     1184                if (attrName == "max")  
     1185                { 
     1186                        sscanf(ptr, "%f %f %f", &maxBox); 
     1187                } 
     1188                if (attrName == "objects") 
     1189                { 
     1190                        StartBvhLeafObjects(objects, ptr); 
     1191                } 
     1192        } 
     1193 
     1194        BvhLeaf * leaf =  
     1195                new BvhLeaf(AxisAlignedBox3(minBox, maxBox),  
     1196                                        dynamic_cast<BvhInterior *>(mCurrentBvhNode), (int)objects.size()); 
     1197 
     1198        leaf->mObjects = objects; 
     1199 
     1200        if (mCurrentBvhNode) // replace front or (if not NULL) back child 
     1201        { 
     1202                dynamic_cast<BvhInterior *>(mCurrentBvhNode)->ReplaceChildLink(NULL, leaf); 
     1203        } 
     1204        else 
     1205        { 
     1206                mHierarchyManager->mBvHierarchy->mRoot = leaf; 
     1207        } 
     1208} 
     1209 
     1210 
     1211void ViewCellsParseHandlers::StartBvhLeafObjects(ObjectContainer &objects,  
     1212                                                                                                 const char *ptr) 
     1213{ 
     1214        vector<int> objIndices; 
     1215 
     1216        char *endptr; 
     1217                         
     1218        while (1) 
     1219        { 
     1220                const int index = strtol(ptr, &endptr, 10); 
     1221 
     1222                if (ptr == endptr) break; 
     1223 
     1224                objIndices.push_back(index); 
     1225 
     1226                ptr = endptr; 
     1227        } 
     1228 
     1229        //TODO: find objects and add them to pvs 
     1230        // TODO: get view cell with specified id 
     1231        MeshInstance dummyInst(NULL); 
     1232 
     1233        vector<int>::const_iterator it, it_end = objIndices.end(); 
     1234 
     1235        for (it = objIndices.begin(); it != it_end; ++ it) 
     1236        { 
     1237                const int objId = *it;   
     1238                dummyInst.SetId(objId); 
     1239 
     1240                ObjectContainer::iterator oit = 
     1241                        lower_bound(mObjects->begin(), mObjects->end(), (Intersectable *)&dummyInst, ilt);       
     1242                                                         
     1243                if ((oit != mObjects->end()) && ((*oit)->GetId() == objId)) 
     1244                { 
     1245                        objects.push_back(*oit);         
     1246                } 
     1247                else 
     1248                { 
     1249                        cout << "error: object with id " << objId << " does not exist" << endl; 
     1250                } 
     1251        } 
     1252} 
     1253 
     1254 
     1255void ViewCellsParseHandlers::StartBvhInterior(AttributeList& attributes) 
     1256{ 
     1257        const int len = attributes.getLength(); 
     1258        Vector3 minBox, maxBox; 
     1259 
     1260        for (int i = 0; i < len; ++ i)  
     1261        { 
     1262                string attrName(StrX(attributes.getName(i)).LocalForm()); 
     1263                StrX attrValue(attributes.getValue(i)); 
     1264                const char *ptr = attrValue.LocalForm(); 
     1265 
     1266                if (attrName == "min")  
     1267                { 
     1268                        sscanf(ptr, "%f %f %f", &minBox); 
     1269                } 
     1270                if (attrName == "max")  
     1271                { 
     1272                        sscanf(ptr, "%f %f %f", &maxBox); 
     1273                } 
     1274        } 
     1275 
     1276        BvhInterior* interior = new BvhInterior(AxisAlignedBox3(minBox, maxBox)); 
     1277 
     1278        if (mCurrentBvhNode) // replace NULL child of parent with current node 
     1279        { 
     1280                BvhInterior *parent = dynamic_cast<BvhInterior *>(mCurrentBvhNode); 
    11061281                parent->ReplaceChildLink(NULL, interior); 
    1107                 interior->mParent = parent; 
     1282                interior->SetParent(parent); 
    11081283        } 
    11091284        else 
    11101285        { 
    1111                 mOspTree->mRoot = interior; 
    1112         } 
    1113  
    1114         mCurrentKdNode = interior;*/ 
    1115 } 
    1116  
     1286                mBvHierarchy->mRoot = interior; 
     1287        } 
     1288 
     1289        mCurrentBvhNode = interior; 
     1290} 
    11171291 
    11181292 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h

    r1284 r1286  
    2424class OspTree; 
    2525class VspNode; 
     26class BvhNode; 
    2627class BvHierarchy; 
    2728class HierarchyManager; 
     
    8384 
    8485  BspNode *mCurrentBspNode; 
     86  BvhNode *mCurrentBvhNode; 
     87  KdNode *mCurrentOspNode; 
    8588  VspNode *mCurrentVspNode; 
     89  //KdNode *mCurrentKdNode; 
     90 
    8691  ViewCell *mCurrentViewCell; 
    87   KdNode *mCurrentKdNode; 
    88    
     92     
    8993  BspNode *mBspRoot; 
    9094  VspNode *mVspRoot; 
     
    101105  int mCurrentState; 
    102106   
    103   enum {PARSE_OPTIONS, PARSE_VIEWCELLS, PARSE_VIEWSPACE_HIERARCHY, PARSE_OBJECTSPACE_HIERARCHY}; 
     107  enum { 
     108          PARSE_OPTIONS,  
     109          PARSE_VIEWCELLS,  
     110          PARSE_VIEWSPACE_HIERARCHY,  
     111          PARSE_OBJECTSPACE_HIERARCHY}; 
    104112 
    105113  /// view space / object space hierarchy types 
     
    118126  void EndVspInterior(); 
    119127 
    120   void ParseViewCellPvs(ViewCell *viewCell, AttributeList&  attributes); 
     128  void StartViewCellPvs(ViewCell *viewCell, AttributeList&  attributes); 
    121129  void EndViewCells(); 
    122130  void EndBoundingBoxes(); 
     
    150158  void StartBvhElement(string element, AttributeList& attributes); 
    151159 
     160  void EndViewSpaceHierarchyInterior(); 
     161  void EndObjectSpaceHierarchyInterior(); 
     162 
     163  void EndBvhInterior(); 
     164  void EndOspInterior(); 
     165 
     166  void EndObjectSpaceHierarchy(); 
     167 
     168  void StartBvhLeafObjects(ObjectContainer &objects, const char *ptr); 
    152169 
    153170  // ----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1278 r1286  
    27592759 
    27602760        if (parent->GetFront() == node) 
    2761       box.SetMin(parent->GetAxis(), parent->GetPosition()); 
     2761                box.SetMin(parent->GetAxis(), parent->GetPosition()); 
    27622762    else 
    2763       box.SetMax(parent->GetAxis(), parent->GetPosition()); 
     2763                box.SetMax(parent->GetAxis(), parent->GetPosition()); 
    27642764 
    27652765        return box; 
Note: See TracChangeset for help on using the changeset viewer.