Changeset 1844 for GTP/trunk/Lib/Vis
- Timestamp:
- 12/04/06 22:38:56 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1843 r1844 2692 2692 2693 2693 2694 } 2694 void BvHierarchy::Compress() 2695 { 2696 } 2697 2698 2699 } -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1843 r1844 627 627 float GetRenderCostIncrementially(BvhNode *node) const; 628 628 629 void Compress(); 629 630 void CreateUniqueObjectIds(); 630 631 -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1843 r1844 657 657 } 658 658 659 659 660 void HierarchyManager::InitialiseObjectSpaceSubdivision(const ObjectContainer &objects) 660 661 { … … 2353 2354 2354 2355 2356 void HierarchyManager::CompressObjectSpace() 2357 { 2358 //mBvHierarchy->Compress(); 2359 mVspTree->CompressObjects(); 2360 2355 2361 void HierarchyManager::CreateUniqueObjectIds() 2356 2362 { … … 2359 2365 2360 2366 2361 2362 } 2367 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1843 r1844 292 292 void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 293 293 294 void CompressObjectSpace(); 294 295 void CreateUniqueObjectIds(); 295 296 -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r1842 r1844 212 212 bool GetSampleContribution(T sample, const float pdf, float &contribution); 213 213 214 /** Adds sample to PVS.215 @contribution contribution of sample (0 or 1)216 @returns true if sample was not already in PVS.217 */218 //bool AddSample(T sample, const float pdf, float &contribution);219 220 214 /** Adds sample to PVS. 221 215 @returns contribution of sample (0 or 1) … … 241 235 @returns contribution of sample (0 or 1) 242 236 */ 243 float AddSamples(const vector<PvsEntry<T, S> > &samples);237 //float AddSamples(const vector<PvsEntry<T, S> > &samples); 244 238 245 239 /** Adds sample to PVS. -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1779 r1844 3388 3388 } 3389 3389 3390 } 3390 3391 void VspTree::CompressObjects(VspLeaf *leaf) 3392 { 3393 bool compressed = true; 3394 3395 Intersectable::NewMail(2); 3396 3397 while (compressed) 3398 { 3399 ObjectPvsIterator oit = leaf->GetViewCell()->GetPvs().GetIterator(); 3400 vector<BvhNode *> parents; 3401 ObjectPvs newPvs; 3402 3403 compressed = false; 3404 3405 while (oit.HasMoreEntries()) 3406 { 3407 const ObjectPvsEntry &entry = oit.Next(); 3408 BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject); 3409 3410 if (!obj->IsRoot()) 3411 { 3412 BvhNode *parent = obj->GetParent(); 3413 3414 if (!parent->Mailed()) 3415 { 3416 parent->Mail(); 3417 } 3418 else 3419 { 3420 // sibling was already found => 3421 // this entry can be exchanged by the parent 3422 parents.push_back(parent); 3423 parent->Mail(1); 3424 compressed = true; 3425 } 3426 } 3427 } 3428 3429 oit = leaf->GetViewCell()->GetPvs().GetIterator(); 3430 3431 while (oit.HasMoreEntries()) 3432 { 3433 const ObjectPvsEntry &entry = oit.Next(); 3434 BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject); 3435 3436 if (!obj->IsRoot()) 3437 { 3438 BvhNode *parent = obj->GetParent(); 3439 3440 // add only entries that cannot be exchaned with the parent 3441 if (parent->Mailed(1)) 3442 { 3443 newPvs.AddSampleDirty(obj, entry.mData.mSumPdf); 3444 } 3445 } 3446 } 3447 3448 // add parents 3449 vector<BvhNode *>::const_iterator bit, bit_end = parents.end(); 3450 for (bit = parents.begin(); bit != bit_end; ++ bit) 3451 { 3452 newPvs.AddSampleDirty(*bit, 1); 3453 } 3454 3455 leaf->GetViewCell()->SetPvs(newPvs); 3456 } 3457 } 3458 3459 3460 void VspTree::CompressObjects() 3461 { 3462 vector<VspLeaf *> leaves; 3463 CollectLeaves(leaves); 3464 3465 vector<VspLeaf *>::const_iterator lit, lit_end = leaves.end(); 3466 3467 for (lit = leaves.begin(); lit != lit_end; ++ lit) 3468 { 3469 CompressObjects(*lit); 3470 } 3471 } 3472 3473 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r1779 r1844 1028 1028 AxisAlignedBox3 *forcedBoundingBox); 1029 1029 1030 void CompressObjects(); 1031 1032 void CompressObjects(VspLeaf *leaf); 1033 1030 1034 protected: 1031 1035
Note: See TracChangeset
for help on using the changeset viewer.