Changeset 531 for trunk/VUT/GtpVisibilityPreprocessor/src
- Timestamp:
- 01/12/06 20:40:26 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Beam.cpp
r530 r531 75 75 const float yDirRange = mDirBox.Max().y - mDirBox.Min().y; 76 76 77 near = 0.1 ; // NOTE: what is the best value for near and far plane?77 near = 0.1f; // NOTE: what is the best value for near and far plane? 78 78 far = 2.0f * Magnitude(sceneBBox.Diagonal()); 79 79 80 left = near / tan(xDirRange * 0.5 );81 right = near / tan(xDirRange * 0.5 );80 left = near / tan(xDirRange * 0.5f); 81 right = near / tan(xDirRange * 0.5f); 82 82 83 bottom = near / tan(yDirRange * 0.5 );84 top = near / tan(yDirRange * 0.5 );83 bottom = near / tan(yDirRange * 0.5f); 84 top = near / tan(yDirRange * 0.5f); 85 85 } 86 86 … … 89 89 Vector3 directions[4]; 90 90 91 directions[0] = VssRay::GetDirection( dBox.Min().x, dBox.Min().y);92 directions[1] = VssRay::GetDirection( dBox.Max().x, dBox.Min().y);93 directions[2] = VssRay::GetDirection( dBox.Max().x, dBox.Max().y);94 directions[3] = VssRay::GetDirection( dBox.Min().x, dBox.Max().y);91 directions[0] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Min().y); 92 directions[1] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Min().y); 93 directions[2] = VssRay::GetDirection(mDirBox.Max().x, mDirBox.Max().y); 94 directions[3] = VssRay::GetDirection(mDirBox.Min().x, mDirBox.Max().y); 95 95 96 96 const Vector3 mainDir = directions[0] + directions[1] + directions[2] + directions[3]; 97 97 return Normalize(mainDir); 98 98 } 99 100 101 void BeamSampleStatistics::Print(ostream &app) const 102 { 103 app << "===== Beam sample statistics ===============\n"; 104 105 app << "#N_PVSSIZE ( size of pvs )\n" << pvsSize << "\n"; 106 107 app << "#N_RAYS ( Number of rays )\n" << rays << "\n"; 108 109 app << "#N_RAYCONTRIBUTIONS ( number of ray constributions )\n" << 110 rayContributions << "\n"; 111 112 app << "#N_RAYLENGHTENTROPY ( Ray lenght entropy )\n" << 113 rayLengthEntropy << "\n"; 114 115 app << "#N_IMPORTANCE ( importance )\n" << 116 importance << "\n"; 117 118 app << "#N_CTIME ( Construction time [s] )\n" 119 << Time() << " \n"; 120 121 app << "===== END OF KdTree statistics ==========\n"; 122 123 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Beam.h
r525 r531 4 4 #include <vector> 5 5 #include "AxisAlignedBox3.h" 6 #include "Statistics.h" 6 7 7 8 using namespace std; … … 10 11 class Intersectable; 11 12 13 // the values need for rss tree update computed already inside the glrendererbuffer 14 // not all of them need to be computed 15 class BeamSampleStatistics: public StatisticsBase 16 { 17 public: 18 enum {COMPUTE_PVS_SIZE, COMPUTE_RAY_CONTRIBUTIONS, COMPUTE_PVS_ENTROPY}; 19 int flags; 20 21 BeamSampleStatistics(): flags(COMPUTE_RAY_CONTRIBUTIONS) 22 { 23 Reset(); 24 } 25 26 float pvsSize; 27 float rays; 28 float rayContributions; 29 float pvsEntropy; 30 float rayLengthEntropy; 31 float importance; 32 33 float weightedRayContribution; 34 35 void Reset() 36 { 37 pvsSize = 0; 38 rays = 0; 39 rayContributions = 0; 40 pvsEntropy = 0; 41 rayLengthEntropy = 0; 42 importance = 0; 43 } 44 45 void Print(ostream &app) const; 46 47 friend ostream &operator<<(ostream &s, const BeamSampleStatistics &stat) 48 { 49 stat.Print(s); 50 return s; 51 } 52 }; 53 54 12 55 class Beam { 13 56 -
trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h
r525 r531 19 19 class Beam; 20 20 21 class BeamSampleStatistics; 22 21 23 struct PvsRenderStatistics { 22 24 … … 136 138 137 139 138 139 // the values need for rss tree update computed already inside the glrendererbuffer140 // not all of them need to be computed141 struct BeamSampleStatistics {142 143 enum {COMPUTE_PVS_SIZE, COMPUTE_RAY_CONTRIBUTIONS, COMPUTE_PVS_ENTROPY};144 int flags;145 146 BeamSampleStatistics():flags(COMPUTE_RAY_CONTRIBUTIONS) {}147 148 float pvsSize;149 float rays;150 float rayContributions;151 float pvsEntropy;152 float rayLengthEntropy;153 float importance;154 155 float weightedRayContribution;156 };157 158 159 140 void SampleBeamContributions( 160 141 Intersectable *sourceObject, -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r530 r531 11 11 #include "ViewCellsManager.h" 12 12 #include "RenderSimulator.h" 13 #include "Beam.h" 14 #include "GlRenderer.h" 13 15 14 16 bool use2dSampling = false; … … 347 349 348 350 349 void VssPreprocess ::VerifyBeamCasting()350 { 351 352 vector<Vss Leaf *> leaves;353 mVssTree->CollectLeaves(leaves);351 void VssPreprocessor::TestBeamCasting(VssTree *tree) 352 { 353 354 vector<VssTreeLeaf *> leaves; 355 tree->CollectLeaves(leaves); 354 356 355 357 for (int i = 0; i < 10; ++i) 356 358 { 357 const int index = (int)RandomValue(0, (Real)((int)lea f.size() - 1));358 Vss Leaf *leaf = leaves[index];359 const int index = (int)RandomValue(0, (Real)((int)leaves.size() - 1)); 360 VssTreeLeaf *leaf = leaves[index]; 359 361 360 362 Beam beam; 361 AxisAlignedBox3 dirBox = mVssTree->GetDirBBox(leaf);362 AxisAlignedBox3 box = mVssTree->GetBBox(leaf);363 AxisAlignedBox3 dirBox =tree->GetDirBBox(leaf); 364 AxisAlignedBox3 box = tree->GetBBox(leaf); 363 365 beam.Construct(dirBox, box); 364 366 Intersectable *sourceObj = mObjects[5]; 365 367 BeamSampleStatistics stats; 366 mGlRenderer->SampleBeamContributions(sourceObj,367 368 369 368 renderer->SampleBeamContributions(sourceObj, 369 beam, 370 10000, 371 stats); 370 372 371 373 Debug << "beam statistics: " << stats << endl; -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h
r530 r531 105 105 void CastRay(const BspTree &tree, const VssRay & vssRay); 106 106 107 float VerifyBeamCasting(Beam &beam);107 void TestBeamCasting(VssTree *tree); 108 108 }; 109 109
Note: See TracChangeset
for help on using the changeset viewer.