Changeset 3280 for GTP


Ignore:
Timestamp:
01/15/09 18:28:11 (15 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3279 r3280  
    6666camPosition=483.398f 242.364f 186.078f 
    6767# pompeii view point 
    68 #camPosition=1300.0f -2500.0f 10.0f 
     68camPosition=1300.0f -2500.0f 10.0f 
    6969# pompeii problematic 
    7070#camPosition=627.003 -1725.33 25.2 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhConstructor.cpp

    r3269 r3280  
    3939mMaxTriangles(1), 
    4040mNumNodes(0), 
    41 mSplitType(SAH) 
     41//mSplitType(SAH) 
     42mSplitType(SAH_OR_SIZE) 
    4243{ 
    4344} 
     
    282283        return k; 
    283284} 
     285 
     286 
     287int BvhConstructor::SortTrianglesSurfaceArea(BvhLeaf *leaf, float sa) 
     288{ 
     289        int i = leaf->mFirst; 
     290        int j = leaf->mLast; 
     291 
     292        while(1)  
     293        { 
     294                while ((i <= j) && (mEntities[i]->GetWorldBoundingBox().SurfaceArea() < sa))  
     295                        ++ i; 
     296 
     297                while ((i <= j) && (sa < mEntities[j]->GetWorldBoundingBox().SurfaceArea())) 
     298                        -- j; 
     299 
     300                if (i < j)  
     301                { 
     302                        swap(mEntities[i], mEntities[j]); 
     303                        ++ i; 
     304                        -- j; 
     305                } 
     306                else 
     307                        break; 
     308        } 
     309 
     310        return j; 
     311} 
     312 
    284313 
    285314 
     
    333362                } 
    334363                break; 
     364        case SAH_OR_SIZE:  
     365                { 
     366                        // split by size instead 
     367                        const float saThreshold = 0.2f * leaf->GetBox().SurfaceArea(); 
     368                        split = SortTrianglesSurfaceArea(leaf, saThreshold); 
     369 
     370                        if ((split == leaf->mLast) || (split == leaf->mFirst - 1))  
     371                        { 
     372                                // use SAH 
     373                                float cost; 
     374                                pos = SelectPlaneSah(leaf, axis, cost); 
     375 
     376                                if (pos != MAX_FLOAT) 
     377                                        split = SortTriangles(leaf, axis, pos); 
     378                                else 
     379                                        split = SortTrianglesObjectMedian(leaf, axis, pos); 
     380                        } 
     381                        else 
     382                        { 
     383                                // note: no position is computed!! 
     384                                //OUT1("sorted by size"); 
     385                        } 
     386                } 
     387                break; 
    335388        default: 
    336389                cerr << "should not come here" << endl; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhConstructor.h

    r3269 r3280  
    2323        /** Types of split heuristics. 
    2424        */       
    25         enum {SPATIAL_MEDIAN, OBJECT_MEDIAN, SAH};       
     25        enum {SPATIAL_MEDIAN, OBJECT_MEDIAN, SAH, SAH_OR_SIZE};  
    2626 
    2727protected: 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/toto.txt

    r3276 r3280  
    194194 
    195195fix shadows 
     196 
     197find out ssao artifacts on edges (near edge no ambient occlusion) 
Note: See TracChangeset for help on using the changeset viewer.