Changeset 491 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 01/03/06 18:37:32 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r490 r491 13 13 #;../data/vienna/vienna-plane.x3d 14 14 # filename ../data/vienna/viewcells-25-sel.x3d 15 #filename ../data/atlanta/atlanta2.x3d15 filename ../data/atlanta/atlanta2.x3d 16 16 # filename ../data/soda/soda.dat 17 filename ../data/soda/soda5.dat17 # filename ../data/soda/soda5.dat 18 18 } 19 19 … … 28 28 VssPreprocessor { 29 29 samplesPerPass 100000 30 initialSamples 500000030 initialSamples 1000000 31 31 vssSamples 200000 32 32 vssSamplesPerPass 100000 33 33 useImportanceSampling true 34 loadInitialSamples false35 storeInitialSamples true34 loadInitialSamples true 35 storeInitialSamples false 36 36 } 37 37 … … 152 152 loadFromFile false 153 153 #type kdTree 154 #type vspKdTree154 type vspKdTree 155 155 #type bspTree 156 156 type vspBspTree … … 159 159 160 160 height 5.0 161 maxViewCells 100162 maxPvs 90161 maxViewCells 500 162 maxPvs 200 163 163 164 164 … … 178 178 #colorCode MergedTreeDiff 179 179 colorCode Random 180 exportRays true180 exportRays false 181 181 exportGeometry true 182 182 } … … 208 208 minPvs 50 209 209 minRays 300 210 minSize 0. 1210 minSize 0.001 211 211 maxCostRatio 0.9 212 212 missTolerance 4 … … 266 266 Termination { 267 267 # parameters used for autopartition 268 minRays 1268 minRays 20 269 269 minPolygons -1 270 270 maxDepth 30 271 271 minPvs 20 272 minArea 0.0001 272 #minArea 0.0001 273 #minArea 0.000 273 274 maxRayContribution 0.005 274 275 maxCostRatio 0.9 275 missTolerance 2276 missTolerance 4 276 277 #maxAccRayLength 100 277 278 278 maxViewCells 1000279 maxViewCells 5000 279 280 280 281 # used for pvs criterium … … 291 292 PostProcess { 292 293 maxCostRatio 0.1 293 minViewCells 200294 maxPvsSize 500295 useRaysForMerge false294 minViewCells 500 295 maxPvsSize 1000 296 useRaysForMerge true 296 297 } 297 298 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r490 r491 255 255 256 256 257 // use ascii format to store rays 258 #define USE_ASCII 0 259 260 257 261 inline bool ilt(Intersectable *obj1, Intersectable *obj2) 258 262 { … … 268 272 environment->GetStringValue("Preprocessor.samplesFilename", fileName); 269 273 270 Vector3 origin, termination; 271 // HACK: needed only for lower_bound algorithm 272 MeshInstance object(NULL); 273 ifstream samplesIn(fileName); 274 274 Vector3 origin, termination; 275 // HACK: needed only for lower_bound algorithm to find the 276 // intersected objects 277 MeshInstance sObj(NULL); 278 MeshInstance tObj(NULL); 279 280 #if USE_ASCII 281 ifstream samplesIn(fileName, ios::binary); 275 282 if (!samplesIn.is_open()) 276 283 return false; 277 284 278 285 string buf; 279 280 286 while (!(getline(samplesIn, buf)).eof()) 281 287 { 282 sscanf(buf.c_str(), "%f %f %f %f %f %f %d ",288 sscanf(buf.c_str(), "%f %f %f %f %f %f %d %d", 283 289 &origin.x, &origin.y, &origin.z, 284 &termination.x, &termination.y, &termination.z, &(object.mId)); 285 286 if (1) 290 &termination.x, &termination.y, &termination.z, 291 &(sObj.mId), &(tObj.mId)); 292 293 Intersectable *sourceObj = NULL; 294 Intersectable *termObj = NULL; 295 296 if (sObj.mId >= 0) 287 297 { 288 298 ObjectContainer::iterator oit = 289 lower_bound(objects.begin(), objects.end(), & object, ilt);290 291 samples.push_back(new VssRay(origin, termination, NULL, *oit));292 }293 else299 lower_bound(objects.begin(), objects.end(), &sObj, ilt); 300 sourceObj = *oit; 301 } 302 303 if (tObj.mId >= 0) 294 304 { 295 samples.push_back(new VssRay(origin, termination, NULL, objects[object.mId])); 296 } 297 } 298 305 ObjectContainer::iterator oit = 306 lower_bound(objects.begin(), objects.end(), &tObj, ilt); 307 termObj = *oit; 308 } 309 310 samples.push_back(new VssRay(origin, termination, sourceObj, termObj)); 311 } 312 #else 313 ifstream samplesIn(fileName, ios::binary); 314 if (!samplesIn.is_open()) 315 return false; 316 317 while (1) 318 { 319 samplesIn.read(reinterpret_cast<char *>(&origin), sizeof(Vector3)); 320 samplesIn.read(reinterpret_cast<char *>(&termination), sizeof(Vector3)); 321 samplesIn.read(reinterpret_cast<char *>(&(sObj.mId)), sizeof(int)); 322 samplesIn.read(reinterpret_cast<char *>(&(tObj.mId)), sizeof(int)); 323 324 if (samplesIn.eof()) 325 break; 326 327 Intersectable *sourceObj = NULL; 328 Intersectable *termObj = NULL; 329 330 if (sObj.mId >= 0) 331 { 332 ObjectContainer::iterator oit = 333 lower_bound(objects.begin(), objects.end(), &sObj, ilt); 334 sourceObj = *oit; 335 } 336 337 if (tObj.mId >= 0) 338 { 339 ObjectContainer::iterator oit = 340 lower_bound(objects.begin(), objects.end(), &tObj, ilt); 341 termObj = *oit; 342 } 343 344 samples.push_back(new VssRay(origin, termination, sourceObj, termObj)); 345 } 346 347 #endif 299 348 samplesIn.close(); 300 349 … … 304 353 bool Preprocessor::WriteSamples(const VssRayContainer &samples) const 305 354 { 306 char buf[100];307 environment->GetStringValue("Preprocessor.samplesFilename", buf);308 ofstream samplesOut(buf);355 char fileName[100]; 356 environment->GetStringValue("Preprocessor.samplesFilename", fileName); 357 309 358 310 359 VssRayContainer::const_iterator it, it_end = samples.end(); 311 360 361 #if USE_ASCII 362 ofstream samplesOut(fileName); 312 363 if (!samplesOut.is_open()) 313 364 return false; … … 316 367 { 317 368 VssRay *ray = *it; 318 369 int sourceid = ray->mOriginObject ? ray->mOriginObject->mId : -1; 370 int termid = ray->mTerminationObject ? ray->mTerminationObject->mId : -1; 371 319 372 samplesOut << ray->GetOrigin().x << " " << ray->GetOrigin().y << " " << ray->GetOrigin().z << " " 320 373 << ray->GetTermination().x << " " << ray->GetTermination().y << " " << ray->GetTermination().z << " " 321 << ray->mTerminationObject->mId << "\n"; 322 } 374 << sourceid << " " << termid << "\n"; 375 } 376 #else 377 ofstream samplesOut(fileName, ios::binary); 378 if (!samplesOut.is_open()) 379 return false; 380 381 for (it = samples.begin(); it != it_end; ++ it) 382 { 383 VssRay *ray = *it; 384 Vector3 origin(ray->GetOrigin()); 385 Vector3 termination(ray->GetTermination()); 386 387 int sourceid = ray->mOriginObject ? ray->mOriginObject->mId : -1; 388 int termid = ray->mTerminationObject ? ray->mTerminationObject->mId : -1; 389 390 samplesOut.write(reinterpret_cast<char *>(&origin), sizeof(Vector3)); 391 samplesOut.write(reinterpret_cast<char *>(&termination), sizeof(Vector3)); 392 samplesOut.write(reinterpret_cast<char *>(&sourceid), sizeof(int)); 393 samplesOut.write(reinterpret_cast<char *>(&termid), sizeof(int)); 394 } 395 #endif 323 396 samplesOut.close(); 324 325 397 return true; 326 398 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r490 r491 314 314 polys.pop_back(); 315 315 316 //Debug << "New polygon with plane: " << poly->GetSupportingPlane() << "\n"; 317 318 // classify polygon 316 //-- classify polygon 319 317 const int cf = poly->ClassifyPlane(plane, mEpsilon); 320 318 … … 387 385 app << "#N_LEAVES ( Number of leaves )\n" << Leaves() << "\n"; 388 386 389 app << "#N_SPLITS ( Number of splits )\n" << splits << "\n"; 387 app << "#N_POLYSPLITS ( Number of polygon splits )\n" << polySplits << "\n"; 388 389 app << "#AXIS_ALIGNED_SPLITS (number of axis aligned splits)\n" << splits[0] + splits[1] + splits[2] << endl; 390 391 app << "#N_SPLITS ( Number of splits in axes x y z\n"; 392 393 for (int i = 0; i < 3; ++ i) 394 app << splits[i] << " "; 395 app << endl; 390 396 391 397 app << "#N_PMAXDEPTHLEAVES ( Percentage of leaves at maximum depth )\n" … … 420 426 421 427 app << "#N_ROUTPUT_INPUT_POLYGONS ( ratio polygons after subdivision / input polygons )\n" << 422 (polys + splits) / (double)polys << endl;428 (polys + polySplits) / (double)polys << endl; 423 429 424 430 app << "===== END OF BspTree statistics ==========\n"; … … 529 535 CLEAR_CONTAINER(coincident); 530 536 531 mStat. splits += splits;537 mStat.polySplits += splits; 532 538 533 539 // push the children on the stack … … 962 968 startTime = GetTime(); 963 969 // subdivide polygons with plane 964 mStat. splits += SplitPolygons(interior->GetPlane(),965 *tData.mPolygons,966 967 *backData.mPolygons,968 coincident);970 mStat.polySplits += SplitPolygons(interior->GetPlane(), 971 *tData.mPolygons, 972 *frontData.mPolygons, 973 *backData.mPolygons, 974 coincident); 969 975 970 976 Debug << "time used for polygon splitting: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r490 r491 93 93 int nodes; 94 94 // number of splits 95 int splits; 95 int splits[3]; 96 96 97 // totals number of rays 97 98 int rays; … … 129 130 /// number of invalid leaves 130 131 int invalidLeaves; 132 /// polygon splits 133 int polySplits; 131 134 132 135 // Constructor … … 146 149 { 147 150 nodes = 0; 148 splits = 0; 151 for (int i = 0; i < 3; ++ i) 152 splits[i] = 0; 149 153 150 154 maxDepth = 0; … … 165 169 maxPvs = 0; 166 170 invalidLeaves = 0; 171 polySplits = 0; 167 172 } 168 173 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r490 r491 1643 1643 1644 1644 1645 /********************************************************************** /1646 /* VspBspViewCellsManager implementation */1647 /********************************************************************** /1645 /************************************************************************/ 1646 /* VspBspViewCellsManager implementation */ 1647 /************************************************************************/ 1648 1648 1649 1649 … … 1722 1722 1723 1723 Debug << mVspBspTree->GetStatistics() << endl; 1724 1724 1725 // collapse invalid regions 1726 cout << "collapsing invalid tree regions ... "; 1725 1727 mVspBspTree->CollapseTree(mVspBspTree->GetRoot()); 1728 cout << "finished" << endl; 1729 cout << "reseting view cell stats ... "; 1726 1730 ResetViewCells(); 1731 cout << "finished" << endl; 1727 1732 1728 1733 Debug << "\nView cells after construction:\n" << mViewCellsStats << endl; 1729 1734 1735 if (1) // export initial view cells 1736 { 1737 cout << "exporting initial view cells (=leaves) ... "; 1738 Exporter *exporter = Exporter::GetExporter("view_cells.x3d"); 1739 1740 if (exporter) 1741 { 1742 //exporter->SetWireframe(); 1743 exporter->SetFilled(); 1744 ExportViewCells(exporter); 1745 1746 //if (mExportRays) 1747 // exporter->ExportRays(postProcessRays, RgbColor(1, 1, 0)); 1748 1749 if (mExportGeometry) 1750 exporter->ExportGeometry(objects); 1751 1752 delete exporter; 1753 } 1754 cout << "finished" << endl; 1755 } 1756 1730 1757 long startTime = GetTime(); 1758 cout << "Computing remaining ray contributions ... "; 1731 1759 // recast rest of rays 1732 1760 ComputeSampleContributions(savedRays); 1733 1761 cout << "finished" << endl; 1762 1734 1763 Debug << "Computed remaining ray contribution in " << TimeDiff(startTime, GetTime()) * 1e-3 1735 1764 << " secs" << endl; … … 1806 1835 Debug << ss << endl; 1807 1836 1808 if (1) // export view cells1809 {1810 cout << "exporting initial view cells (=leaves) ... ";1811 Exporter *exporter = Exporter::GetExporter("view_cells.x3d");1812 1813 if (exporter)1814 {1815 //exporter->SetWireframe();1816 exporter->SetFilled();1817 ExportViewCells(exporter);1818 1819 if (mExportRays)1820 {1821 exporter->ExportRays(postProcessRays, RgbColor(1, 1, 0));1822 }1823 1824 if (mExportGeometry)1825 {1826 Material m;1827 m.mDiffuseColor = RgbColor(0, 1, 0);1828 exporter->SetForcedMaterial(m);1829 exporter->SetFilled();1830 1831 exporter->ExportGeometry(objects);1832 }1833 1834 delete exporter;1835 }1836 cout << "finished" << endl;1837 }1838 1839 1837 //-- merge or subdivide view cells 1840 1838 int merged = 0; … … 1853 1851 << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl << endl; 1854 1852 1853 cout << "reseting view cell stats ... "; 1855 1854 ResetViewCells(); 1855 cout << "finished" << endl; 1856 1856 1857 //BspLeaf::NewMail(); 1857 1858 if (1) // export merged view cells -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp
r490 r491 34 34 35 35 float BspMergeCandidate::sOverallCost = 0; 36 37 38 /// Adds object to the pvs of the front and back node 39 inline void AddObject2Pvs(Intersectable *object, 40 const int side, 41 int &pvsBack, 42 int &pvsFront) 43 { 44 if (!object) 45 return; 46 47 if (side <= 0) 48 { 49 if (!object->Mailed() && !object->Mailed(2)) 50 { 51 ++ pvsBack; 52 53 if (object->Mailed(1)) 54 object->Mail(2); 55 else 56 object->Mail(); 57 } 58 } 59 60 if (side >= 0) 61 { 62 if (!object->Mailed(1) && !object->Mailed(2)) 63 { 64 ++ pvsFront; 65 66 if (object->Mailed()) 67 object->Mail(2); 68 else 69 object->Mail(1); 70 } 71 } 72 } 73 36 74 37 75 /****************************************************************/ … … 509 547 510 548 // subdivide polygons 511 mStat.splits +=SplitPolygons(interior->GetPlane(),512 513 514 515 549 SplitPolygons(interior->GetPlane(), 550 *tData.mPolygons, 551 *frontData.mPolygons, 552 *backData.mPolygons, 553 coincident); 516 554 517 555 … … 755 793 756 794 float VspBspTree::SelectAxisAlignedPlane(Plane3 &plane, 757 const VspBspTraversalData &tData) 795 const VspBspTraversalData &tData, 796 int &bestAxis) 758 797 { 759 798 AxisAlignedBox3 box; … … 771 810 float nPosition[3]; 772 811 float nCostRatio[3]; 773 intbestAxis = -1;812 bestAxis = -1; 774 813 775 814 const int sAxis = box.Size().DrivingAxis(); … … 815 854 Vector3 normal(0,0,0); normal[bestAxis] = 1; 816 855 plane = Plane3(normal, nPosition[bestAxis]); 817 856 818 857 return nCostRatio[bestAxis]; 819 858 } 859 860 861 float VspBspTree::EvalCostRatio(const VspBspTraversalData &tData, 862 const AxisAlignedBox3 &box, 863 const int axis, 864 const float position, 865 int &raysBack, 866 int &raysFront, 867 int &pvsBack, 868 int &pvsFront) 869 { 870 raysBack = 0; 871 raysFront = 0; 872 pvsFront = 0; 873 pvsBack = 0; 874 875 Intersectable::NewMail(3); 876 877 // eval pvs size 878 const int pvsSize = tData.mPvs; 879 880 // create unique ids for pvs heuristics 881 GenerateUniqueIdsForPvs(); 882 883 // this is the main ray classification loop! 884 for(RayInfoContainer::iterator ri = tData.mRays->begin(); 885 ri != tData.mRays->end(); ++ ri) 886 { 887 if (!(*ri).mRay->IsActive()) 888 continue; 889 890 // determine the side of this ray with respect to the plane 891 float t; 892 int side = (*ri).ComputeRayIntersection(axis, position, t); 893 894 if (side <= 0) 895 ++ raysBack; 896 897 if (side >= 0) 898 ++ raysFront; 899 900 AddObjToPvs((*ri).mRay->mTerminationObject, side, pvsBack, pvsFront); 901 } 902 903 //-- only one of these options should be one 904 905 if (0) //-- only pvs 906 { 907 const float sum = float(pvsBack + pvsFront); 908 const float oldCost = (float)pvsSize; 909 910 return sum / oldCost; 911 } 912 913 //-- pvs + probability heuristics 914 float pBack, pFront, pOverall; 915 916 if (0) 917 { 918 // box length substitute for probability 919 const float minBox = box.Min(axis); 920 const float maxBox = box.Max(axis); 921 922 pBack = position - minBox; 923 pFront = maxBox - position; 924 pOverall = maxBox - minBox; 925 } 926 927 if (1) //-- area substitute for probability 928 { 929 930 const bool useMidSplit = true; 931 //const bool useMidSplit = false; 932 933 pOverall = box.SurfaceArea(); 934 935 if (!useMidSplit) 936 { 937 Vector3 pos = box.Max(); pos[axis] = position; 938 pBack = AxisAlignedBox3(box.Min(), pos).SurfaceArea(); 939 940 pos = box.Min(); pos[axis] = position; 941 pFront = AxisAlignedBox3(pos, box.Max()).SurfaceArea(); 942 } 943 else 944 { 945 //-- simplified computation for mid split 946 const int axis2 = (axis + 1) % 3; 947 const int axis3 = (axis + 2) % 3; 948 949 const float faceArea = 950 (box.Max(axis2) - box.Min(axis2)) * 951 (box.Max(axis3) - box.Min(axis3)); 952 953 pBack = pFront = pOverall * 0.5f + faceArea; 954 } 955 } 956 957 //-- ray density substitute for probability 958 if (0) 959 { 960 pBack = (float)raysBack; 961 pFront = (float)raysFront; 962 pOverall = (float)tData.mRays->size(); 963 } 964 965 //Debug << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 966 //Debug << pFront << " " << pBack << " " << pOverall << endl; 967 968 // float sum = raysBack*(position - minBox) + raysFront*(maxBox - position); 969 const float newCost = pvsBack * pBack + pvsFront * pFront; 970 // float oldCost = leaf->mRays.size(); 971 const float oldCost = (float)pvsSize * pOverall; 972 973 return (mCtDivCi + newCost) / oldCost; 974 } 975 820 976 821 977 … … 835 991 return true; 836 992 } 837 else838 {839 //-- choose plane on midpoint of a ray840 const int candidateIdx = (int)RandomValue(0, (Real)((int)data.mRays->size() - 1));841 842 const Vector3 minPt = (*data.mRays)[candidateIdx].ExtrapOrigin();843 const Vector3 maxPt = (*data.mRays)[candidateIdx].ExtrapTermination();844 845 const Vector3 pt = (maxPt + minPt) * 0.5;846 847 const Vector3 normal = (*data.mRays)[candidateIdx].mRay->GetDir();848 849 plane = Plane3(normal, pt);850 return true;851 }852 853 return false;854 993 } 855 994 … … 938 1077 // intermediate plane 939 1078 Plane3 plane; 1079 bool useAxisAlignedPlane = false; 940 1080 941 1081 const int limit = Min((int)data.mPolygons->size(), mMaxPolyCandidates); … … 967 1107 } 968 1108 969 #if 0 970 //-- choose candidate planes extracted from rays 971 //-- different methods are available 972 for (int i = 0; i < mMaxRayCandidates; ++ i) 973 { 974 plane = ChooseCandidatePlane3(*data.mRays); 975 candidateCost = SplitPlaneCost(plane, data); 976 977 if (candidateCost < lowestCost) 978 { 979 bestPlane = plane; 980 lowestCost = candidateCost; 981 } 982 } 983 #endif 984 985 // axis aligned splits 986 candidateCost = SelectAxisAlignedPlane(plane, data); 1109 //-- axis aligned splits 1110 int axis; 1111 candidateCost = SelectAxisAlignedPlane(plane, data, axis); 987 1112 988 1113 if (candidateCost < lowestCost) 989 { 1114 { 1115 if (!useAxisAlignedPlane) 1116 { 1117 useAxisAlignedPlane = true; 1118 //! error also computed if cost ratio is missed 1119 ++ mStat.splits[axis]; 1120 } 1121 990 1122 bestPlane = plane; 991 1123 lowestCost = candidateCost; … … 1031 1163 if (mSplitPlaneStrategy & PVS) 1032 1164 { 1165 // matt: change back!! 1166 Intersectable::NewMail(3); 1033 1167 // create unique ids for pvs heuristics 1034 GenerateUniqueIdsForPvs();1168 //GenerateUniqueIdsForPvs(); 1035 1169 1036 1170 if (mPvsUseArea) // use front and back cell areas to approximate volume … … 1056 1190 bool useRand; 1057 1191 1058 // choose test polyongs randomly if over threshold1192 // choose test rays randomly if too much 1059 1193 if ((int)data.mRays->size() > mMaxTests) 1060 1194 { … … 1095 1229 1096 1230 // add the termination object 1097 AddObjToPvs(ray->mTerminationObject, cf, frontPvs, backPvs); 1231 //AddObjToPvs(ray->mTerminationObject, cf, frontPvs, backPvs); 1232 AddObject2Pvs(ray->mTerminationObject, cf, frontPvs, backPvs); 1098 1233 // add the source object 1099 AddObjToPvs(ray->mOriginObject, cf, frontPvs, backPvs);1100 1101 // use number o r length of rays to approximate volume1234 //AddObjToPvs(ray->mOriginObject, cf, frontPvs, backPvs); 1235 1236 // use number of rays to approximate volume 1102 1237 if (!mPvsUseArea) 1103 1238 { 1104 float len = 1; 1105 1106 if (pvsUseLen) // use length of rays 1107 len = rayInf.SqrSegmentLength(); 1108 1109 pOverall += len; 1110 1111 if (cf == 1) 1112 pFront += len; 1113 else if (cf == -1) 1114 pBack += len; 1115 else if (cf == 0) 1116 { 1117 // use length of rays to approximate volume 1118 if (pvsUseLen) 1119 { 1120 float newLen = len * 1121 (rayInf.GetMaxT() - t) / 1122 (rayInf.GetMaxT() - rayInf.GetMinT()); 1123 1124 if (candidatePlane.Side(rayInf.ExtrapOrigin()) <= 0) 1125 { 1126 pBack += newLen; 1127 pFront += len - newLen; 1128 } 1129 else 1130 { 1131 pFront += newLen; 1132 pBack += len - newLen; 1133 } 1134 } 1135 else 1136 { 1137 ++ pFront; 1138 ++ pBack; 1139 } 1140 } 1239 ++ pOverall; 1240 1241 if (cf >= 0) 1242 ++ pFront; 1243 if (cf <= 0) 1244 ++ pBack; 1141 1245 } 1142 1246 } … … 1215 1319 } 1216 1320 } 1321 1217 1322 1218 1323 void VspBspTree::CollectLeaves(vector<BspLeaf *> &leaves) const -
trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h
r489 r491 421 421 */ 422 422 float SelectAxisAlignedPlane(Plane3 &plane, 423 const VspBspTraversalData &tData); 423 const VspBspTraversalData &tData, 424 int &bestAxis); 424 425 425 426 /** Sorts split candidates for surface area heuristics for axis aligned splits. … … 438 439 float &position); 439 440 441 /** Evaluates cost ratio for axis aligned splits. 442 */ 443 float EvalCostRatio(const VspBspTraversalData &tData, 444 const AxisAlignedBox3 &box, 445 const int axis, 446 const float position, 447 int &raysBack, 448 int &raysFront, 449 int &pvsBack, 450 int &pvsFront); 451 440 452 /** Selects an axis aligned split plane. 441 Returns true if split is valied453 @Returns true if split is valied 442 454 */ 443 455 bool SelectAxisAlignedPlane(Plane3 &plane, const PolygonContainer &polys) const; -
trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp
r486 r491 831 831 return (mCtDivCi + newCost) / oldCost; 832 832 } 833 833 834 834 835 float VspKdTree::BestCostRatioRegular(VspKdLeaf *leaf, -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r490 r491 12 12 #include "RenderSimulator.h" 13 13 14 bool useViewSpaceBox = true;14 bool useViewSpaceBox = false; 15 15 bool use2dSampling = false; 16 bool useViewspacePlane = true;16 bool useViewspacePlane = false; 17 17 18 18 VssPreprocessor::VssPreprocessor(): … … 464 464 WriteSamples(mVssRays); 465 465 cout << "finished\n" << endl; 466 } 467 468 //VssRayContainer dummyRays; 469 //LoadSamples(dummyRays, mObjects); 470 //Debug << "rays " << (int)mVssRays.size() << " " << dummyRays.size() << endl; 466 467 /*VssRayContainer dummyRays; 468 LoadSamples(dummyRays, mObjects); 469 Debug << "rays " << (int)mVssRays.size() << " " << dummyRays.size() << endl; 470 471 for (int i = 0; i < (int)mVssRays.size(); ++ i) 472 { 473 Debug << mVssRays[i]->GetOrigin() << " " << mVssRays[i]->GetTermination() << " " << mVssRays[i]->mOriginObject << " " << mVssRays[i]->mTerminationObject << endl; 474 Debug << dummyRays[i]->GetOrigin() << " " << dummyRays[i]->GetTermination() << " " << dummyRays[i]->mOriginObject << " " << dummyRays[i]->mTerminationObject << endl << endl; 475 }*/ 476 } 471 477 472 478 //int numExportRays = 10000;
Note: See TracChangeset
for help on using the changeset viewer.