- Timestamp:
- 11/07/05 08:00:56 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r384 r385 126 126 #splitPlaneStrategy 130 127 127 128 splitPlaneStrategy 10 32128 splitPlaneStrategy 1024 129 129 130 130 maxPolyCandidates 50 131 maxRayCandidates 0131 maxRayCandidates 50 132 132 133 133 Termination { -
trunk/VUT/GtpVisibilityPreprocessor/src/Pvs.h
r369 r385 36 36 37 37 int Compress() {return 0;} 38 int GetSize() {return (int)mEntries.size();}39 bool Empty() {return mEntries.size() == 0;}38 int GetSize() const {return (int)mEntries.size();} 39 bool Empty() const {return mEntries.size() == 0;} 40 40 /** Merges pvs of a and pvs of b into this pvs. 41 41 */ … … 90 90 } 91 91 } 92 93 92 94 93 template <typename T> -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r384 r385 546 546 BspViewCellsStatistics stat; 547 547 548 Debug << "overall scene size: " << objects.size() << endl;548 Debug << "overall scene size: " << (int)objects.size() << endl; 549 549 mBspTree->EvaluateViewCellsStats(stat); 550 550 … … 603 603 bool exportSplits = false; 604 604 environment->GetBoolValue("BspTree.exportSplits", exportSplits); 605 606 605 607 606 cout << "exporting splits ... "; … … 707 706 { 708 707 // construct BSP tree using the samples 709 cout << "building bsp tree from " << mSampleRays.size() << " samples " << endl;708 cout << "building bsp tree from " << (int)mSampleRays.size() << " samples " << endl; 710 709 BuildBspTree(); 711 710 … … 820 819 } 821 820 821 inline bool vc_gt(ViewCell *a, ViewCell *b) 822 { 823 return a->GetPvs().GetSize() > b->GetPvs().GetSize(); 824 } 825 822 826 void SamplingPreprocessor::ExportBspPvs(const ObjectContainer &objects) 823 827 { 824 //-- some random view cells and rays for output825 828 const int leafOut = 10; 826 827 vector<Ray> vcRays[leafOut]; 828 vector<BspLeaf *> bspLeaves; 829 830 ViewCell::NewMail(); 831 832 if (0){ 833 //-- some random view cells and rays for output 834 const int raysOut = min((int)mSampleRays.size(), 20000); 835 vector<Ray> vcRays[leafOut]; 836 vector<BspLeaf *> bspLeaves; 837 for (int i = 0; i < leafOut; ++ i) 838 bspLeaves.push_back(mBspTree->GetRandomLeaf()); 839 840 for (int i = 0; i < bspLeaves.size(); ++ i) 841 { 842 cout << "creating output for view cell " << i << " ... "; 843 // check whether we can add the current ray to the output rays 844 for (int k = 0; k < raysOut; ++ k) 845 { 846 Ray *ray = mSampleRays[k]; 847 848 for (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 849 { 850 BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 851 852 if (bspLeaves[i]->GetViewCell() == leaf->GetViewCell()) 853 { 854 vcRays[i].push_back(*ray); 855 } 856 } 857 } 858 859 Intersectable::NewMail(); 860 861 BspViewCell *vc = dynamic_cast<BspViewCell *>(bspLeaves[i]->GetViewCell()); 862 863 //bspLeaves[j]->Mail(); 864 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 865 866 Exporter *exporter = Exporter::GetExporter(s); 867 exporter->SetFilled(); 868 869 ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 870 871 exporter->SetWireframe(); 872 873 Material m;//= RandomMaterial(); 874 m.mDiffuseColor = RgbColor(0, 1, 0); 875 exporter->SetForcedMaterial(m); 876 877 if (vc->GetMesh()) 878 exporter->ExportViewCell(vc); 879 else 880 { 881 PolygonContainer cell; 882 // export view cell 883 mBspTree->ConstructGeometry(vc, cell); 884 exporter->ExportPolygons(cell); 885 CLEAR_CONTAINER(cell); 886 } 887 888 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() 889 << ", piercing rays=" << (int)vcRays[i].size() << endl; 890 891 // export rays piercing this view cell 892 exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 893 894 m.mDiffuseColor = RgbColor(1, 0, 0); 895 exporter->SetForcedMaterial(m); 896 897 // output PVS of view cell 898 for (; it != vc->GetPvs().mEntries.end(); ++ it) 899 { 900 Intersectable *intersect = (*it).first; 901 if (!intersect->Mailed()) 902 { 903 exporter->ExportIntersectable(intersect); 904 intersect->Mail(); 905 } 906 } 907 908 // output rest of the objects 909 if (0) 910 { 911 Material m;//= RandomMaterial(); 912 m.mDiffuseColor = RgbColor(0, 0, 1); 913 exporter->SetForcedMaterial(m); 914 915 for (int j = 0; j < objects.size(); ++ j) 916 if (!objects[j]->Mailed()) 917 { 918 exporter->SetForcedMaterial(m); 919 exporter->ExportIntersectable(objects[j]); 920 objects[j]->Mail(); 921 } 922 } 923 DEL_PTR(exporter); 924 cout << "finished" << endl; 925 } 926 } 927 else 928 { 929 ViewCellContainer viewCells; 930 931 mBspTree->CollectViewCells(viewCells); 932 stable_sort(viewCells.begin(), viewCells.end(), vc_gt); 933 934 int limit = min(leafOut, (int)viewCells.size()); 935 936 for (int i = 0; i < limit; ++ i) 937 { 938 cout << "creating output for view cell " << i << " ... "; 829 939 830 for (int i = 0; i < leafOut; ++ i) 831 bspLeaves.push_back(mBspTree->GetRandomLeaf()); 832 833 const int raysOut = min((int)mSampleRays.size(), 20000); 834 835 ViewCell::NewMail(); 836 837 for (int i = 0; i < bspLeaves.size(); ++ i) 838 { 839 cout << "creating output for view cell " << i << " ... "; 840 // check whether we can add the current ray to the output rays 841 for (int k = 0; k < raysOut; ++ k) 842 { 843 Ray *ray = mSampleRays[k]; 844 845 for (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 940 Intersectable::NewMail(); 941 942 BspViewCell *vc = dynamic_cast<BspViewCell *>(viewCells[i]); 943 944 //bspLeaves[j]->Mail(); 945 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 946 947 Exporter *exporter = Exporter::GetExporter(s); 948 exporter->SetFilled(); 949 950 ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 951 952 exporter->SetWireframe(); 953 954 Material m;//= RandomMaterial(); 955 m.mDiffuseColor = RgbColor(0, 1, 0); 956 exporter->SetForcedMaterial(m); 957 958 if (vc->GetMesh()) 959 exporter->ExportViewCell(vc); 960 else 846 961 { 847 BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 848 849 if (bspLeaves[i]->GetViewCell() == leaf->GetViewCell()) 962 PolygonContainer cell; 963 // export view cell 964 mBspTree->ConstructGeometry(vc, cell); 965 exporter->ExportPolygons(cell); 966 CLEAR_CONTAINER(cell); 967 } 968 969 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() << endl; 970 971 m.mDiffuseColor = RgbColor(1, 0, 0); 972 exporter->SetForcedMaterial(m); 973 974 // output PVS of view cell 975 for (; it != vc->GetPvs().mEntries.end(); ++ it) 976 { 977 Intersectable *intersect = (*it).first; 978 if (!intersect->Mailed()) 850 979 { 851 vcRays[i].push_back(*ray); 852 } 853 } 854 } 855 856 Intersectable::NewMail(); 857 858 ViewCell *vc = bspLeaves[i]->GetViewCell(); 859 860 //bspLeaves[j]->Mail(); 861 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 862 863 Exporter *exporter = Exporter::GetExporter(s); 864 exporter->SetFilled(); 865 866 ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 867 868 exporter->SetWireframe(); 869 870 Material m;//= RandomMaterial(); 871 m.mDiffuseColor = RgbColor(0, 1, 0); 872 exporter->SetForcedMaterial(m); 873 874 if (vc->GetMesh()) 875 exporter->ExportViewCell(vc); 876 else 877 { 878 PolygonContainer cell; 879 // export view cell 880 mBspTree->ConstructGeometry(bspLeaves[i]->GetViewCell(), cell); 881 exporter->ExportPolygons(cell); 882 CLEAR_CONTAINER(cell); 883 } 884 885 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() 886 << ", piercing rays=" << (int)vcRays[i].size() << endl; 887 888 // export view cells 889 if (0) 890 { 891 m.mDiffuseColor = RgbColor(1, 0, 1); 892 exporter->SetForcedMaterial(m); 893 exporter->ExportViewCells(mViewCells); 894 } 895 896 // export rays piercing this view cell 897 exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 898 899 m.mDiffuseColor = RgbColor(1, 0, 0); 900 exporter->SetForcedMaterial(m); 901 902 // output PVS of view cell 903 for (; it != vc->GetPvs().mEntries.end(); ++ it) 904 { 905 Intersectable *intersect = (*it).first; 906 if (!intersect->Mailed()) 907 { 908 exporter->ExportIntersectable(intersect); 909 intersect->Mail(); 910 } 911 } 912 913 // output rest of the objects 914 if (0) 915 { 916 Material m;//= RandomMaterial(); 917 m.mDiffuseColor = RgbColor(0, 0, 1); 918 exporter->SetForcedMaterial(m); 919 920 for (int j = 0; j < objects.size(); ++ j) 921 if (!objects[j]->Mailed()) 922 { 923 exporter->SetForcedMaterial(m); 924 exporter->ExportIntersectable(objects[j]); 925 objects[j]->Mail(); 926 } 927 } 928 DEL_PTR(exporter); 929 cout << "finished" << endl; 980 exporter->ExportIntersectable(intersect); 981 intersect->Mail(); 982 } 983 } 984 985 DEL_PTR(exporter); 986 cout << "finished" << endl; 987 } 930 988 } 931 989 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r384 r385 1110 1110 vector<Plane3 *> planes; 1111 1111 vector<bool> sides; 1112 float pvsSize = 0;1112 int pvsSize = 0; 1113 1113 1114 1114 if (sSplitPlaneStrategy & PVS) … … 1680 1680 << "Depth: " << data.mDepth << " (max: " << sTermMaxDepth << "), " 1681 1681 << "#polygons: " << (int)data.mPolygons->size() << " (max: " << sTermMaxPolygons << "), " 1682 << "#rays: " << (int)data.mRays->size() << " (max: " << sTermMaxRays << ")" << endl; 1682 << "#rays: " << (int)data.mRays->size() << " (max: " << sTermMaxRays << "), " 1683 << "#pvs: " << leaf->GetViewCell()->GetPvs().GetSize() << endl; 1683 1684 //#endif 1684 1685 }
Note: See TracChangeset
for help on using the changeset viewer.