Changeset 2593 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/14/08 18:25:44 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_arena
r2586 r2593 14 14 15 15 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 16 -rss_distributions= spatial \16 -rss_distributions=mutation+object_direction+spatial \ 17 17 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 18 18 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 19 -preprocessor_ray_cast_method= 1\19 -preprocessor_ray_cast_method=2 \ 20 20 -preprocessor_stats=$PREFIX-i-spatial-b1-n4a.log \ 21 21 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog \ -
GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
r2586 r2593 67 67 68 68 int lastEvaluation = 0; 69 // int totalVssRays = 0;69 70 70 mPass = 0; 71 71 -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2591 r2593 14 14 #include "KdTree.h" 15 15 #include "SamplingStrategy.h" 16 #include "Preprocessor.h" 16 17 17 18 … … 145 146 void GlRenderer::RenderIntersectable(Intersectable *object) 146 147 { 147 if (!object )148 if (!object || (object->mRenderedFrame == mCurrentFrame)) 148 149 return; 149 150 150 if (object->mRenderedFrame == mCurrentFrame)151 return;152 153 151 object->mRenderedFrame = mCurrentFrame; 154 155 //if (object->Mailed()) return;156 //object->Mail();157 152 158 153 glPushAttrib(GL_CURRENT_BIT); … … 205 200 206 201 207 void GlRenderer::RenderRays(const VssRayContainer &rays, int colorType, int showDistribution) 208 { 202 void GlRenderer::RenderRays(const VssRayContainer &rays, int colorType, int showDistribution, int maxAge) 203 { 204 float importance; 205 206 glBegin(GL_LINES); 207 209 208 VssRayContainer::const_iterator it = rays.begin(), it_end = rays.end(); 210 211 glBegin(GL_LINES);212 213 float importance;214 209 215 210 for (; it != it_end; ++it) … … 221 216 ((ray->mDistribution == SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION) && ((showDistribution & 2) == 0)) || 222 217 ((ray->mDistribution == SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION) && ((showDistribution & 4) == 0)) || 223 ((ray->mDistribution == SamplingStrategy::MUTATION_BASED_DISTRIBUTION) && ((showDistribution & 8) == 0))) 218 ((ray->mDistribution == SamplingStrategy::MUTATION_BASED_DISTRIBUTION) && ((showDistribution & 8) == 0)) || 219 ((mViewCellsManager->GetPreprocessor()->mPass - ray->mPass) >= maxAge)) 224 220 { 225 221 continue; -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r2591 r2593 30 30 31 31 struct VssRayContainer; 32 33 struct GLUquadric; 34 35 struct PvsRenderStatistics {36 32 struct GLUquadric; 33 34 35 struct PvsRenderStatistics 36 { 37 37 float maxError; 38 38 float sumError; … … 43 43 PvsRenderStatistics() { Reset(); } 44 44 45 void Reset() { 45 void Reset() 46 { 46 47 maxError = 0.0f; 47 48 sumError = 0.0f; … … 58 59 }; 59 60 60 struct PvsCache { 61 62 PvsCache():mViewCell(NULL), mUnfilteredPvsSize(0) {} 63 64 void Reset() 65 { 66 mViewCell = NULL; mPvs.Clear(); 67 filteredBoxes.clear(); 68 mUnfilteredPvsSize = 0; 69 } 70 71 ViewCell *mViewCell; 72 ObjectPvs mPvs; 73 int mUnfilteredPvsSize; 74 vector<AxisAlignedBox3> filteredBoxes; 75 }; 61 62 struct PvsCache 63 { 64 65 PvsCache():mViewCell(NULL), mUnfilteredPvsSize(0) {} 66 67 void Reset() 68 { 69 mViewCell = NULL; mPvs.Clear(); 70 filteredBoxes.clear(); 71 mUnfilteredPvsSize = 0; 72 } 73 74 ViewCell *mViewCell; 75 ObjectPvs mPvs; 76 int mUnfilteredPvsSize; 77 vector<AxisAlignedBox3> filteredBoxes; 78 }; 76 79 77 80 … … 129 132 130 133 void 131 RenderRays(const VssRayContainer &rays, int colorType = 0, int showDistribution = 15 );134 RenderRays(const VssRayContainer &rays, int colorType = 0, int showDistribution = 15, int maxAge = 9999999); 132 135 133 136 void -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2592 r2593 670 670 cout << "loading objects from " << buf << endl; 671 671 672 // load objects which will beused as pvs entries672 // load scene objects used as pvs entries 673 673 ObjectContainer pvsObjects; 674 674 if (0) LoadObjects(buf, pvsObjects, mObjects); … … 731 731 { 732 732 if (!mViewCellsManager->LoadViewCellsGeometry(vcGeomFilename, extrudeBaseTriangles)) 733 {734 733 cerr << "loading view cells geometry failed" << endl; 735 }736 734 } 737 735 else … … 1616 1614 1617 1615 1618 } 1616 bool Preprocessor::AddGeometry(const string &filename, 1617 ObjectContainer &pvsObjects, 1618 const ObjectContainer &preprocessorObjects) 1619 { 1620 // bool success = LoadBinaryObj(filename, mSceneGraph->GetRoot(), &mFaseParents); 1621 bool success = LoadBinaryObj(filename, mSceneGraph->GetRoot(), NULL); 1622 1623 return success; 1624 } 1625 1626 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2588 r2593 179 179 Vector3 GetParentNormal(const int index) const; 180 180 181 /** Sets a Preprocessor thread.181 /** Sets a preprocessor thread. 182 182 */ 183 183 void SetThread(PreprocessorThread *t); 184 184 185 /** Returns a Preprocessor thread.185 /** Returns a preprocessor thread. 186 186 */ 187 187 PreprocessorThread *GetThread() const; … … 194 194 195 195 static bool LoadObjects(const string &filename, 196 ObjectContainer &pvsObjects, 197 const ObjectContainer &preprocessorObject); 198 196 ObjectContainer &pvsObjects, 197 const ObjectContainer &preprocessorObject); 198 199 /** Adds new geometry to the existing one. 200 */ 201 bool AddGeometry(const string &filename, ObjectContainer &pvsObjects, const ObjectContainer &prepObjects); 199 202 200 203 ///////////////////////// -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2587 r2593 366 366 <File 367 367 RelativePath="..\src\Exporter.h"> 368 </File> 369 <File 370 RelativePath=".\FilterBasedDistribution.cpp"> 371 </File> 372 <File 373 RelativePath=".\FilterBasedDistribution.h"> 368 374 </File> 369 375 <File … … 1059 1065 </File> 1060 1066 <File 1067 RelativePath=".\sparsehash\src\windows\hash_fun.h"> 1068 </File> 1069 <File 1061 1070 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 1062 </File>1063 <File1064 RelativePath=".\sparsehash\src\windows\hash_fun.h">1065 1071 </File> 1066 1072 <File -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2591 r2593 717 717 if (1 && mShowRays) 718 718 { 719 RenderRays(mViewCellsManager->mVizBuffer.GetRays(), mRayVisualizationMethod, mShowDistribution );719 RenderRays(mViewCellsManager->mVizBuffer.GetRays(), mRayVisualizationMethod, mShowDistribution, 1); 720 720 } 721 721 } … … 731 731 if (!mTopView) 732 732 GlRenderer::SetupCamera(); 733 else { 734 if (0) { 733 else 734 { 735 if (0) 736 { 735 737 float dist = Magnitude(mSceneGraph->GetBox().Diagonal())*0.05; 736 738 Vector3 pos = mViewPoint - dist*Vector3(mViewDirection.x, … … 940 942 connect(mControlWidget, SIGNAL(SetShowRays(bool)), this, SLOT(SetShowRays(bool))); 941 943 942 resize(1000, 500); 944 // setting the size here 945 resize(800, 600); 943 946 mControlWidget->show(); 944 947 } … … 1525 1528 const float importance = (vcRatio - minRatio) * scale; 1526 1529 1527 if ( i < 20)1530 if (0 && (i < 20)) 1528 1531 { 1529 1532 cout << "pvs1: " << vc->GetPvs().GetSize() << " pvs2: " << compareInfo[i].mPvsSize << " importance: " << importance << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r2573 r2593 46 46 QSize QtGlViewer::sizeHint() const 47 47 { 48 return QSize( 500, 500);48 return QSize(640, 480); 49 49 } 50 50 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2588 r2593 2735 2735 #endif 2736 2736 2737 bool hasContri = false;2738 2737 // if ray not outside of view space 2739 2738 float relContribution = 0.0f; … … 2746 2745 hasAbsContribution = viewCell->GetPvs().AddSampleDirtyCheck(obj, ray.mPdf); 2747 2746 //hasAbsContribution = viewCell->GetPvs().AddSample(obj,ray.mPdf); 2748 #if MYSTATS2749 2747 2750 2748 if (hasAbsContribution) 2751 2749 { 2752 2750 UpdateStatsForViewCell(viewCell, obj); 2753 hasContri = true; 2754 } 2755 #endif 2756 2751 } 2757 2752 } 2758 2753 else … … 2796 2791 #endif 2797 2792 2798 return has Contri;2793 return hasAbsContribution; 2799 2794 } 2800 2795 -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp
r2176 r2593 68 68 else 69 69 { 70 mTermination = ray.Extrap(1e6); //TODO: should be Limits::Infinity70 mTermination = ray.Extrap(1e6); //TODO: should be Limits::Infinity 71 71 mTerminationObject = NULL; 72 72 } … … 80 80 mFlags = 0; 81 81 Vector3 dir = GetDir(); 82 //mFlags |= BorderSample;83 82 #define BIDIRECTIONAL_RAY 0 84 83 #if BIDIRECTIONAL_RAY -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
r2575 r2593 44 44 int mMailbox; 45 45 46 // side of the ray - used for the ray classification47 // char mSide;48 49 // computed t50 // float mT;51 52 46 // inverse of the ray size 53 47 float mInvSize; … … 76 70 short mPass; 77 71 78 // Distribution used to generate this ray72 /// Distribution used to generate this ray 79 73 short mDistribution; 80 74 81 // number of cells where this ray made a contribution to the PVS75 /// number of cells where this ray made a contribution to the PVS 82 76 int mPvsContribution; 83 77 84 // sum of relative ray contributions per object78 /// sum of relative ray contributions per object 85 79 float mRelativePvsContribution; 86 80 87 // weighted contribution to the pvs (based on the pass the ray was casted at)88 // computed by the prperocessor81 /// weighted contribution to the pvs (based on the pass the ray was casted at) 82 /// computed by the prperocessor 89 83 float mWeightedPvsContribution; 90 84 91 // probability of this ray85 /// probability of this ray 92 86 float mPdf; 93 87 -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2582 r2593 338 338 // $$matt 339 339 preprocessor->renderer = 340 new QtGlRendererBuffer( 1024, 1024,340 new QtGlRendererBuffer(512, 512, 341 341 preprocessor->mSceneGraph, 342 342 preprocessor->mViewCellsManager,
Note: See TracChangeset
for help on using the changeset viewer.