Changeset 2735 for GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
- Timestamp:
- 06/04/08 01:49:14 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2728 r2735 1 2 1 #include "SamplingStrategy.h" 3 2 #include "Ray.h" … … 18 17 #define USE_HALTON 1 19 18 19 20 20 namespace GtpVisibilityPreprocessor { 21 21 … … 27 27 #endif 28 28 29 //HaltonSequence SamplingStrategy::sHalton;30 31 29 HaltonSequence ObjectBasedDistribution::sHalton; 32 30 HaltonSequence MixtureDistribution::sHalton; … … 39 37 HaltonSequence ViewCellBasedDistribution::sHalton; 40 38 HaltonSequence ViewCellBorderBasedDistribution::sHalton; 39 HaltonSequence ProbablyVisibleDistribution::sHalton; 40 41 41 42 42 43 SamplingStrategy::SamplingStrategy(Preprocessor &preprocessor): … … 575 576 { 576 577 #ifdef USE_PERFTIMER 577 const floatvcTime = viewCellCastTimer.TotalTime();578 const floatpvsTime = pvsTimer.TotalTime();579 const floathaltonTime = haltonTimer.TotalTime();578 const double vcTime = viewCellCastTimer.TotalTime(); 579 const double pvsTime = pvsTimer.TotalTime(); 580 const double haltonTime = haltonTimer.TotalTime(); 580 581 581 582 cout << "view cell cast time: " << vcTime << " s" << endl; … … 881 882 882 883 883 } 884 885 884 bool ProbablyVisibleDistribution::GenerateSample(SimpleRay &ray) 885 { 886 static Vector3 origin; 887 static Vector3 direction; 888 static Vector3 point; 889 static Vector3 normal; 890 891 float r[2]; 892 sHalton.GetNext(2, r); 893 894 r[0] *= (float)(*mObjects).size() - 1.0f; 895 const int i = (int)r[0]; 896 897 Intersectable *obj = (*mObjects)[i]; 898 899 obj->GetRandomSurfacePoint(point, normal); 900 901 // get point on view cell surface 902 if (1) 903 origin = mViewCell->GetBox().GetRandomSurfacePoint(); 904 else 905 origin = mViewCell->GetBox().GetUniformRandomSurfacePoint(); 906 907 direction = point - origin; 908 909 const float c = Magnitude(direction); 910 911 if (c <= Limits::Small) 912 return false; 913 914 ray = SimpleRay(origin, direction, PROBABLY_VISIBLE_DISTRIBUTION, 1.0f); 915 916 return true; 917 } 918 919 } 920 921
Note: See TracChangeset
for help on using the changeset viewer.