- Timestamp:
- 02/16/06 16:21:26 (19 years ago)
- Location:
- GTP/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp
r639 r648 282 282 283 283 // Use 512x512 texture in GL since we can't go higher than the window res 284 mSceneMgr->setShadowTextureSettings( 512, 2);284 mSceneMgr->setShadowTextureSettings(1024, 2); 285 285 286 286 mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); -
GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env
r646 r648 25 25 type vss 26 26 # type rss 27 detectEmptyViewSpace false27 detectEmptyViewSpace true 28 28 } 29 29 … … 331 331 missTolerance 6 332 332 333 maxViewCells 50000333 maxViewCells 10000 334 334 335 335 # used for pvs criterium … … 354 354 BspTree { 355 355 Construction { 356 samples 50000 356 samples 500000 357 357 epsilon 0.005 358 358 } … … 420 420 minProbability 0.00001 421 421 maxRayContribution 9999 422 maxViewCells 5000422 maxViewCells 10000 423 423 424 424 # used for pvs criterium -
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp
r645 r648 224 224 225 225 //TODO: remove for performance 226 #if 1226 #if 0 227 227 if (1) 228 228 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r644 r648 512 512 513 513 //-- use priority queue to merge leaf pairs 514 // HACK515 514 516 515 //const float maxAvgCost = 350; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r647 r648 318 318 Debug << "splitting polygons of node " << this << " with plane " << mPlane << endl; 319 319 #endif 320 320 321 PolygonContainer::const_iterator it, it_end = polys.end(); 321 322 … … 331 332 case Polygon3::COINCIDENT: 332 333 coincident.push_back(poly); 333 Debug << "!!!Coincident: " << poly->GetSupportingPlane() << endl;334 334 break; 335 335 case Polygon3::FRONT_SIDE: 336 336 frontPolys.push_back(poly); 337 Debug << "!!!front: " << poly->GetSupportingPlane() << endl;338 337 break; 339 338 case Polygon3::BACK_SIDE: 340 Debug << "!!!back: " << poly->GetSupportingPlane() << endl;341 339 backPolys.push_back(poly); 342 340 break; … … 710 708 // preprocess: throw out polygons coincident to the view space box (not needed) 711 709 PolygonContainer boxPolys; 712 mBox.ExtractPoly gons(boxPolys);710 mBox.ExtractPolys(boxPolys); 713 711 vector<Plane3> boxPlanes; 714 PolygonContainer::const_iterator pit, pit_end = polys->end(); 715 716 for (pit = polys->begin(); pit != pit_end; ++ pit) 717 { 718 719 } 720 } 712 713 PolygonContainer::iterator pit, pit_end = boxPolys.end(); 714 715 // extract planes of box 716 // TODO: can be done more elegantly than first extracting polygons 717 // and take their planes 718 for (pit = boxPolys.begin(); pit != pit_end; ++ pit) 719 { 720 boxPlanes.push_back((*pit)->GetSupportingPlane()); 721 } 722 723 pit_end = polys.end(); 724 725 for (pit = polys.begin(); pit != pit_end; ++ pit) 726 { 727 vector<Plane3>::const_iterator bit, bit_end = boxPlanes.end(); 728 729 for (bit = boxPlanes.begin(); (bit != bit_end) && (*pit); ++ bit) 730 { 731 const int cf = (*pit)->ClassifyPlane(*bit, mEpsilon); 732 733 if (cf == Polygon3::COINCIDENT) 734 { 735 DEL_PTR(*pit); 736 //Debug << "coincident!!" << endl; 737 } 738 } 739 } 740 741 // remove deleted entries 742 for (int i = 0; i < (int)polys.size(); ++ i) 743 { 744 while (!polys[i] && (i < (int)polys.size())) 745 { 746 swap(polys[i], polys.back()); 747 polys.pop_back(); 748 } 749 } 750 } 751 752 721 753 722 754 void BspTree::Construct(const RayContainer &sampleRays, … … 794 826 } 795 827 796 PreprocessPolygons(); 828 // throw out bad polygons 829 PreprocessPolygons(*polys); 797 830 798 831 mStat.polys = (int)polys->size(); … … 838 871 } 839 872 873 PreprocessPolygons(*polys); 840 874 Debug << "tree has " << (int)polys->size() << " polys, " << (int)sampleRays.size() << " rays" << endl; 841 875 Construct(polys, rays); … … 991 1025 { 992 1026 int pvsData = tData.mPvs; 1027 993 1028 float cData = (float)pvsData * tData.mProbability; 994 995 1029 float cFront = (float)tFrontData.mPvs * tFrontData.mProbability; 996 1030 float cBack = (float)tBackData.mPvs * tBackData.mProbability; 997 998 Debug << "front pvs: " << tFrontData.mPvs << " p: " << tFrontData.mProbability << endl;999 Debug << "back pvs: " << tBackData.mPvs << " p: " << tBackData.mProbability << endl;1000 Debug << "pvs: " << pvsData << " p: " << tData.mProbability << endl;1001 1002 Debug << "data: " << cData << " front: " << cFront << " back: " << cBack << endl;1003 Debug << "cost ratio: " << (cFront + cBack) / cData << endl;1004 1005 if (((cFront + cBack) / cData > 1) || (tFrontData.mProbability == 0) || (tBackData.mProbability == 0))1006 {1007 Debug << "ERROR!!" << endl;1008 1009 vector<Plane3> halfSpaces;1010 ExtractHalfSpaces(interior, halfSpaces);1011 1012 for (int i = 0; i < (int)halfSpaces.size(); ++ i)1013 Debug << halfSpaces[i] << endl;1014 1015 Debug << "geom:\n" << *tData.mGeometry << endl;1016 Debug << "fgeom:\n" << *tFrontData.mGeometry << endl;1017 Debug << "bgeom:\n" << *tBackData.mGeometry << endl;1018 }1019 1031 1020 1032 float costDecr = (cFront + cBack - cData) / mBox.GetVolume(); 1021 1022 1033 1023 1034 mTotalCost += costDecr; … … 1104 1115 1105 1116 1106 //#ifdef _DEBUG1117 #ifdef _DEBUG 1107 1118 Debug << interior << endl; 1108 Debug << interior->GetPlane() << endl; 1109 //#endif 1119 #endif 1110 1120 1111 1121 … … 1148 1158 frontData.mProbability = frontData.mGeometry->GetVolume(); 1149 1159 backData.mProbability = tData.mProbability - frontData.mProbability; 1150 1151 Debug << "************" << endl;1152 Debug << "plane: " << interior->mPlane << endl;1153 Debug << "box: " << mBox << endl;1154 Debug << "all: " << tData.mProbability << " f: " << frontData.mProbability << " b: " << backData.mProbability << endl;1155 Debug << "real back: " << backData.mGeometry->GetVolume() << endl;1156 Debug << "data geom: " << tData.mGeometry->mPolys.size() << " f: " << frontData.mGeometry->mPolys.size() << " b: " << backData.mGeometry->mPolys.size() << endl;1157 1160 } 1158 1161 } … … 1497 1500 SplitPlaneCost(poly->GetSupportingPlane(), data); 1498 1501 1499 Debug << "supporting plane: " << poly->GetSupportingPlane() << endl;1500 1501 1502 if (candidateCost < lowestCost) 1502 1503 { … … 1522 1523 Debug << "plane lowest cost: " << lowestCost << endl; 1523 1524 #endif 1524 Debug << "choosen plane: " << bestPlane << endl; 1525 1525 1526 1526 return bestPlane; 1527 1527 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h
r647 r648 876 876 int &contributingSamples); 877 877 878 878 /** Preprocesses polygons and throws out all polygons which are coincident to 879 the view space box faces (they can be problematic). 880 */ 879 881 void PreprocessPolygons(PolygonContainer &polys); 880 882 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r643 r648 332 332 AddMeshToPolygons(obj->GetMesh(), polys, obj); 333 333 ++ numObj; 334 334 335 //-- compute bounding box 335 336 if (!forcedBoundingBox) … … 381 382 else 382 383 mTermMinProbability *= mBox.GetVolume(); 384 385 // throw out unnecessary polygons 386 PreprocessPolygons(polys); 383 387 384 388 mBspStats.polys = (int)polys.size(); … … 1994 1998 1995 1999 2000 void VspBspTree::PreprocessPolygons(PolygonContainer &polys) 2001 { 2002 // preprocess: throw out polygons coincident to the view space box (not needed) 2003 PolygonContainer boxPolys; 2004 mBox.ExtractPolys(boxPolys); 2005 vector<Plane3> boxPlanes; 2006 2007 PolygonContainer::iterator pit, pit_end = boxPolys.end(); 2008 2009 // extract planes of box 2010 // TODO: can be done more elegantly than first extracting polygons 2011 // and take their planes 2012 for (pit = boxPolys.begin(); pit != pit_end; ++ pit) 2013 { 2014 boxPlanes.push_back((*pit)->GetSupportingPlane()); 2015 } 2016 2017 pit_end = polys.end(); 2018 2019 for (pit = polys.begin(); pit != pit_end; ++ pit) 2020 { 2021 vector<Plane3>::const_iterator bit, bit_end = boxPlanes.end(); 2022 2023 for (bit = boxPlanes.begin(); (bit != bit_end) && (*pit); ++ bit) 2024 { 2025 const int cf = (*pit)->ClassifyPlane(*bit, mEpsilon); 2026 2027 if (cf == Polygon3::COINCIDENT) 2028 { 2029 DEL_PTR(*pit); 2030 //Debug << "coincident!!" << endl; 2031 } 2032 } 2033 } 2034 2035 // remove deleted entries 2036 for (int i = 0; i < (int)polys.size(); ++ i) 2037 { 2038 while (!polys[i] && (i < (int)polys.size())) 2039 { 2040 swap(polys[i], polys.back()); 2041 polys.pop_back(); 2042 } 2043 } 2044 } 2045 2046 1996 2047 float VspBspTree::AccumulatedRayLength(const RayInfoContainer &rays) const 1997 2048 { -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r639 r648 601 601 int CollectMergeCandidates(const VssRayContainer &rays, vector<MergeCandidate> &candidates); 602 602 603 603 /** Preprocesses polygons and throws out all polygons which are coincident to 604 the view space box faces (they can be problematic). 605 */ 606 void PreprocessPolygons(PolygonContainer &polys); 604 607 605 608 /** Propagates valid flag up the tree.
Note: See TracChangeset
for help on using the changeset viewer.