Changeset 2633 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 01/23/08 01:38:11 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2622 r2633 1780 1780 1781 1781 KdNode::NewMail(); 1782 //Intersectable::NewMail(); 1783 1784 1782 1785 1783 ObjectPvsIterator it = pvs.GetIterator(); 1786 1784 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2625 r2633 17 17 { 18 18 19 #define GVS_DEBUG 119 #define GVS_DEBUG 0 20 20 21 21 struct VizStruct … … 37 37 mCurrentViewCell(NULL), 38 38 mCurrentViewPoint(Vector3(0.0f, 0.0f, 0.0f)) 39 //,mGenericStats(0) 39 40 { 40 41 Environment::GetSingleton()->GetIntValue("GvsPreprocessor.totalSamples", mTotalSamples); … … 219 220 return false; 220 221 222 // cout << "t"; 221 223 if (0 && GVS_DEBUG) 222 224 mVssRays.push_back(new VssRay(*vssRay)); … … 592 594 593 595 //CLEAR_CONTAINER(invalidSamples); 594 Debug << "generated " << numSamples << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl;596 //Debug << "generated " << numSamples << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 595 597 return (int)simpleRays.size(); 596 598 } … … 606 608 607 609 HandleRay(ray); 608 609 //if (!HandleRay(ray)); 610 // invalidSamples.push_back(ray); 610 //if (!HandleRay(ray)) invalidSamples.push_back(ray); 611 611 } 612 612 } … … 675 675 676 676 677 //void GvsPreprocessor::VisualizeViewCell(ViewCell *vc)678 677 void GvsPreprocessor::VisualizeViewCell(const ObjectContainer &objects) 679 678 { 680 679 Intersectable::NewMail(); 681 682 680 Material m; 683 681 … … 760 758 int passSamples = 0; 761 759 762 //if (mCurrentViewCell->GetId() != 82975 )return;760 mGenericStats = 0; 763 761 764 762 //while (mGvsStats.mPerViewCellSamples < mTotalSamples) … … 789 787 cout << "\nPass " << mPass << " #samples: " << mGvsStats.mPerViewCellSamples << endl; 790 788 cout << "contribution=" << mGvsStats.mPassContribution << " (of " << mMinContribution << ")" << endl; 789 790 //mGenericStats = GvsStats.mGvsStats.mPassContribution; 791 791 792 792 // termination criterium … … 964 964 } 965 965 966 /*967 void GvsPreprocessor::ComputeRenderError()968 {969 cout << "computing gvs render error" << endl;970 vector<ViewCellPoints *> *vcPoints = mViewCellsManager->GetViewCellPoints();971 972 vector<ViewCellPoints *>::const_iterator vit, vit_end = vcPoints->end();973 974 for (vit = vcPoints->begin(); vit != vit_end; ++ vit)975 {976 ViewCellPoints *vcPoints = *vit;977 978 renderer->EvalPvsStat(vcPoints->second);979 980 mStats <<981 "#ViewCell\n" << vcPoints->first->GetId() << endl <<982 "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError() << endl <<983 "#AvgPixelError\n" << renderer->GetAvgPixelError() << endl <<984 "#MaxPixelError\n" << renderer->GetMaxPixelError() << endl <<985 "#MaxPvsRenderError\n" << renderer->mPvsStat.GetMaxError() << endl <<986 "#ErrorFreeFrames\n" << renderer->mPvsStat.GetErrorFreeFrames() << endl <<987 "#AvgRenderPvs\n" << renderer->mPvsStat.GetAvgPvs() << endl;988 }989 }990 */991 966 992 967 void GvsPreprocessor::UpdatePvs(ViewCell *currentViewCell) … … 1300 1275 mGvsStats.mTotalTime += mGvsStats.mTimePerViewCell; 1301 1276 1302 //lastTime = currentTime;1303 1304 1277 mGvsStats.Stop(); 1305 1278 mGvsStats.Print(mGvsStatsStream); -
GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h
r2530 r2633 150 150 151 151 inline int GetSamples() const { return mSamples; } 152 }153 152 154 153 void MergeInPlace(const HashPvs<T, S> &a) 155 154 { 156 cerr << "hashpvs: mergeinplace not implemented yet" <<endl;155 std::cerr << "hashpvs: mergeinplace not implemented yet" << std::endl; 157 156 } 158 157 159 158 inline bool RequiresResortLog() const { return false; } 160 159 161 void Reserve(const int n) { // not necessary } 160 void Reserve(const int n) 161 { // not necessary 162 } 162 163 163 164 /** Sort pvs entries assume that the pvs contains unique entries 164 165 */ 165 void SimpleSort() { // not necessary } 166 void SimpleSort() 167 { // not necessary 168 } 166 169 167 170 int SubtractPvs(const HashPvs<T, S> &pvs) -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2625 r2633 273 273 274 274 275 int mGenericStats; 276 275 277 protected: 276 278 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2621 r2633 126 126 OptimizeForWindowsApplication="TRUE" 127 127 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";"$(CG_INC_PATH)";Timer;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\cpp\include\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src\cpp\include\ootl\mswin;..\src\havran" 128 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_ VERBOSE_PVS;USE_CG"128 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_HASH_PVS;USE_CG" 129 129 StringPooling="TRUE" 130 130 MinimalRebuild="TRUE" … … 1074 1074 </File> 1075 1075 <File 1076 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 1077 </File> 1078 <File 1076 1079 RelativePath=".\sparsehash\src\windows\hash_fun.h"> 1077 </File>1078 <File1079 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h">1080 1080 </File> 1081 1081 <File -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2627 r2633 304 304 GlRenderer::InitGL(); 305 305 306 GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 307 GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 308 GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0}; 309 GLfloat light_position[] = //{278.0f, 548.8f,279.0f, 1.0f }; 310 { 0.f,0.f,0.f,1.0f }; 311 312 /*glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 313 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 314 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 315 glLightfv(GL_LIGHT0, GL_POSITION, light_position); 316 */ 317 glEnable(GL_LIGHT0); 318 306 319 GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f}; 307 320 … … 311 324 GLfloat mat_shininess[] = {1.0f}; 312 325 313 GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};326 /* GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f}; 314 327 GLfloat light_diffuse[] = {0.4f, 0.4f, 0.4f, 1.0f}; 315 328 GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 316 329 317 330 GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 318 331 */ 319 332 320 333 // default Material … … 329 342 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 330 343 331 glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient);344 /*glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 332 345 glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); 333 346 glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); 334 335 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);347 */ 348 //glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 336 349 337 350 glEnable(GL_LIGHTING); 338 351 glEnable(GL_LIGHT0); 339 glEnable(GL_LIGHT1);352 // glEnable(GL_LIGHT1); 340 353 341 354 // set position of the light 342 GLfloat infinite_light[] = { 1.0, 0.8, 1.0, 0.0 };355 /*GLfloat infinite_light[] = { 1.0, 0.8, 1.0, 0.0 }; 343 356 glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); 344 357 … … 346 359 GLfloat infinite_light2[] = { -0.3, 1.5, 1.0, 0.0 }; 347 360 glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 361 */ 362 glLightfv (GL_LIGHT0, GL_POSITION, light_position); 348 363 349 364 glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); … … 351 366 glEnable(GL_COLOR_MATERIAL); 352 367 353 glShadeModel(GL_ FLAT);368 glShadeModel(GL_SMOOTH); 354 369 } 355 370 … … 392 407 void QtGlRendererWidget::_RenderPvs() 393 408 { 394 395 #if TEST_PVS_RENDERING 396 397 ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 398 399 int pvsSize = mPvsCache.mPvs.GetSize(); 400 401 Intersectable::NewMail(); 402 mCurrentFrame++; 403 while (it.HasMoreEntries()) 404 { 405 RenderIntersectable(it.Next()); 406 } 407 408 409 return; 410 #endif 411 412 mUseFalseColors = false; 409 mUseFalseColors = false; 413 410 414 411 int offset = (int)mObjects.size() * 3; … … 436 433 437 434 438 void QtGlRendererWidget::PreparePvs ()435 void QtGlRendererWidget::PreparePvs2(const ObjectPvs &pvs) 439 436 { 440 437 int indexBufferSize = 0; … … 443 440 //Intersectable::NewMail(); 444 441 445 mPvsSize = mPvsCache.mPvs.GetSize(); 442 mPvsSize = pvs.GetSize(); 443 446 444 #if DYNAMIC_OBJECTS_HACK 447 445 mDynamicObjects.clear(); 448 446 #endif 449 ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 447 448 ObjectPvsIterator it = pvs.GetIterator(); 450 449 451 450 while (it.HasMoreEntries()) … … 492 491 493 492 EnableDrawArrays(); 494 495 493 //Intersectable::NewMail(); 496 494 … … 505 503 if (viewcell) 506 504 { 505 #if 1 507 506 // copy the pvs so that it can be filtered ... 508 507 if (PvsChanged(viewcell)) … … 524 523 //mPvsCache.mPvs = pvs; 525 524 //mMutex.unlock(); 526 cout << "pvs size: " << mPvsCache.mPvs.GetSize() << endl;525 //cout << "pvs size: " << mPvsCache.mPvs.GetSize() << endl; 527 526 } 528 527 else … … 530 529 mPvsCache.mPvs = viewcell->GetPvs(); 531 530 } 532 533 // /update the indices for rendering534 PreparePvs ();535 531 532 // update the indices for rendering 533 PreparePvs2(mPvsCache.mPvs); 534 536 535 emit PvsUpdated(); 537 536 } 537 #else 538 PreparePvs2(viewcell->GetPvs()); 539 emit PvsUpdated(); 540 #endif 538 541 539 542 … … 898 901 ) 899 902 : 900 GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget( parent, shareWidget, f)903 GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget(QGLFormat(QGL::SampleBuffers), parent, shareWidget, f) 901 904 { 902 905 mPreprocessorThread = NULL; … … 910 913 mRenderFilter = true; 911 914 mRenderVisibilityEstimates = false; 915 //mRenderVisibilityEstimates = true; 912 916 913 917 mUseRandomColorPerPvsObject = false; … … 918 922 mTransferFunction = 1.0f; 919 923 mIndexBufferSize = 0; 920 921 //mCurrentFrame = 0;922 924 923 925 const int delay = 250; // in milliseconds … … 956 958 mShowRays = false; 957 959 960 SetSceneCut(0); 958 961 mControlWidget = new QtRendererControlWidget(NULL); 959 962 … … 1242 1245 s.sprintf("PVS: %04d", mPvsSize); 1243 1246 renderText(20, 40, s, font40); 1247 1248 /* QFont font40; font40.setPointSize(30); 1249 s.sprintf("New triangles: %04d", 100); 1250 renderText(200, 40, s, font40);*/ 1244 1251 } 1245 1252 … … 1362 1369 float renderCost = 0; 1363 1370 1364 #if ndef USE_BIT_PVS1371 #ifdef USE_VERBOSE_PVS 1365 1372 if (mShowDistanceWeightedPvs) 1366 1373 { … … 1461 1468 1462 1469 ComputeMaxValues(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 1470 1463 1471 // matt: temp hack 1464 maxRcCost = 200.0f;1472 //maxRcCost = 5000.0f; 1465 1473 //cout << "maxRcCost: " << maxRcCost << endl; 1474 1466 1475 int i; 1467 1476 … … 1982 1991 1983 1992 1984 1985 1993 cb = new QCheckBox("Cut view cells", vbox); 1986 1994 vbox->layout()->addWidget(cb); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2621 r2633 538 538 } 539 539 540 void PreparePvs ();540 void PreparePvs2(const ObjectPvs &pvs); 541 541 542 542 void _RenderPvs(); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface.vcproj
r2576 r2633 165 165 <Tool 166 166 Name="VCCLCompilerTool" 167 AdditionalIncludeDirectories="..\..\src;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\..\..\..\..\..\..\NonGTP\Zlib\include;"$(CG_INC_PATH)" "168 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_ VERBOSE_PVS;USE_QT;USE_CG;GTP_INTERNAL"167 AdditionalIncludeDirectories="..\..\src;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\..\..\..\..\..\..\NonGTP\Zlib\include;"$(CG_INC_PATH)";..\..\src\sparsehash\src;..\..\src\sparsehash\src\google;..\..\src\sparsehash\src\windows;..\..\src\sparsehash\src\google\sparsehash" 168 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_HASH_PVS;USE_QT;USE_CG;GTP_INTERNAL" 169 169 RuntimeLibrary="2" 170 170 UsePrecompiledHeader="0" -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r2598 r2633 145 145 OptimizeForWindowsApplication="TRUE" 146 146 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(QTDIR)\include\QtOpenGl";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtCore";"$(QTDIR)\include";QtInterface;..\src\sparsehash\src\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;$(NOINHERIT)" 147 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_ VERBOSE_PVS;QT_OPENGL_LIB;QT_DLL"147 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_HASH_PVS;QT_OPENGL_LIB;QT_DLL" 148 148 StringPooling="TRUE" 149 149 MinimalRebuild="TRUE" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2627 r2633 2406 2406 2407 2407 const int numTriangles = kdObj->ComputeNumTriangles(); 2408 #if ndef USE_BIT_PVS2408 #ifdef USE_VERBOSE_PVS 2409 2409 vc->GetPvs().mStats.mDistanceWeightedTriangles += f * numTriangles; 2410 2410 vc->GetPvs().mStats.mDistanceWeightedPvs += f ;
Note: See TracChangeset
for help on using the changeset viewer.