Changeset 1149 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 07/25/06 08:42:07 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1147 r1149 2217 2217 "true"); 2218 2218 2219 RegisterOption("VspTree.maxTests", 2220 optInt, 2221 "vsp_max_tests=", 2222 "2000"); 2219 2223 2220 2224 -
GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.cpp
r863 r1149 165 165 } 166 166 167 167 168 float RayInfo::SqrSegmentLength() const 168 169 { … … 170 171 } 171 172 173 174 void GetRayInfoSets(const RayInfoContainer &sourceRays, 175 const int maxSize, 176 RayInfoContainer &usedRays, 177 RayInfoContainer *savedRays) 178 { 179 const int limit = min(maxSize, (int)sourceRays.size()); 180 const float prop = (float)limit / ((float)sourceRays.size() + Limits::Small); 181 182 RayInfoContainer::const_iterator it, it_end = sourceRays.end(); 183 184 for (it = sourceRays.begin(); it != it_end; ++ it) 185 { 186 if (Random(1.0f) < prop) 187 usedRays.push_back(*it); 188 else if (savedRays) 189 savedRays->push_back(*it); 190 } 172 191 } 192 193 } -
GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.h
r1147 r1149 93 93 int ComputeRayIntersection(const Plane3 &splitPlane, float &t) const; 94 94 95 /*friend void GetRaySets(const RayInfoContainer &sourceRays,96 97 98 RayInfoContainer *savedRays) const;*/95 friend void GetRayInfoSets(const RayInfoContainer &sourceRays, 96 const int maxSize, 97 RayInfoContainer &usedRays, 98 RayInfoContainer *savedRays = NULL); 99 99 }; 100 100 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r1147 r1149 1358 1358 float &position) 1359 1359 { 1360 RayInfoContainer usedRays , savedRays;1361 1362 /*if (mMaxTests < rays.size())1363 { 1364 GetRay Sets(rays, mMaxTests, usedRays, savedRays);1360 RayInfoContainer usedRays; 1361 1362 if (mMaxTests < rays.size()) 1363 { 1364 GetRayInfoSets(rays, mMaxTests, usedRays); 1365 1365 } 1366 1366 else 1367 { */1367 { 1368 1368 usedRays = rays; 1369 //}1369 } 1370 1370 1371 1371 const float minBox = box.Min(axis); … … 1405 1405 1406 1406 // set all object as belonging to the front pvs 1407 for(ri = rays.begin(); ri != ri_end; ++ ri)1407 for(ri = usedRays.begin(); ri != ri_end; ++ ri) 1408 1408 { 1409 1409 Intersectable *oObject = (*ri).mRay->mOriginObject; … … 1500 1500 1501 1501 // HACK: current positition is BETWEEN visibility events 1502 if ((ci + 1) != ci_end) 1502 if (0 && ((ci + 1) != ci_end)) 1503 { 1503 1504 currentPos = ((*ci).value + (*(ci + 1)).value) * 0.5f; 1505 } 1504 1506 else 1505 1507 currentPos = (*ci).value; 1506 1508 1507 1509 //Debug << "pos=" << (*ci).value << "\t pvs=(" << pvsl << "," << pvsr << ")" << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
r1147 r1149 413 413 Environment::GetSingleton()->GetBoolValue("VspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis); 414 414 415 //Environment::GetSingleton()->GetFloatValue("VspTree.maxTotalMemory", mMaxTotalMemory);415 Environment::GetSingleton()->GetIntValue("VspTree.maxTests", mMaxTests); 416 416 Environment::GetSingleton()->GetFloatValue("VspTree.maxStaticMemory", mMaxMemory); 417 417 … … 1390 1390 float &position) 1391 1391 { 1392 RayInfoContainer *rays = tData.mRays; 1392 RayInfoContainer usedRays; 1393 1394 if (mMaxTests < (int)tData.mRays->size()) 1395 { 1396 GetRayInfoSets(*tData.mRays, mMaxTests, usedRays); 1397 } 1398 else 1399 { 1400 usedRays = *tData.mRays; 1401 } 1402 1393 1403 int pvsSize = tData.mPvs; 1394 1404 … … 1401 1411 const float maxBand = minBox + mMaxBand * sizeBox; 1402 1412 1403 SortSplitCandidates( *rays, axis, minBand, maxBand);1413 SortSplitCandidates(usedRays, axis, minBand, maxBand); 1404 1414 1405 1415 // prepare the sweep 1406 1416 // (note: returns pvs size, so there would be no need 1407 1417 // to give pvs size as argument) 1408 pvsSize = PrepareHeuristics( *rays);1418 pvsSize = PrepareHeuristics(usedRays); 1409 1419 1410 1420 // go through the lists, count the number of objects left and right … … 1448 1458 1449 1459 // HACK: current positition is BETWEEN visibility events 1450 if ( (ci + 1) != ci_end)1460 if (0 && ((ci + 1) != ci_end)) 1451 1461 currentPos = ((*ci).value + (*(ci + 1)).value) * 0.5f; 1452 1462 else … … 3295 3305 3296 3306 // HACK: current positition is BETWEEN visibility events 3297 if ( (ci + 1) != ci_end)3307 if (0 && ((ci + 1) != ci_end)) 3298 3308 currentPos = ((*ci).mPos + (*(ci + 1)).mPos) * 0.5f; 3299 3309 else … … 3301 3311 3302 3312 // note matt: can happen that volr is less than zero: bug or numerical error? 3303 //if (volr < 0) Debug << "warning!! " << totalVol << " " << volRightDecr << " " << volRightDecr - totalVol << endl;3313 //if (volr < 0) Debug << "warning!"; 3304 3314 3305 3315 /*Debug << "pos: " << (*ci).mPos -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
r1145 r1149 1133 1133 /// weight between render cost decrease and node render cost 1134 1134 float mRenderCostDecreaseWeight; 1135 1136 int mMaxTests; 1135 1137 }; 1136 1138
Note: See TracChangeset
for help on using the changeset viewer.