- Timestamp:
- 12/14/05 19:38:39 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
r464 r466 525 525 526 526 // viewcells->UpdatePVS(newVssRays); 527 // get viewcells as kd tree boxes 528 vector<AxisAlignedBox3> kdViewcells; 529 530 if (0) { 531 vector<KdLeaf *> leaves; 532 mKdTree->CollectLeaves(leaves); 533 vector<KdLeaf *>::const_iterator it; 534 int targetLeaves = 50; 535 float prob = targetLeaves/(float)leaves.size(); 536 for (it = leaves.begin(); it != leaves.end(); ++it) 537 if (RandomValue(0.0f,1.0f) < prob) 538 kdViewcells.push_back(mKdTree->GetBox(*it)); 539 540 float avgPvs = GetAvgPvsSize(rssTree, kdViewcells); 541 cout<<"Initial average PVS size = "<<avgPvs<<endl; 542 } 543 544 527 545 528 int samples = 0; 546 529 int pass = 0; … … 563 546 for (int i=0; i < rays.size(); i++) 564 547 CastRay(rays[i].mOrigin, rays[i].mDirection, vssRays); 565 548 549 if (mUseViewcells) { 550 551 552 /// compute view cell contribution of rays 553 mViewCellsManager->ComputeSampleContributions(vssRays 554 ); 555 556 557 float pvs = rssTree->GetAvgPvsSize(); 558 cout<<"*****************************\n"; 559 cout<<samples<<" avgPVS ="<<pvs<<endl; 560 cout<<"RssTree root PVS size = "<<rssTree->GetRootPvsSize()<<endl; 561 cout<<"*****************************\n"; 562 } 563 564 565 566 566 rssTree->AddRays(vssRays); 567 567 568 568 if (mUpdateSubdivision) { 569 569 int subdivided = rssTree->UpdateSubdivision(); 570 570 cout<<"subdivided leafs = "<<subdivided<<endl; 571 571 cout<<"#total leaves = "<<rssTree->stat.Leaves()<<endl; 572 573 572 } 574 573 575 574 if (mUseViewcells) { 576 float avgPvs = GetAvgPvsSize(rssTree, kdViewcells);577 cout<<"Average PVS size = "<<avgPvs<<endl;575 // float avgPvs = GetAvgPvsSize(rssTree, kdViewcells); 576 // cout<<"Average PVS size = "<<avgPvs<<endl; 578 577 } 579 578 … … 590 589 samples+=num; 591 590 592 if (mUseViewcells) {593 594 //-- prepare traversal rays for view cell intersections595 RayContainer passRays;596 597 VssRayContainer::const_iterator it, it_end = vssRays.end();598 599 for (it = vssRays.begin(); it != it_end; ++ it)600 passRays.push_back(new Ray(*(*it)));601 602 int sampleContributions = 0;603 int contributingSamples = 0;604 605 /// compute view cell contribution of rays606 mViewCellsManager->ComputeSampleContributions(passRays,607 sampleContributions,608 contributingSamples);609 610 //-- save rays for post processing611 if (((int)storedRays.size() < mViewCellsManager->GetPostProcessSamples()) ||612 ((int)storedRays.size() < mViewCellsManager->GetVisualizationSamples()))613 {614 RayContainer::const_iterator it, it_end = passRays.end();615 616 for (it = passRays.begin(); it != it_end; ++ it)617 storedRays.push_back(new Ray(*(*it)));618 }619 else620 {621 CLEAR_CONTAINER(passRays);622 }623 624 float pvs = rssTree->GetAvgPvsSize();625 cout<<"*****************************\n";626 cout<<samples<<" avgPVS ="<<pvs<<endl;627 cout<<"sample contributions ="<<sampleContributions<<endl;628 cout<<"contributing sample ="<<contributingSamples<<endl;629 cout<<"RssTree root PVS size = "<<rssTree->GetRootPvsSize()<<endl;630 cout<<"*****************************\n";631 }632 591 633 592 if (mExportPvs) { … … 645 604 646 605 if (mUseViewcells) { 606 607 VssRayContainer storedRays; 608 rssTree->CollectRays(storedRays, Max( 609 mViewCellsManager->GetPostProcessSamples(), 610 mViewCellsManager->GetVisualizationSamples())); 647 611 648 612 //-- post process view cells … … 651 615 //-- several visualizations and statistics 652 616 mViewCellsManager->PrintStatistics(Debug); 653 654 //-- render simulation after merge 655 cout << "\nevaluating render time of final view cells ... "; 656 657 const SimulationStatistics ss = mViewCellsManager->SimulateRendering(); 658 659 cout << " finished" << endl; 660 661 cout << ss << endl; 662 Debug << ss << endl; 663 617 664 618 mViewCellsManager->Visualize(mObjects, storedRays); 665 } 666 619 620 CLEAR_CONTAINER(storedRays); 621 622 //-- render simulation after merge 623 cout << "\nevaluating bsp view cells render time after merge ... "; 624 625 const SimulationStatistics ss = mViewCellsManager->SimulateRendering(); 626 627 cout << " finished" << endl; 628 cout << ss << endl; 629 Debug << ss << endl; 630 631 } 632 667 633 delete rssTree; 668 634
Note: See TracChangeset
for help on using the changeset viewer.