Changeset 1830 for GTP/trunk


Ignore:
Timestamp:
11/29/06 22:43:51 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
4 edited

Legend:

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

    r1827 r1830  
    25412541        SplitQueue tempQueue; 
    25422542        tempQueue.Push(firstCandidate); 
     2543 
    25432544        while (!tempQueue.Empty()) 
    25442545        { 
     
    25492550                        dynamic_cast<BvhSubdivisionCandidate *>(candidate); 
    25502551 
    2551                 const bool globalCriteriaMet = GlobalTerminationCriteriaMet(bsc->mParentData); 
    2552  
    25532552                if (!InitialTerminationCriteriaMet(bsc->mParentData)) 
    25542553                { 
     2554                        const bool globalCriteriaMet = GlobalTerminationCriteriaMet(bsc->mParentData); 
     2555                 
    25552556                        BvhNode *node = Subdivide(tempQueue, bsc, globalCriteriaMet); 
    25562557 
     
    25602561                else // initial preprocessing  finished for this candidate 
    25612562                { 
    2562                         // add to "real" traversal queue 
     2563                        // add to candidate container 
    25632564                        candidateContainer.push_back(bsc); 
    25642565                } 
     
    25752576        ObjectContainer::const_iterator oit, oit_end = objects->end(); 
    25762577    
    2577         /*for (oit = objects->begin(); oit != objects->end(); ++ oit) 
    2578         { 
    2579                 cout << (*oit)->GetBox().SurfaceArea() << " "; 
    2580         }*/ 
    2581  
    25822578        float maxAreaDiff = -1.0f; 
    25832579 
    25842580        ObjectContainer::const_iterator backObjectsStart = objects->begin(); 
    2585 int dummy = 0; 
    2586     for (oit = objects->begin(); oit != (objects->end() - 1); ++ oit, ++ dummy) 
     2581 
     2582    for (oit = objects->begin(); oit != (objects->end() - 1); ++ oit) 
    25872583        { 
    25882584                Intersectable *objS = *oit; 
     
    25952591                { 
    25962592                        maxAreaDiff = areaDiff; 
    2597                         //cout << "maxAreaDiff : " << maxAreaDiff << " " << dummy << " " << objects->size() - dummy <<  endl; 
    25982593                        backObjectsStart = oit + 1; 
    25992594                } 
     
    26122607        } 
    26132608         
    2614         cout << "front: " << (int)frontObjects.size() << " back " << (int)backObjects.size() << " " << backObjects.front()->GetBox().SurfaceArea() - frontObjects.back()->GetBox().SurfaceArea() << endl; 
     2609        cout << "front: " << (int)frontObjects.size() << " back: " << (int)backObjects.size() << " "  
     2610                 << backObjects.front()->GetBox().SurfaceArea() - frontObjects.back()->GetBox().SurfaceArea() << endl; 
    26152611} 
    26162612 
     
    26212617        const float areaLarge = largeObj->GetBox().SurfaceArea(); 
    26222618 
    2623         return areaSmall / (areaLarge - areaSmall + Limits::Small); 
     2619        return areaLarge / (areaLarge - areaSmall + Limits::Small); 
    26242620} 
    26252621 
     
    26272623bool BvHierarchy::InitialTerminationCriteriaMet(const BvhTraversalData &tData) const 
    26282624{ 
    2629         return (0 
     2625        const bool terminationCriteriaMet = 
     2626                        (0 
    26302627                    || ((int)tData.mNode->mObjects.size() < mInitialMinObjects) 
    26312628                        || (tData.mNode->mObjects.back()->GetBox().SurfaceArea() < mInitialMinArea) 
    26322629                        || (AreaRatio(tData.mNode->mObjects.front(), tData.mNode->mObjects.back()) > mInitialMaxAreaRatio) 
    26332630                        ); 
     2631 
     2632        cout << "criteria met: " << terminationCriteriaMet << " " << (int)tData.mNode->mObjects.size() << " " << mInitialMinObjects << endl 
     2633                 << AreaRatio(tData.mNode->mObjects.front(), tData.mNode->mObjects.back()) << " " << mInitialMaxAreaRatio << endl 
     2634                 << tData.mNode->mObjects.back()->GetBox().SurfaceArea() << " " << mInitialMinArea << endl; 
     2635 
     2636        return terminationCriteriaMet; 
    26342637} 
    26352638 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1789 r1830  
    274274 
    275275 
     276float HierarchyManager::EvalFullMem() const 
     277{ 
     278        // question: should I also add the mem usage of the hierarchies? 
     279        const float objectSpaceMem = 16;//GetObjectSpaceMemUsage(); 
     280        const float viewSpaceMem = 16;//mVspTree->GetMemUsage(); 
     281        // HACK: the same value is used for view and object space 
     282        return mHierarchyStats.mMemory + mHierarchyStats.Leaves() * objectSpaceMem; 
     283} 
     284 
     285 
    276286void HierarchyManager::EvalSubdivisionStats() 
    277287{ 
    278         // question: should I also add the mem usage of the hierarchies? 
    279         const float objectSpaceMem = GetObjectSpaceMemUsage(); 
    280         const float viewSpaceMem = mVspTree->GetMemUsage(); 
    281                  
     288         
    282289        HierarchySubdivisionStats stats; 
    283290 
     
    286293        stats.mEntriesInPvs = mHierarchyStats.mPvsEntries; 
    287294        stats.mMemoryCost = mHierarchyStats.mMemory  / float(1024 * 1024); 
    288         stats.mFullMemory = mHierarchyStats.mMemory  / float(1024 * 1024) 
    289                                                 + objectSpaceMem + viewSpaceMem; 
     295        stats.mFullMemory = EvalFullMem() / float(1024 * 1024); 
    290296        stats.mViewSpaceSplits = mVspTree->mVspStats.Leaves(); 
    291297        stats.mObjectSpaceSplits = GetObjectSpaceSubdivisionLeaves(); 
     
    322328                (0 
    323329                || (mHierarchyStats.Leaves() >= mTermMaxLeaves)  
    324                 || (mHierarchyStats.mMemory >= mTermMaxMemory) 
     330                //|| (mHierarchyStats.mMemory >= mTermMaxMemory) 
     331                || (EvalFullMem() >= mTermMaxMemory) 
    325332                || candidate->GlobalTerminationCriteriaMet() 
    326333                //|| (mHierarchyStats.mRenderCostDecrease < mMinRenderCostDecrease) 
     
    335342                Debug << "cost misses: " << mHierarchyStats.mGlobalCostMisses << " " << mTermGlobalCostMissTolerance << endl; 
    336343                Debug << "memory: " << mHierarchyStats.mMemory << " " << mTermMaxMemory << endl; 
     344                Debug << "full memory: " << EvalFullMem() << " " << mTermMaxMemory << endl; 
    337345        } 
    338346#endif 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1787 r1830  
    528528        void GetPvsEfficiently(ViewCell *vc, ObjectPvs &pvs) const; 
    529529 
     530        float EvalFullMem() const; 
     531 
    530532protected: 
    531533 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1826 r1830  
    122122        { 
    123123                mStrategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
    124                 mStrategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     124                //mStrategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     125                mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    125126                mStrategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
    126127        } 
     
    56645665        Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 
    56655666 
    5666         //Vector3 scale(0.9f, 0.9f, 0.9f); 
    5667         Vector3 scale(1.0f, 1.0f, 1.0f); 
     5667        Vector3 scale(0.9f, 0.9f, 0.9f); 
     5668        //Vector3 scale(1.0f, 1.0f, 1.0f); 
    56685669 
    56695670        if (exporter) 
     
    62146215        { 
    62156216                evalStrats.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
    6216                 evalStrats.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     6217                //evalStrats.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 
     6218                evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    62176219                evalStrats.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
    62186220 
Note: See TracChangeset for help on using the changeset viewer.