- Timestamp:
- 01/15/07 21:46:52 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r1972 r1983 80 80 mFrame = 0; 81 81 mWireFrame = false; 82 Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 82 Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", 83 mDetectEmptyViewSpace); 83 84 mSnapErrorFrames = true; 84 85 mSnapPrefix = "snap/"; 85 86 mUseForcedColors = false; 86 87 mRenderBoxes = false; 87 mUseGlLists = true;88 //mUseGlLists = false;88 //mUseGlLists = true; 89 mUseGlLists = false; 89 90 90 91 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); … … 683 684 glCallList(leaf->mGlList); 684 685 #else 685 686 686 for (int i=0; i < leaf->mObjects.size(); i++) 687 RenderIntersectable(leaf->mObjects[i]); 687 688 #endif 688 689 } else { … … 1540 1541 } 1541 1542 1542 1543 1544 1545 1546 1547 1548 } 1543 void 1544 GlRenderer::RenderViewPoint() 1545 { 1546 mWireFrame = true; 1547 glPushMatrix(); 1548 glTranslatef(mViewPoint.x, mViewPoint.y, mViewPoint.z); 1549 glScalef(5.0f,5.0f,5.0f); 1550 glPushAttrib(GL_CURRENT_BIT); 1551 glColor3f(1.0f, 0.0f, 0.0f); 1552 gluSphere((::GLUquadric *)mSphere, 1553 1e-3*Magnitude(mViewCellsManager->GetViewSpaceBox().Size()), 6, 6); 1554 glPopAttrib(); 1555 glPopMatrix(); 1556 mWireFrame = false; 1557 } 1558 1559 1560 1561 1562 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1968 r1983 136 136 _RenderScene(); 137 137 138 void 139 RenderViewPoint(); 138 140 139 141 virtual void -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp
r1972 r1983 118 118 #if DEBUG_RAYCAST 119 119 Debug<<"C16 "<<flush; 120 static int counter=0; 121 Debug<<counter++<<endl; 120 122 #endif 121 123 … … 131 133 132 134 for (i=0; i < num; i++) { 135 #if DEBUG_RAYCAST 136 if (counter == 43964) { 137 Debug<<rays[i].mOrigin<<" "<<rays[i].mDirection<<endl; 138 } 139 #endif 133 140 mlrtaStoreRayAS16(&rays[i].mOrigin.x, 134 141 &rays[i].mDirection.x, … … 137 144 138 145 #if DEBUG_RAYCAST 139 146 Debug<<"TA\n"<<flush; 140 147 #endif 141 148 … … 144 151 forward_hit_triangles, 145 152 forward_dist); 146 147 if (castDoubleRay) 148 { 149 for (i=0; i < num; i++) 150 { 151 Vector3 dir = -rays[i].mDirection; 152 mlrtaStoreRayAS16(&rays[i].mOrigin.x, 153 &dir.x, 154 i); 155 } 156 157 #if DEBUG_RAYCAST 158 Debug<<"TB\n"<<flush; 159 #endif 160 161 mlrtaTraverseGroupAS16(&min.x, 162 &max.x, 163 backward_hit_triangles, 164 backward_dist); 153 154 #if DEBUG_RAYCAST 155 Debug<<"TAB\n"<<flush; 156 #endif 157 158 if (castDoubleRay) { 159 for (i=0; i < num; i++) { 160 Vector3 dir = -rays[i].mDirection; 161 mlrtaStoreRayAS16(&rays[i].mOrigin.x, 162 &dir.x, 163 i); 165 164 } 166 165 166 #if DEBUG_RAYCAST 167 Debug<<"TB\n"<<flush; 168 #endif 169 170 mlrtaTraverseGroupAS16(&min.x, 171 &max.x, 172 backward_hit_triangles, 173 backward_dist); 174 } 175 167 176 #if DEBUG_RAYCAST 168 177 Debug<<"BBB\n"<<flush; -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1974 r1983 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: ne 14. I 01:57:1520073 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 15. I 15:33:12 2007 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r1967 r1983 338 338 ViewCell *viewcell = NULL; 339 339 340 PrVs prvs; 341 342 if (1 || !mUseFilter) { 343 viewcell = mViewCellsManager->GetViewCell(mViewPoint, true); 344 } else { 345 // mViewCellsManager->SetMaxFilterSize(1); 346 mViewCellsManager->GetPrVS(mViewPoint, prvs, mViewCellsManager->GetFilterWidth()); 347 viewcell = prvs.mViewCell; 348 } 340 if (mDetectEmptyViewSpace) 341 glEnable( GL_CULL_FACE ); 342 else 343 glDisable( GL_CULL_FACE ); 344 345 viewcell = mViewCellsManager->GetViewCell(mViewPoint, true); 349 346 350 347 if (viewcell) { … … 379 376 } 380 377 378 Intersectable::NewMail(); 379 381 380 // Render PVS 382 381 if (mUseSpatialFilter && mRenderBoxes) { 383 384 382 for (int i=0; i < mPvsCache.filteredBoxes.size(); i++) 383 RenderBox(mPvsCache.filteredBoxes[i]); 385 384 } else { 386 ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 385 ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 386 387 mPvsSize = mPvsCache.mPvs.GetSize(); 388 for (; it.HasMoreEntries(); ) { 389 ObjectPvsEntry entry = it.Next(); 390 Intersectable *object = entry.mObject; 387 391 388 mPvsSize = mPvsCache.mPvs.GetSize(); 389 for (; it.HasMoreEntries(); ) { 390 ObjectPvsEntry entry = it.Next(); 391 Intersectable *object = entry.mObject; 392 393 if (mRenderVisibilityEstimates) { 394 395 float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 396 glColor3f(visibility, 0.0f, 0.0f); 397 mUseForcedColors = true; 398 RenderIntersectable(object); 399 mUseForcedColors = false; 400 } else { 401 mUseForcedColors = false; 402 RenderIntersectable(object); 403 } 392 if (mRenderVisibilityEstimates) { 393 float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 394 glColor3f(visibility, 0.0f, 0.0f); 395 mUseForcedColors = true; 396 RenderIntersectable(object); 397 mUseForcedColors = false; 398 } else { 399 mUseForcedColors = false; 400 RenderIntersectable(object); 404 401 } 402 } 405 403 } 406 404 407 405 if (mRenderFilter) { 408 406 mWireFrame = true; … … 413 411 glPushAttrib(GL_CURRENT_BIT); 414 412 glColor3f(1.0f, 0.0f, 0.0f); 415 gluSphere((::GLUquadric *)mSphere,416 413 // gluSphere((::GLUquadric *)mSphere, 414 // 1e-3*Magnitude(mViewCellsManager->GetViewSpaceBox().Size()), 6, 6); 417 415 glPopAttrib(); 418 416 glPopMatrix(); 419 417 mWireFrame = false; 420 418 } 421 422 if (0 && mUseFilter)423 mViewCellsManager->DeleteLocalMergeTree(viewcell);424 425 419 } else { 426 427 428 420 ObjectContainer::const_iterator oi = mObjects.begin(); 421 for (; oi != mObjects.end(); oi++) 422 RenderIntersectable(*oi); 429 423 } 430 424 } … … 625 619 RenderPvs(); 626 620 } 627 628 621 } 629 622 … … 947 940 if (mViewCellsManager) 948 941 vc = mViewCellsManager->GetViewCells().size(); 942 949 943 int filter = 0; 950 944 if (mViewCellsManager) … … 985 979 if (mViewCellsManager) { 986 980 // mViewCellsManager->SetMaxFilterSize(number); 987 mViewCellsManager->CollectViewCells(number); 981 982 // $$ tmp off 983 mViewCellsManager->CollectViewCells(number); 988 984 989 985 // $$ does not work so far:( -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r1972 r1983 54 54 55 55 mRenderer->RenderPvs(); 56 57 mRenderer->RenderViewPoint(); 58 56 59 57 60 // if (mRenderer->mShowRays) { -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.h
r1969 r1983 11 11 class QtGlViewer : public QGLWidget 12 12 { 13 //Q_OBJECT13 Q_OBJECT 14 14 15 15 friend class QtGlRendererWidget; -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r1976 r1983 10 10 11 11 namespace GtpVisibilityPreprocessor { 12 13 #define MUTATION_USE_CDF 0 12 14 13 15 … … 729 731 730 732 float pContributingRays = contributingRays/(float)vssRays.size(); 731 float importance = 1.0f/(pContributingRays + 1e-5);733 float importance = sqr(1.0f/(pContributingRays + 1e-5)); 732 734 // set this values for last contributingRays 733 735 int index = mBufferStart - 1; … … 739 741 } 740 742 741 743 #if MUTATION_USE_CDF 742 744 // compute cdf 743 745 mRays[0].mCdf = mRays[0].mImportance/(mRays[0].mSamples+1); … … 749 751 mRays[i].mCdf *= scale; 750 752 } 751 753 #endif 754 752 755 cout<<"Importance = "<< 753 756 GetEntry(0).mImportance<<" "<< … … 888 891 889 892 int index; 890 #if 1 893 894 #if !MUTATION_USE_CDF 891 895 // get tail of the buffer 892 896 index = (mLastIndex+1)%mRays.size(); -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h
r1974 r1983 5 5 using namespace std; 6 6 7 #include "common.h" 7 8 #include "Halton.h" 8 9 namespace GtpVisibilityPreprocessor { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1982 r1983 80 80 81 81 mViewCellsTree->SetViewCellsManager(this); 82 mSamplesStat.Reset(); 82 83 } 83 84 … … 2076 2077 stat.avgPvs/=stat.viewcells; 2077 2078 stat.avgPvsEntries/=stat.viewcells; 2079 stat.avgFilteredPvsEntries/=stat.viewcells; 2078 2080 stat.avgFilteredPvs/=stat.viewcells; 2079 2081 stat.avgFilterContribution/=stat.viewcells; … … 2109 2111 s<<"#AVG_REL_PVS_INCREASE\n"<<pvsStat.avgRelPvsIncrease<<endl; 2110 2112 s<<"#DEV_REL_PVS_INCREASE\n"<<pvsStat.devRelPvsIncrease<<endl; 2113 2114 s<<"#CONTRIBUTING_RAYS\n"<<mSamplesStat.mContributingRays<<endl; 2115 2116 if (mSamplesStat.mRays) { 2117 s<<"#AVG_VIEWCELLS_PER_RAY\n"<<mSamplesStat.mViewCells/(float)mSamplesStat.mRays<<endl; 2118 } else { 2119 s<<"#AVG_VIEWCELLS_PER_RAY\n 1 \n"; 2120 } 2121 mSamplesStat.Reset(); 2111 2122 } 2112 2123 … … 2329 2340 ray.mRelativePvsContribution = 0.0f; 2330 2341 2342 mSamplesStat.mRays++; 2343 2331 2344 if (!ray.mTerminationObject) 2332 2345 return 0.0f; … … 2352 2365 CastLineSegment(origin, termination, viewCells); 2353 2366 2354 2367 mSamplesStat.mViewCells+=viewCells.size(); 2368 2355 2369 if (storeViewCells) 2356 2370 { … … 2379 2393 } 2380 2394 2395 mSamplesStat.mPvsContributions += ray.mPvsContribution; 2396 if (ray.mPvsContribution) 2397 mSamplesStat.mContributingRays++; 2398 2381 2399 #if AVG_RAY_CONTRIBUTIONS 2382 2400 ray.mRelativePvsContribution /= (float)viewCells.size(); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1982 r1983 81 81 { 82 82 public: 83 83 84 84 struct PerViewCellStat { 85 85 float pvsSize; 86 86 float relPvsIncrease; 87 87 }; 88 88 89 struct SamplesStatistics { 90 int mRays; 91 int mViewCells; 92 int mContributingRays; 93 int mPvsContributions; 94 void Reset() { 95 mRays = 0; 96 mViewCells = 0; 97 mContributingRays = 0; 98 mPvsContributions = 0; 99 }; 100 }; 101 89 102 struct PvsStatistics 90 103 { … … 811 824 812 825 vector<PerViewCellStat> mPerViewCellStat; 813 826 SamplesStatistics mSamplesStat; 814 827 }; 815 828 -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1974 r1983 172 172 maxCostRatio 0.98 173 173 ct_div_ci 0.5 174 maxNodes 500000174 maxNodes 200000 175 175 #500000 176 176 } … … 205 205 206 206 #number of active view cells 207 active 20000 208 maxViewCells 20000 207 active 200000 208 maxViewCells 200000 209 209 210 210 maxStaticMemory 40 -
GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
r1974 r1983 111 111 Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp \ 112 112 Mailable.cpp \ 113 CombinedPreprocessor.cpp Vector2.cpp 113 CombinedPreprocessor.cpp Vector2.cpp GlobalLinesRenderer.cpp \ 114 RenderTexture.cpp 114 115 115 116 SOURCES += BoostPreprocessorThread.cpp
Note: See TracChangeset
for help on using the changeset viewer.