Changeset 2529
- Timestamp:
- 07/06/07 00:38:58 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2199 r2529 59 59 60 60 /** creates pvs and initializes it with the given entries. 61 Assumes that entries are sorted-61 Assumes that entries are sorted. 62 62 */ 63 63 VerbosePvs(const vector<PvsEntry<T, S> > &samples); … … 66 66 /** Compresses PVS lossless or lossy. 67 67 */ 68 int Compress() 69 { 70 return 0; 71 } 72 73 int GetSize() const 74 { 75 return (int)mEntries.size(); 76 } 77 78 bool Empty() const 79 { 80 return mEntries.empty(); 81 } 82 83 void Reserve(const int n) 84 { 85 mEntries.reserve(n); 86 } 87 68 int Compress() { return 0; } 69 70 inline int GetSize() const { return (int)mEntries.size(); } 71 72 inline bool Empty() const { return mEntries.empty(); } 73 74 inline void Reserve(const int n) { mEntries.reserve(n); } 88 75 /** Normalize the visibility of entries in order to get 89 comparable results.76 comparable results. 90 77 */ 91 78 void NormalizeMaximum(); 92 93 79 /** Merges pvs of a into this pvs. 94 Warning: very slow!80 Warning: very slow! 95 81 */ 96 82 void MergeInPlace(const VerbosePvs<T, S> &a); 97 98 83 /** Difference of pvs to pvs b. 99 84 @returns number of different entries. 100 85 */ 101 86 int Diff(const VerbosePvs<T, S> &b); 102 103 87 /** Finds sample in PVS. 104 88 @param checkDirty if dirty part of the pvs should be checked for entry … … 112 96 113 97 bool GetSampleContribution(T sample, const float pdf, float &contribution); 114 115 98 /** Adds sample to PVS. 116 99 @returns contribution of sample (0 or 1) 117 100 */ 118 101 float AddSample(T sample, const float pdf); 119 120 102 /** Adds sample to PVS without checking for presence of the sample 121 103 warning: pvs remains unsorted! 122 104 */ 123 105 void AddSampleDirty(T sample, const float pdf); 124 125 106 /** Adds sample dirty (on the end of the vector) but 126 107 first checks if sample is already in clean part of the pvs. 127 108 */ 128 109 bool AddSampleDirtyCheck(T sample, const float pdf); 129 130 /** Sort pvs entries - this should always be called after a 110 /** Sort pvs entries. This should always be called after a 131 111 sequence of AddSampleDirty calls 132 112 */ 133 113 void Sort(); 134 135 114 /** Sort pvs entries assume that the pvs contains unique entries 136 115 */ 137 116 void SimpleSort(); 138 139 117 /** Adds sample to PVS. 140 118 @returns PvsData … … 142 120 typename std::vector<PvsEntry<T, S> >::iterator 143 121 AddSample2(T sample, const float pdf); 144 145 122 /** Subtracts one pvs from another one. 146 123 WARNING: could contains bugs … … 172 149 */ 173 150 void Clear(const bool trim = true); 174 151 /** Trim the vector containing the pvs. 152 */ 175 153 void Trim(); 176 154 … … 186 164 const VerbosePvs<T, S> &b); 187 165 188 int GetSamples() const 189 { 190 return mSamples; 191 } 192 193 bool IsDirty() const 194 { 195 return mLastSorted < mEntries.size(); 196 } 197 166 inline int GetSamples() const { return mSamples; } 167 168 /** If there is an unsorted part in the pvs. 169 */ 170 bool IsDirty() const { return mLastSorted < mEntries.size(); } 171 172 /** If this pvs requires a resort to stay efficient. 173 */ 198 174 bool RequiresResort() const 199 175 { … … 212 188 mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) 213 189 { 214 //cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl;190 // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 215 191 return true; 216 192 } … … 219 195 } 220 196 197 /** If this pvs requires a resort to stay efficient. 198 */ 221 199 bool RequiresResortLog() const 222 200 { … … 227 205 } 228 206 229 int GetLastSorted() const 230 { 231 return mLastSorted; 232 } 207 inline int GetLastSorted() const { return mLastSorted; } 233 208 234 209 typename PvsIterator<T, S> GetIterator() const; … … 236 211 protected: 237 212 213 /** Merge pvs 1 from begin iterator to end iterator with 214 pvs 2 from begin iterator to end iterator. 215 */ 238 216 static void Merge(VerbosePvs<T, S> &mergedPvs, 239 217 const typename std::vector<PvsEntry<T, S> >::const_iterator &aBegin, … … 243 221 const int aSamples, 244 222 const int bSamples); 223 245 224 246 225 ////////////////////////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h
r2176 r2529 73 73 // $$JB in order to return meaningfull values 74 74 // it assumes that the sum pdf has been normalized somehow!!! 75 inline float GetVisibility() 76 { 77 return mSumPdf; 78 } 75 inline float GetVisibility() { return mSumPdf; } 79 76 80 77 /// sum of probability density of visible sample rays … … 96 93 // $$JB in order to return meaningfull values 97 94 // it assumes that the sum pdf has been normalized somehow!!! 98 float GetVisibility() 99 { 100 return mSumPdf; 101 } 95 inline float GetVisibility() { return mSumPdf; } 96 102 97 103 98 /////////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2173 r2529 417 417 //float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 418 418 // glColor3f(visibility, 0.0f, 0.0f); 419 419 cerr << "sumpdf: " << entry.mData.mSumPdf << endl; 420 420 RgbColor color = RainbowColorMapping(mTransferFunction*log10(entry.mData.mSumPdf + 1)); 421 421 glColor3f(color.r, color.g, color.b); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2394 r2529 3649 3649 pvs = root->GetPvs(); 3650 3650 UpdateScalarPvsSize(root, pvs.EvalPvsCost(), pvs.GetSize()); 3651 3651 3652 return; 3652 3653 } … … 3671 3672 int i = 0; 3672 3673 3674 //////// 3675 //-- recursivly compute child pvss 3676 3673 3677 for (vit = interior->mChildren.begin(); vit != vit_end; ++ vit, ++ i) 3674 3678 { 3675 ////////////////// 3676 //-- recursivly compute child pvss 3677 UpdatePvsForEvaluation(*vit, pvsList[i]/*objPvs*/); 3679 UpdatePvsForEvaluation(*vit, pvsList[i]); 3678 3680 } 3679 3681 … … 3700 3702 { 3701 3703 intersect->Mail(); 3702 3703 3704 pvs.AddSampleDirty(intersect, pvsData.mSumPdf); 3704 3705 } 3705 3706 } 3706 3707 } 3707 3708 if (0) pvs.Sort();3709 3708 3710 3709 // store pvs in this node -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r2353 r2529 3709 3709 BvhNode *parent = obj->GetParent(); 3710 3710 3711 // add only entries that cannot be exchan ed with the parent3711 // add only entries that cannot be exchanged with the parent 3712 3712 if (!parent->Mailed(1)) 3713 3713 {
Note: See TracChangeset
for help on using the changeset viewer.