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

resolved coflicts
improved memory constant

File:
1 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                /////////////////////////// 
Note: See TracChangeset for help on using the changeset viewer.