- Timestamp:
- 12/05/05 13:47:58 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
r450 r451 9 9 #include "VssRay.h" 10 10 #include "RssTree.h" 11 #include "ViewCell Bsp.h"11 #include "ViewCellsManager.h" 12 12 13 13 static bool useViewSpaceBox = true;//true; … … 378 378 int totalSamples = 0; 379 379 380 /// Rays used for post processing and visualizations. 381 RayContainer storedRays; 380 382 381 383 AxisAlignedBox3 *box = new AxisAlignedBox3(mKdTree->GetBox()); … … 407 409 RssTree *rssTree = NULL; 408 410 409 RayContainer bspRays;410 411 411 while (totalSamples < mInitialSamples) { 412 412 int passContributingSamples = 0; … … 423 423 Vector3 direction = GetDirection(viewpoint, mViewSpaceBox); 424 424 425 sampleContributions =CastRay(viewpoint, direction, mVssRays);425 CastRay(viewpoint, direction, mVssRays); 426 426 427 427 … … 473 473 ExportPvs("rss-pvs-initial.x3d", rssTree); 474 474 } 475 475 476 // construct view cells 477 mViewCellsManager->Construct(mObjects, mVssRays, mViewSpaceBox); 478 476 479 rssTree = new RssTree; 477 480 // viewcells = Construct(mVssRays); … … 550 553 } 551 554 555 //-- prepare traversal rays for view cell intersections 556 RayContainer passRays; 557 558 VssRayContainer::const_iterator it, it_end = vssRays.end(); 559 560 for (it = vssRays.begin(); it != it_end; ++ it) 561 passRays.push_back(new Ray(*(*it))); 562 563 int sampleContributions = 0; 564 int contributingSamples = 0; 565 566 /// compute view cell contribution of rays 567 mViewCellsManager->ComputeSampleContributions(passRays, 568 sampleContributions, 569 contributingSamples); 570 571 //-- save rays for post processing 572 if (((int)storedRays.size() < mViewCellsManager->GetPostProcessSamples()) || 573 ((int)storedRays.size() < mViewCellsManager->GetVisualizationSamples())) 574 { 575 RayContainer::const_iterator it, it_end = passRays.end(); 576 577 for (it = passRays.begin(); it != it_end; ++ it) 578 storedRays.push_back(new Ray(*(*it))); 579 } 580 else 581 { 582 CLEAR_CONTAINER(passRays); 583 } 584 552 585 samples+=num; 553 586 float pvs = rssTree->GetAvgPvsSize(); … … 575 608 } 576 609 577 void578 RssPreprocessor::CastRay(const BspTree &tree, const VssRay & vssRay)579 {580 //-- cast ray to BSP tree to get intersection with view cells581 Ray ray(vssRay);582 mBspTree->CastRay(ray);583 584 //if (0 && ray.sourceObject.mObject)585 //sampleContributions +=586 //AddObjectSamples(ray.sourceObject.mObject, ray);587 588 if (!ray.intersections.empty()) // second intersection found589 {590 //sampleContributions +=591 AddObjectSamples(ray.intersections[0].mObject, ray);592 }593 }594 595 int596 RssPreprocessor::AddObjectSamples(Intersectable *obj, const Ray &ray)597 {598 int contributingSamples = 0;599 int j;600 601 // object can be seen from the view cell => add to view cell pvs602 for (j=0; j < ray.bspIntersections.size(); ++ j)603 {604 BspLeaf *leaf = ray.bspIntersections[j].mLeaf;605 // if ray not in unbounded space606 /* if (leaf->GetViewCell() != &mUnbounded)607 contributingSamples +=608 leaf->GetViewCell()->GetPvs().AddSample(obj);*/609 }610 611 // rays passing through this viewcell612 if (mPass > 1)613 for (j=1; j < ((int)ray.bspIntersections.size() - 1); ++ j)614 {615 BspLeaf *leaf = ray.bspIntersections[j].mLeaf;616 617 /* if (leaf->GetViewCell() != &mUnbounded)618 leaf->GetViewCell()->619 AddPassingRay(ray, contributingSamples ? 1 : 0);*/620 }621 622 return contributingSamples;623 }
Note: See TracChangeset
for help on using the changeset viewer.