Changeset 3280 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 01/15/09 18:28:11 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3279 r3280 66 66 camPosition=483.398f 242.364f 186.078f 67 67 # pompeii view point 68 #camPosition=1300.0f -2500.0f 10.0f68 camPosition=1300.0f -2500.0f 10.0f 69 69 # pompeii problematic 70 70 #camPosition=627.003 -1725.33 25.2 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhConstructor.cpp
r3269 r3280 39 39 mMaxTriangles(1), 40 40 mNumNodes(0), 41 mSplitType(SAH) 41 //mSplitType(SAH) 42 mSplitType(SAH_OR_SIZE) 42 43 { 43 44 } … … 282 283 return k; 283 284 } 285 286 287 int 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 284 313 285 314 … … 333 362 } 334 363 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; 335 388 default: 336 389 cerr << "should not come here" << endl; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhConstructor.h
r3269 r3280 23 23 /** Types of split heuristics. 24 24 */ 25 enum {SPATIAL_MEDIAN, OBJECT_MEDIAN, SAH };25 enum {SPATIAL_MEDIAN, OBJECT_MEDIAN, SAH, SAH_OR_SIZE}; 26 26 27 27 protected: -
GTP/trunk/App/Demos/Vis/FriendlyCulling/toto.txt
r3276 r3280 194 194 195 195 fix shadows 196 197 find out ssao artifacts on edges (near edge no ambient occlusion)
Note: See TracChangeset
for help on using the changeset viewer.