- Timestamp:
- 01/22/07 16:00:07 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
r2008 r2012 12 12 #include "PreprocessorThread.h" 13 13 #include "CombinedPreprocessor.h" 14 #include "RayCaster.h" 14 15 15 16 … … 66 67 mPass = 0; 67 68 68 69 vector<VssRayContainer> rayBuffer; 70 rays.reserve(mSamplesPerPass); 71 rayBuffer.reserve(2*mSamplesPerPass); 69 72 70 vector<VssRayContainer> rayBuffer;71 72 73 73 long startTime = GetTime(); 74 74 for (int i=0; i < mTotalSamples; i += mSamplesPerPass, mPass++) { 75 75 mRayCaster->InitPass(); 76 76 77 cout<<"Progress : "<<(100.0f*i)/mTotalSamples<<"%"<<endl; 77 78 rays.clear(); 78 79 vssRays.clear(); 80 79 81 80 82 mMixtureDistribution->GenerateSamples(mSamplesPerPass, rays); … … 124 126 } 125 127 128 #if 0 126 129 cerr<<"deleting rays"<<endl; 127 130 //clear all unreferenced rays … … 131 134 } 132 135 cerr<<"done."<<endl; 133 136 #endif 134 137 135 138 // if (!mMixtureDistribution->RequiresRays()) -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2011 r2012 1187 1187 } 1188 1188 1189 mRayCaster->ReserveVssRayPool(2*mSamplesPerPass); 1190 1189 1191 return true; 1190 1192 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2008 r2012 262 262 ///////////////////////// 263 263 264 265 266 264 GlobalLinesRenderer *mGlobalLinesRenderer; 265 RayCaster *mRayCaster; 266 /// samples used for construction of the BSP view cells tree. 267 267 int mBspConstructionSamples; 268 268 /// samples used for construction of the VSP OSP tree. … … 274 274 275 275 276 276 277 /// if box around view space should be used 277 278 bool mUseViewSpaceBox; -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
r2008 r2012 291 291 292 292 if (!pruneInvalidRays || hitA.mObject) { 293 VssRay *vssRay = new VssRay( 294 !castDoubleRay ? simpleRay.mOrigin : clipB, 295 hitA.mPoint, 296 hitB.mObject, 297 hitA.mObject, 298 mPreprocessor.mPass, 299 simpleRay.mPdf 300 ); 293 VssRay *vssRay = mVssRayPool.Alloc(); 294 295 *vssRay = VssRay( 296 !castDoubleRay ? simpleRay.mOrigin : clipB, 297 hitA.mPoint, 298 hitB.mObject, 299 hitA.mObject, 300 mPreprocessor.mPass, 301 simpleRay.mPdf 302 ); 301 303 302 304 if (validA) … … 317 319 if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 318 320 { 319 VssRay *vssRay = new VssRay( 320 clipA, 321 hitB.mPoint, 322 hitA.mObject, 323 hitB.mObject, 324 mPreprocessor.mPass, 325 simpleRay.mPdf 326 ); 321 VssRay *vssRay = mVssRayPool.Alloc(); 322 *vssRay = VssRay( 323 clipA, 324 hitB.mPoint, 325 hitA.mObject, 326 hitB.mObject, 327 mPreprocessor.mPass, 328 simpleRay.mPdf 329 ); 327 330 if (validB) 328 331 vssRay->mFlags |= VssRay::Valid; -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h
r1996 r2012 64 64 SortRays(SimpleRayContainer &rays); 65 65 66 66 67 68 // pool of vss rays to be used in one pass of the sampling 69 struct VssRayPool { 70 VssRayPool():mRays(), mIndex(0) {} 71 void Reserve(const int number) { 72 mRays.reserve(number); 73 } 74 void Clear() { 75 mIndex = 0; 76 } 77 VssRay *Alloc() { 78 return &mRays[mIndex++]; 79 } 80 vector<VssRay> mRays; 81 int mIndex; 82 }; 83 84 85 VssRayPool mVssRayPool; 86 87 void ReserveVssRayPool(const int n) { 88 mVssRayPool.Reserve(n); 89 } 90 91 void InitPass() { 92 mVssRayPool.Clear(); 93 } 94 67 95 68 96 protected: … … 114 142 Vector3 &clippedTermination); 115 143 116 const Preprocessor &mPreprocessor; 144 145 146 147 148 149 const Preprocessor &mPreprocessor; 117 150 }; 118 151
Note: See TracChangeset
for help on using the changeset viewer.