Changeset 1757 for GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
- Timestamp:
- 11/15/06 14:56:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r1751 r1757 159 159 public: 160 160 161 Pvs(): mSamples(0), mEntries() {}161 Pvs(): mSamples(0), mEntries(), mLastSorted(0) {} 162 162 163 163 /** creates pvs and initializes it with the given entries. … … 205 205 */ 206 206 float AddSample(T sample, const float pdf); 207 207 208 /** Adds sample to PVS without checking for presence of the sample 209 pvs remians unsorted! 210 */ 211 void AddSampleDirty(T sample, const float pdf); 212 213 /** Sort pvs entries - this should always be called after a 214 sequence of AddSampleDirty calls */ 215 void Sort(); 216 208 217 /** Adds sample to PVS. Assumes that the pvs is sorted 209 218 @returns contribution of sample (0 or 1) … … 271 280 /// Number of samples used to create the PVS 272 281 int mSamples; 282 283 /// Last sorted entry in the pvs (important for find and merge 284 int mLastSorted; 285 273 286 }; 274 287 … … 279 292 mEntries.reserve(samples.size()); 280 293 mEntries = samples; 281 } 282 294 mLastSorted = 0; 295 } 296 297 template <typename T, typename S> 298 void Pvs<T, S>::Sort() 299 { 300 std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin(); 301 it.inc(mLastSorted); 302 sort(it, mEntries.end()); 303 mLastSorted = mEntries.size() - 1; 304 } 283 305 284 306 /** … … 500 522 501 523 template <typename T, typename S> 524 void Pvs<T, S>::AddSampleDirty(T sample, const float pdf) 525 { 526 ++ mSamples; 527 mEntries.push_back(PvsEntry<T, S>(sample, pdf)); 528 } 529 530 531 template <typename T, typename S> 502 532 typename vector< PvsEntry<T, S> >::iterator Pvs<T, S>::AddSample2(T sample, const float pdf) 503 533 {
Note: See TracChangeset
for help on using the changeset viewer.