- Timestamp:
- 11/05/05 13:18:14 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r379 r380 557 557 if (exporter) 558 558 { 559 //exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs);560 exporter->ExportBspViewCellPartition(*mBspTree, 0);559 exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 560 //exporter->ExportBspViewCellPartition(*mBspTree, 0); 561 561 delete exporter; 562 562 } … … 592 592 if (exporter) 593 593 { 594 //exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs);595 exporter->ExportBspViewCellPartition(*mBspTree, 0);594 exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 595 //exporter->ExportBspViewCellPartition(*mBspTree, 0); 596 596 delete exporter; 597 597 } … … 686 686 } 687 687 688 boolSamplingPreprocessor::ProcessBspViewCells(Ray &ray,688 void SamplingPreprocessor::ProcessBspViewCells(Ray &ray, 689 689 Intersectable *object, 690 690 int faceIndex, … … 693 693 { 694 694 // save rays for bsp tree construction 695 if ((BspTree::sConstructionMethod == BspTree::FROM_RAYS) && 696 (mSampleRays.size() < mBspConstructionSamples)) 695 if (!mBspTree) 697 696 { 698 // also add origin to sample in order to extract it as input polygons 699 MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 700 ray.sourceObject = Ray::Intersection(0.0, mi, faceIndex); 697 if ((BspTree::sConstructionMethod == BspTree::FROM_RAYS) && 698 ((int)mSampleRays.size() < mBspConstructionSamples)) 699 { 700 // also add origin to sample in order to extract it as input polygons 701 MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 702 ray.sourceObject = Ray::Intersection(0.0, mi, faceIndex); 701 703 702 mSampleRays.push_back(new Ray(ray)); 703 704 return false; 705 } 706 707 if (!mBspTree) // construct BSP tree using the samples 704 mSampleRays.push_back(new Ray(ray)); 705 Debug << "abba " << mSampleRays.size() << endl; 706 } 707 else 708 { 709 // construct BSP tree using the samples 710 cout << "building bsp tree from " << mSampleRays.size() << " samples " << endl; 711 BuildBspTree(); 712 713 // add contributions of saved samples to PVS 714 contributingSamples += mBspTree->GetStat().contributingSamples; 715 sampleContributions += mBspTree->GetStat().sampleContributions; 716 717 BspTreeStatistics(Debug); 718 719 if (0) Export("vc_bsptree.x3d", false, false, true); 720 721 // throw away samples because BSP leaves not stored in order 722 // Need ordered rays for post processing => collect new rays 723 CLEAR_CONTAINER(mSampleRays); 724 } 725 } 726 // save rays for post processing 727 else if ((int)mSampleRays.size() < mPostProcessSamples) 708 728 { 709 cout << "building bsp tree from " << mSampleRays.size() << " samples " << endl; 710 BuildBspTree(); 711 712 // add contributions of saved samples to PVS 713 contributingSamples += mBspTree->GetStat().contributingSamples; 714 sampleContributions += mBspTree->GetStat().sampleContributions; 715 716 BspTreeStatistics(Debug); 717 718 if (0) Export("vc_bsptree.x3d", false, false, true); 719 720 // throw away samples because BSP leaves not stored in order 721 // Need ordered rays for post processing => collect new rays 722 CLEAR_CONTAINER(mSampleRays); 723 } 724 725 if ((int)mSampleRays.size() < mPostProcessSamples) 726 { 729 Debug << "police " << mSampleRays.size() << endl; 727 730 mSampleRays.push_back(new Ray(ray)); 728 731 } 729 730 return true;731 732 } 732 733 -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h
r373 r380 74 74 @param contributingSamples samples contributing to pvs 75 75 @param sampleContributions contribution of the samples 76 77 @returns true if BSP tree has been constructed, false if not yet78 79 76 */ 80 boolProcessBspViewCells(Ray &ray,77 void ProcessBspViewCells(Ray &ray, 81 78 Intersectable *object, 82 79 int faceIndex, -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r379 r380 692 692 693 693 Debug << "**** Finished polygon extraction ****" << endl; 694 Debug << (int)polys->size() << " polys extracted from " << (int) rays->size() << " rays" << endl;694 Debug << (int)polys->size() << " polys extracted from " << (int)sampleRays.size() << " rays" << endl; 695 695 Debug << "extraction time: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 696 696 … … 786 786 ViewCell *backViewCell = mRootCell; 787 787 788 788 789 #ifdef _DEBUG 789 790 if (frontPolys->empty() && backPolys->empty() && (coincident.size() > 2)) … … 1650 1651 mStat.accumDepth += data.mDepth; 1651 1652 1652 #ifdef _DEBUG1653 //#ifdef _DEBUG 1653 1654 Debug << "BSP stats: " 1654 1655 << "Depth: " << data.mDepth << " (max: " << sTermMaxDepth << "), " 1655 1656 << "#polygons: " << (int)data.mPolygons->size() << " (max: " << sTermMaxPolygons << "), " 1656 1657 << "#rays: " << (int)data.mRays->size() << " (max: " << sTermMaxRays << ")" << endl; 1657 #endif1658 //#endif 1658 1659 } 1659 1660 -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
r379 r380 187 187 188 188 189 if (maxPvs ==0)189 if (maxPvs > 0) 190 190 mUseForcedMaterial = true; 191 191 192 192 for (it = viewCells.begin(); it != it_end; ++ it) 193 193 { 194 mForcedMaterial.mDiffuseColor.b = 1.0f;195 196 float importance = 0;197 198 194 if (maxPvs > 0) 199 importance = (float)(*it)->GetPvs().GetSize() / (float)maxPvs; 200 201 mForcedMaterial.mDiffuseColor.r = importance; 202 mForcedMaterial.mDiffuseColor.g = 1.0f - mForcedMaterial.mDiffuseColor.r; 203 195 { 196 mForcedMaterial.mDiffuseColor.b = 1.0f; 197 float importance = (float)(*it)->GetPvs().GetSize() / (float)maxPvs; 198 199 mForcedMaterial.mDiffuseColor.r = importance; 200 mForcedMaterial.mDiffuseColor.g = 1.0f - mForcedMaterial.mDiffuseColor.r; 201 } 202 204 203 if ((*it)->GetMesh()) 205 204 ExportViewCell(*it);
Note: See TracChangeset
for help on using the changeset viewer.