- Timestamp:
- 11/29/05 00:01:43 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r438 r439 9 9 #include "VssRay.h" 10 10 #include "VssTree.h" 11 11 #include "ViewCellsManager.h" 12 12 13 13 bool useViewSpaceBox = true;//true; … … 451 451 } 452 452 453 //-- construct BSP view cells 454 if (ViewCell::sHierarchy == ViewCell::BSP) 455 { 456 const int bspSamples = min((int)mVssRays.size(), mBspConstructionSamples); 457 458 Debug << "bpssamples: " << bspSamples << endl; 459 for (int i = 0; i < bspSamples; ++ i) 460 bspRays.push_back(new Ray(*mVssRays[i])); 461 462 //-- construct BSP tree using the samples 463 mBspTree = new BspTree(&mUnbounded); 464 465 ObjectContainer objects; 466 mSceneGraph->CollectObjects(&objects); 467 mBspTree->Construct(objects, bspRays); 468 } 453 ObjectContainer objects; 454 mSceneGraph->CollectObjects(&objects); 455 456 //mViewCellsManager->Construct(mVssRays, objects); 469 457 470 458 vssTree = new VssTree; … … 541 529 542 530 // cast rays into BSP tree 543 if (ViewCell::sHierarchy == ViewCell::BSP)531 /*if (ViewCell::sHierarchy == ViewCell::BSP) 544 532 { 545 533 for (int i = 0; i < (int)vssRays.size(); ++ i) … … 548 536 } 549 537 } 550 538 */ 551 539 samples+=num; 552 540 float pvs = vssTree->GetAvgPvsSize(); … … 562 550 delete vssTree; 563 551 564 if (ViewCell::sHierarchy == ViewCell::BSP)565 {566 Debug << mBspTree->GetStatistics();567 568 ObjectContainer objects;569 ExportSplits(objects, bspRays, 10000);570 ExportBspPvs(objects, bspRays, 10000);571 572 BspViewCellsStatistics stat;573 mBspTree->EvaluateViewCellsStats(stat);574 Debug << "original view cell partition:\n" << stat << endl;575 576 // clear BSP samples577 CLEAR_CONTAINER(bspRays);578 }579 580 552 return true; 581 553 } 582 583 void VssPreprocessor::CastRay(const BspTree &tree, const VssRay & vssRay)584 {585 //-- cast ray to BSP tree to get intersection with view cells586 Ray ray(vssRay);587 mBspTree->CastRay(ray);588 589 //if (0 && ray.sourceObject.mObject)590 //sampleContributions +=591 //AddObjectSamples(ray.sourceObject.mObject, ray);592 593 if (!ray.intersections.empty()) // second intersection found594 {595 //sampleContributions +=596 AddObjectSamples(ray.intersections[0].mObject, ray);597 }598 }599 600 int VssPreprocessor::AddObjectSamples(Intersectable *obj, const Ray &ray)601 {602 int contributingSamples = 0;603 int j;604 605 // object can be seen from the view cell => add to view cell pvs606 for (j=0; j < ray.bspIntersections.size(); ++ j)607 {608 BspLeaf *leaf = ray.bspIntersections[j].mLeaf;609 // if ray not in unbounded space610 if (leaf->GetViewCell() != &mUnbounded)611 contributingSamples +=612 leaf->GetViewCell()->GetPvs().AddSample(obj);613 }614 615 // rays passing through this viewcell616 if (mPass > 1)617 for (j=1; j < ((int)ray.bspIntersections.size() - 1); ++ j)618 {619 BspLeaf *leaf = ray.bspIntersections[j].mLeaf;620 621 if (leaf->GetViewCell() != &mUnbounded)622 leaf->GetViewCell()->623 AddPassingRay(ray, contributingSamples ? 1 : 0);624 }625 626 return contributingSamples;627 }
Note: See TracChangeset
for help on using the changeset viewer.