Changeset 2570 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 12/18/07 09:04:41 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.