Changeset 1732


Ignore:
Timestamp:
11/09/06 13:36:30 (18 years ago)
Author:
mattausch
Message:

resolved coflicts
improved memory constant

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
8 edited

Legend:

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

    r1727 r1732  
    4747mParent(NULL),  
    4848mMailbox(0), 
    49 mRenderCostDecr(0),  
    50 mMemoryIncr(0), 
    51 mPvsEntriesIncr(0), 
     49//mRenderCostDecr(0),  
     50//mMemoryIncr(0), 
     51//mPvsEntriesIncr(0), 
    5252mTimeStamp(0) 
    5353{ 
     
    5959mBoundingBox(bbox),  
    6060mMailbox(0), 
    61 mMemoryIncr(0), 
    62 mRenderCostDecr(0),  
    63 mPvsEntriesIncr(0), 
     61//mMemoryIncr(0), 
     62//mRenderCostDecr(0),  
     63//mPvsEntriesIncr(0), 
    6464mTimeStamp(0) 
    6565{ 
     
    7171mParent(parent),  
    7272mMailbox(0), 
    73 mMemoryIncr(0), 
    74 mRenderCostDecr(0),  
    75 mPvsEntriesIncr(0), 
     73//mMemoryIncr(0), 
     74//mRenderCostDecr(0),  
     75//mPvsEntriesIncr(0), 
    7676mTimeStamp(0) 
    7777{ 
     
    292292        Environment::GetSingleton()->GetIntValue("BvHierarchy.maxTests", mMaxTests); 
    293293 
    294         //mUseBboxAreaForSah = false; 
    295         mUseBboxAreaForSah = true; 
     294        //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(VspViewCell)); 
     295        //mMemoryConst = (float)sizeof(BvhLeaf); 
     296mMemoryConst = (float)sizeof(ObjectContainer); 
     297        cout << "bvh memcost: " << mMemoryConst << endl; 
     298        cout << "triangle: " << sizeof(TriangleIntersectable) << endl; 
     299        cout << "triangle: " << sizeof(Intersectable) << endl; 
     300        cout << "triangle: " << sizeof(ObjectContainer) << endl; 
     301        cout << "triangle: " << sizeof(float) << endl; 
     302        cout << "triangle: " << sizeof(int) << endl; 
     303 
     304    mUseBboxAreaForSah = true; 
    296305 
    297306        ///////////// 
     
    317326        Debug << "use global sort: " << mUseGlobalSorting << endl; 
    318327        Debug << "minimal rays for visibility: " << mMinRaysForVisibility << endl; 
     328        Debug << "bvh mem const: " << mMemoryConst << endl; 
    319329 
    320330        Debug << endl; 
     
    503513                { 
    504514                        BvhLeaf *leaf = dynamic_cast<BvhLeaf *>(currentNode); 
    505                         CollectRays(leaf->mObjects, leaf->mVssRays); 
     515                //      CollectRays(leaf->mObjects, leaf->mVssRays); 
    506516                } 
    507517                 
     
    584594                // otherwise danger of being stuck in a local minimum! 
    585595                const float factor = mRenderCostDecreaseWeight; 
    586                 priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
    587  
    588                 if (mHierarchyManager->mConsiderMemory2) 
    589                 { 
    590                         priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mHierarchyManager->mMemoryConst); 
     596 
     597                if (1) 
     598                { 
     599                        priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     600                        if (mHierarchyManager->mConsiderMemory2) 
     601                        { 
     602                                priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 
     603                        } 
     604                } 
     605                else 
     606                { 
     607                        if (!mHierarchyManager->mConsiderMemory2) 
     608                        { 
     609                                priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     610                        } 
     611                        else 
     612                        { 
     613                                const float ratio =  
     614                                        renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 
     615 
     616                                priority = factor * ratio + (1.0f - factor) * oldRenderCost; 
     617                        } 
    591618                } 
    592619        } 
     
    23512378                //oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 
    23522379                 
    2353                 oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 
    2354                 oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 
     2380                //oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 
     2381                //oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 
    23552382                 
    23562383                /////////////////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r1727 r1732  
    204204        int mTimeStamp; 
    205205 
    206         int mPvsEntriesIncr; 
    207         float mMemoryIncr; 
    208         float mRenderCostDecr; 
     206        //int mPvsEntriesIncr; 
     207        //float mMemoryIncr; 
     208        //float mRenderCostDecr; 
    209209 
    210210        ///////////////////////////////////// 
     
    327327 
    328328        /// Rays piercing this leaf. 
    329         VssRayContainer mVssRays; 
     329        //VssRayContainer mVssRays; 
    330330        /// objects 
    331331        ObjectContainer mObjects; 
     
    954954        int mMinRaysForVisibility; 
    955955 
     956        /// constant value for driving the heuristics 
     957        float mMemoryConst; 
     958 
    956959        int mMaxTests; 
    957960}; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1731 r1732  
    151151        Environment::GetSingleton()->GetIntValue( 
    152152                "Hierarchy.Construction.maxRepairs", mMaxRepairs); 
    153  
    154         if (1 && mConsiderMemory2) 
    155         { 
    156                 mMemoryConst = (float)(sizeof(VspLeaf *) + sizeof (VspViewCell *)); 
    157         } 
    158         else 
    159         { 
    160                 Environment::GetSingleton()->GetFloatValue( 
    161                         "Hierarchy.Termination.memoryConst", mMemoryConst); 
    162         } 
    163  
    164153        // compare to bytes 
    165154        mTermMaxMemory *= (1024.0f * 1024.0f); 
     
    177166        Debug << "consider memory: " << mConsiderMemory << endl; 
    178167        Debug << "consider memory2: " << mConsiderMemory << endl; 
    179         Debug << "mem const: " << mMemoryConst << endl; 
    180168        Debug << "min steps of same kind: " << mMinStepsOfSameType << endl; 
    181169        Debug << "max steps of same kind: " << mMaxStepsOfSameType << endl; 
     
    19331921                         
    19341922                        isLeaf = newNode->IsLeaf(); 
    1935                         subStats.mRenderCostDecrease = oldNode->mRenderCostDecr; 
    1936                         entriesIncr = oldNode->mPvsEntriesIncr; 
     1923                        //subStats.mRenderCostDecrease = oldNode->mRenderCostDecr; 
     1924                        //entriesIncr = oldNode->mPvsEntriesIncr; 
    19371925                } 
    19381926                else 
     
    19441932                         
    19451933                        isLeaf = newNode->IsLeaf(); 
    1946                         subStats.mRenderCostDecrease = oldNode->mRenderCostDecr; 
    1947                         entriesIncr = oldNode->mPvsEntriesIncr; 
     1934                        //subStats.mRenderCostDecrease = oldNode->mRenderCostDecr; 
     1935                        //entriesIncr = oldNode->mPvsEntriesIncr; 
    19481936                }                
    19491937                                 
     
    20782066                 
    20792067                const float objectSpaceHierarchyMem = float( 
    2080                                                                                           subStats.mObjectSpaceSplits * sizeof(BvhLeaf *) +  
    2081                                                                                           (subStats.mObjectSpaceSplits - 1) * sizeof(BvhInterior *) +  
    2082                                                                                           sizeof(BvHierarchy) 
     2068                                                                                          subStats.mObjectSpaceSplits * sizeof(ObjectContainer) 
     2069                                                                                          //+ (subStats.mObjectSpaceSplits - 1) * sizeof(BvhInterior) 
     2070                                                                                          //+sizeof(BvHierarchy) 
    20832071                                                                                          ) / float(1024 * 1024); 
    20842072 
    20852073                         
    20862074                const float viewSpaceHierarchyMem = float( 
    2087                                                                                         subStats.mViewSpaceSplits * sizeof(VspLeaf *) +  
    2088                                                                                         (subStats.mViewSpaceSplits - 1) * sizeof(VspInterior *) +  
    2089                                                                                         sizeof(VspTree) 
     2075                                                                                        subStats.mViewSpaceSplits * sizeof(ObjectPvs) 
     2076                                                                                        //+ (subStats.mViewSpaceSplits - 1) * sizeof(VspInterior) 
     2077                                                                                        + sizeof(ObjectPvs) 
     2078                                                                                        //+ sizeof(VspTree) 
    20902079                                                                                        )  / float(1024 * 1024); 
    20912080 
     
    20932082                 
    20942083                subStats.Print(splitsStats); 
    2095  
    20962084                splits += splitsStepSize; 
    20972085 
    20982086                if (subStats.mNumSplits == mHierarchyStats.Leaves()) 
    20992087                        break; 
    2100         } 
     2088 
     2089                cout << subStats.mNumSplits << " "; 
     2090        } 
     2091        cout << endl; 
    21012092} 
    21022093 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1727 r1732  
    283283 
    284284        inline bool ConsiderMemory() const { return mConsiderMemory; } 
    285         inline float GetMemoryConst() const { return mMemoryConst; } 
     285        //inline float GetMemoryConst() const { return mMemoryConst; } 
    286286 
    287287         
     
    620620        bool mConsiderMemory; 
    621621 
    622         /// constant value for driving the heuristics 
    623         float mMemoryConst; 
    624          
    625622        bool mConsiderMemory2; 
    626623 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r1709 r1732  
    388388}; 
    389389 
     390 
    390391/** Leaf of the view cell hierarchy corresponding  
    391392        to a leaf in a spatial hierarchy. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1723 r1732  
    58045804 
    58055805                        startTime = GetTime(); 
     5806                         
    58065807                        cout << "compute new statistics ... " << endl; 
    58075808 
     
    58115812                        timeDiff = TimeDiff(startTime, GetTime()); 
    58125813                        cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 
     5814                        cout << "*************************************" << endl; 
     5815 
    58135816                        Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl; 
    58145817 
    58155818                        // only for debugging purpose 
    5816                         if (1) 
     5819                        if (0) 
    58175820                        { 
    58185821                                ViewCellContainer viewCells; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1727 r1732  
    181181mParent(NULL),  
    182182mTreeValid(true),  
    183 mTimeStamp(0),  
    184 mRenderCostDecr(0),  
    185 mMemoryIncr(0), 
    186 mPvsEntriesIncr(0) 
     183mTimeStamp(0) 
     184//,mRenderCostDecr(0) 
     185//,mMemoryIncr(0) 
     186//,mPvsEntriesIncr(0) 
    187187{} 
    188188 
     
    191191mParent(parent),  
    192192mTreeValid(true),  
    193 mMemoryIncr(0), 
    194 mRenderCostDecr(0), 
    195 mPvsEntriesIncr(0), 
     193//,mMemoryIncr(0) 
     194//,mRenderCostDecr(0) 
     195//,mPvsEntriesIncr(0) 
    196196mTimeStamp(0) 
    197197{} 
     
    470470        Environment::GetSingleton()->GetBoolValue("VspTree.simulateOctree", mCirculatingAxis); 
    471471 
     472        //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(VspViewCell)); 
     473        //mMemoryConst = 50;//(float)(sizeof(VspViewCell)); 
     474 
     475        //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(ObjectPvs)); 
     476        mMemoryConst = (float)sizeof(ObjectPvs); 
     477        cout << "vsp memcost: " << mMemoryConst << endl; 
    472478 
    473479        ////////////// 
     
    498504        Debug << "maxband: " << mMaxBand << endl; 
    499505 
     506        Debug << "vsp mem const: " << mMemoryConst << endl; 
     507 
    500508        Debug << endl; 
    501509} 
     
    838846        // otherwise danger of being stuck in a local minimum! 
    839847        const float factor = mRenderCostDecreaseWeight; 
    840         float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
    841  
    842         if (mHierarchyManager->mConsiderMemory2) 
    843         { 
    844                 priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mHierarchyManager->mMemoryConst); 
    845         } 
    846          
     848 
     849        float priority; 
     850 
     851        if (1) 
     852        { 
     853                priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     854                if (mHierarchyManager->mConsiderMemory2) 
     855                { 
     856                        priority /= ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 
     857                } 
     858        } 
     859        else 
     860        { 
     861                if (!mHierarchyManager->mConsiderMemory2) 
     862                { 
     863                        priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 
     864                } 
     865                else 
     866                { 
     867                        const float ratio =  
     868                                renderCostDecr / ((float)splitCandidate.GetPvsEntriesIncr() + mMemoryConst); 
     869 
     870                        priority = factor * ratio + (1.0f - factor) * oldRenderCost; 
     871                } 
     872        } 
     873 
    847874        splitCandidate.SetPriority(priority); 
    848875} 
     
    33233350                //oldNode->mPvsEntriesIncr += sc->GetPvsEntriesIncr(); 
    33243351 
    3325                 oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 
    3326                 oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 
     3352                //oldNode->mRenderCostDecr = sc->GetRenderCostDecrease(); 
     3353                //oldNode->mPvsEntriesIncr = sc->GetPvsEntriesIncr(); 
    33273354 
    33283355                ///////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r1705 r1732  
    192192        float GetMergeCost() {return (float)-mTimeStamp; } 
    193193 
     194        int mTimeStamp; 
     195 
    194196        ///////// 
    195197        //-- mailing options 
     
    203205        int mMailbox; 
    204206 
    205         int mTimeStamp; 
    206  
    207         int mPvsEntriesIncr; 
    208         float mMemoryIncr; 
    209         float mRenderCostDecr; 
     207        //int mPvsEntriesIncr; 
     208        //float mMemoryIncr; 
     209        //float mRenderCostDecr; 
    210210 
    211211protected: 
     
    333333        VssRayContainer mVssRays; 
    334334         
    335         /// leaf pvs 
    336         //ObjectPvs *mPvs; 
    337  
    338335        /// Probability that the view point lies in this leaf 
    339336        float mProbability; 
     
    11201117 
    11211118        int mMaxTests; 
     1119 
     1120        /// constant value for driving the heuristics 
     1121        float mMemoryConst; 
    11221122}; 
    11231123 
Note: See TracChangeset for help on using the changeset viewer.