Changeset 2570 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 12/18/07 09:04:41 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp
r2569 r2570 115 115 116 116 117 int TriangleIntersectable::GetRandomEdgePoint(Vector3 &point, 118 Vector3 &normal) 117 int TriangleIntersectable::GetRandomEdgePoint(Vector3 &point, Vector3 &normal) 119 118 { 120 119 const int edge = Random(3); … … 137 136 } 138 137 138 139 139 int KdIntersectable::ComputeNumTriangles() 140 140 { 141 Intersectable::NewMail(); 142 141 143 std::stack<KdNode *> tStack; 142 144 tStack.push(mItem); -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2548 r2570 39 39 typename vector<PvsEntry<T, S> >::const_iterator mItCurrent; 40 40 typename vector<PvsEntry<T, S> >::const_iterator mItEnd; 41 }; 42 43 44 struct VerbosePvsStats 45 { 46 VerbosePvsStats(): mDistanceWeightedTriangles(0), mDistanceWeightedPvs(0), mWeightedTriangles(0) 47 {} 48 49 float mDistanceWeightedTriangles; 50 float mDistanceWeightedPvs; 51 float mWeightedTriangles; 41 52 }; 42 53 … … 205 216 206 217 typename PvsIterator<T, S> GetIterator() const; 218 219 VerbosePvsStats mStats; 207 220 208 221 protected: … … 236 249 237 250 template <typename T, typename S> 238 VerbosePvs<T, S>::VerbosePvs(const vector<PvsEntry<T, S> > &samples) 251 VerbosePvs<T, S>::VerbosePvs(const vector<PvsEntry<T, S> > &samples): 252 mLastSorted(0) 239 253 { 240 254 mEntries.reserve(samples.size()); 241 255 mEntries = samples; 242 mLastSorted = 0;243 256 mSamples = samples.size(); 244 257 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2569 r2570 1180 1180 } 1181 1181 1182 1182 #if 0 1183 1183 float QtGlRendererWidget::ComputeRenderCost(ViewCell *vc) 1184 1184 { … … 1221 1221 return renderCost; 1222 1222 } 1223 1223 #else 1224 1225 float QtGlRendererWidget::ComputeRenderCost(ViewCell *vc) 1226 { 1227 float renderCost = 0; 1228 1229 if (mShowDistanceWeightedPvs) 1230 { 1231 return vc->GetPvs().mStats.mDistanceWeightedPvs; 1232 } 1233 else if (mShowDistanceWeightedTriangles) 1234 { 1235 return vc->GetPvs().mStats.mDistanceWeightedTriangles; 1236 } 1237 else //if (mShowWeightedTriangles) 1238 { 1239 return vc->GetPvs().mStats.mWeightedTriangles; 1240 } 1241 } 1242 #endif 1224 1243 1225 1244 void … … 1374 1393 else if (mShowWeightedCost) 1375 1394 { 1376 const float rcCost = mTransferFunction * vc->GetTrianglesInPvs();1395 const float rcCost = mTransferFunction * ComputeRenderCost(vc); 1377 1396 importance = rcCost / maxRcCost; 1378 1397 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2569 r2570 2101 2101 if (!ViewCellsConstructed()) 2102 2102 { 2103 // view cells not yet constructed2103 // view cells not constructed yet => 2104 2104 // just take the lenghts of the rays as contributions 2105 2105 if ((*it)->mTerminationObject) … … 2669 2669 2670 2670 2671 void ViewCellsManager::UpdateStatsForViewCell(ViewCell *vc, Intersectable *obj) 2672 { 2673 KdIntersectable *kdObj = static_cast<KdIntersectable *>(obj); 2674 2675 const AxisAlignedBox3 box = kdObj->GetBox(); 2676 const float dist = SqrDistance(vc->GetBox().Center(), box.Center()); 2677 2678 float f; 2679 2680 const float radius = mViewSpaceBox.Radius(); 2681 const float fullRadius = mViewSpaceBox.Radius(); 2682 2683 const float minVal = 0.1f; 2684 const float maxVal = 1.0f; 2685 2686 if (dist <= radius) 2687 f = maxVal; 2688 else if (dist >= fullRadius) 2689 f = minVal; 2690 else // linear blending 2691 { 2692 f = minVal * (dist - radius) + maxVal * (fullRadius - radius - dist); 2693 } 2694 2695 const int numTriangles = kdObj->ComputeNumTriangles(); 2696 2697 vc->GetPvs().mStats.mDistanceWeightedTriangles += f * numTriangles; 2698 vc->GetPvs().mStats.mDistanceWeightedPvs += f; 2699 vc->GetPvs().mStats.mWeightedTriangles += numTriangles; 2700 } 2701 2702 2671 2703 void ViewCellsManager::ComputeViewCellContribution(ViewCell *viewCell, 2672 2704 VssRay &ray, … … 2692 2724 hasAbsContribution = viewCell->GetPvs().AddSampleDirtyCheck(obj, ray.mPdf); 2693 2725 //hasAbsContribution = viewCell->GetPvs().AddSample(obj,ray.mPdf); 2726 #if 1 2727 UpdateStatsForViewCell(viewCell, obj); 2728 #endif 2729 2694 2730 } 2695 2731 else -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2569 r2570 670 670 671 671 672 void UpdateStatsForViewCell(ViewCell *viewCell, Intersectable *obj); 673 674 672 675 /////////////////////// 673 676 //-- helper functions for view cell visualization
Note: See TracChangeset
for help on using the changeset viewer.