- Timestamp:
- 01/24/07 04:11:29 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
r2048 r2049 33 33 34 34 } 35 35 36 36 37 37 38 bool … … 129 130 ComputeRenderError(); 130 131 } 132 } 131 133 132 if (mTotalTime!= -1 && time/1000 > mTotalTime)133 break;134 }134 long time = TimeDiff(startTime, GetTime()); 135 if (mTotalTime!= -1 && time/1000 > mTotalTime) 136 break; 135 137 136 138 #if 0 -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2048 r2049 92 92 //mUseGlLists = false; 93 93 94 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); 94 if (mViewCellsManager->GetViewCellPoints()->size()) 95 mPvsStatFrames = mViewCellsManager->GetViewCellPoints()->size(); 96 else 97 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); 98 99 95 100 mPvsErrorBuffer.resize(mPvsStatFrames); 96 101 ClearErrorBuffer(); 97 98 102 } 99 103 … … 861 865 { 862 866 MakeCurrent(); 863 867 864 868 GlRenderer::EvalPvsStat(); 865 869 866 870 DoneCurrent(); 867 871 // mRenderingFinished.wakeAll(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2042 r2049 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: út 23. I 16:04:4520073 # Generated by qmake (2.00a) (Qt 4.1.2) on: út 23. I 21:53:49 2007 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 63 63 $(MAKE) -f $(MAKEFILE).Debug uninstall 64 64 65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc 2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc.net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 66 66 C:\Qt\4.1.2\mkspecs\features\qt_config.prf \ 67 67 C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \ -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2048 r2049 1456 1456 // renderer->mRenderingFinished.wait(&mutex); 1457 1457 // mutex.unlock(); 1458 1459 renderer->EvalPvsStat(); 1460 1458 1459 if (mViewCellsManager->GetViewCellPoints()->size()) { 1460 1461 vector<ViewCellPoints *> *vcPoints = mViewCellsManager->GetViewCellPoints(); 1462 1463 vector<ViewCellPoints *>::const_iterator vit, vit_end = vcPoints->end(); 1464 SimpleRayContainer viewPoints; 1465 1466 for (vit = vcPoints->begin(); vit != vit_end; ++ vit) { 1467 ViewCellPoints *vp = *vit; 1468 1469 SimpleRayContainer::const_iterator rit = vp->second.begin(), rit_end = vp->second.end(); 1470 for (; rit!=rit_end; ++rit) 1471 viewPoints.push_back(*rit); 1472 } 1473 1474 renderer->EvalPvsStat(viewPoints); 1475 } else 1476 renderer->EvalPvsStat(); 1477 1461 1478 mStats << 1462 1479 "#AvgPvsRenderError\n" <<renderer->mPvsStat.GetAvgError()<<endl<< -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2048 r2049 96 96 unsigned int pixelCount; 97 97 98 98 99 99 ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 100 100 101 if (viewcell == NULL) 101 102 return 0.0f; … … 166 167 167 168 168 if ( mSnapErrorFrames && pErrorPixels >= 0.01f) {169 if (0 && mSnapErrorFrames && pErrorPixels >= 0.01f) { 169 170 170 171 char filename[256]; … … 448 449 { 449 450 float pErrorPixels = -1.0f; 450 451 glReadBuffer(GL_BACK); 452 453 mUseFalseColors = true; 454 455 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 456 457 double eq[4]; 458 eq[0] = mSceneCutPlane.mNormal.x; 459 eq[1] = mSceneCutPlane.mNormal.y; 460 eq[2] = mSceneCutPlane.mNormal.z; 461 eq[3] = mSceneCutPlane.mD; 462 463 if (mCutScene) { 464 glClipPlane(GL_CLIP_PLANE0, eq); 465 glEnable(GL_CLIP_PLANE0); 466 } 467 468 if (mDetectEmptyViewSpace) 469 glEnable( GL_CULL_FACE ); 470 else 471 glDisable( GL_CULL_FACE ); 472 473 ObjectContainer::const_iterator oi = mObjects.begin(); 474 for (; oi != mObjects.end(); oi++) 475 RenderIntersectable(*oi); 476 477 ViewCell *viewcell = NULL; 478 479 QImage im1, im2; 480 QImage diff; 481 482 if (viewcell) { 483 // read back the texture 484 im1 = grabFrameBuffer(true); 485 486 RenderPvs(); 487 488 // read back the texture 489 im2 = grabFrameBuffer(true); 490 491 diff = im1; 492 int x, y; 493 int errorPixels = 0; 494 495 for (y = 0; y < im1.height(); y++) 496 for (x = 0; x < im1.width(); x++) 497 if (im1.pixel(x, y) == im2.pixel(x, y)) 498 diff.setPixel(x, y, qRgba(0,0,0,0)); 499 else { 500 diff.setPixel(x, y, qRgba(255,128,128,255)); 501 errorPixels++; 502 } 503 pErrorPixels = ((float)errorPixels)/(im1.height()*im1.width()); 504 } 505 506 // now render the pvs again 451 507 452 SetupCamera(); 508 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 509 mUseFalseColors = false; 510 511 oi = mObjects.begin(); 512 for (; oi != mObjects.end(); oi++) 513 RenderIntersectable(*oi); 514 515 // now render im1 516 if (viewcell) { 517 if (0 && mTopView) { 518 mWireFrame = true; 519 RenderIntersectable(viewcell); 520 mWireFrame = false; 521 } 522 523 // init ortographic projection 524 glMatrixMode(GL_PROJECTION); 525 glPushMatrix(); 526 527 glLoadIdentity(); 528 gluOrtho2D(0, 1.0f, 0, 1.0f); 529 530 glMatrixMode(GL_MODELVIEW); 531 glLoadIdentity(); 532 533 bindTexture(diff); 534 535 glPushAttrib(GL_ENABLE_BIT); 536 glEnable( GL_ALPHA_TEST ); 537 glDisable( GL_CULL_FACE ); 538 glAlphaFunc( GL_GREATER, 0.5 ); 539 540 glEnable( GL_TEXTURE_2D ); 541 glBegin(GL_QUADS); 542 543 glTexCoord2f(0,0); 544 glVertex3f(0,0,0); 545 546 glTexCoord2f(1,0); 547 glVertex3f( 1, 0, 0); 548 549 glTexCoord2f(1,1); 550 glVertex3f( 1, 1, 0); 551 552 glTexCoord2f(0,1); 553 glVertex3f(0, 1, 0); 554 glEnd(); 555 556 glPopAttrib(); 557 558 // restore the projection matrix 559 glMatrixMode(GL_PROJECTION); 560 glPopMatrix(); 561 glMatrixMode(GL_MODELVIEW); 562 } 563 564 glDisable(GL_CLIP_PLANE0); 565 453 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 454 455 glPushAttrib(GL_ENABLE_BIT); 456 457 glStencilFunc(GL_EQUAL, 0x0, 0x1); 458 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 459 460 mUseForcedColors = true; 461 462 glColor3f(0.0f, 0.8f, 0.2f); 463 464 // // Render PVS 465 RenderPvs(); 466 467 glEnable(GL_STENCIL_TEST); 468 469 // mUseFalseColors = true; 470 471 glDisable(GL_LIGHTING); 472 473 OcclusionQuery *query = mOcclusionQueries[0]; 474 query->BeginQuery(); 475 476 SetupCamera(); 477 478 glColor3f(1.0f, 0.0f, 0.0f); 479 480 RenderScene(); 481 482 mUseForcedColors = false; 483 484 query->EndQuery(); 485 486 glDisable(GL_STENCIL_TEST); 487 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 488 489 glPopAttrib(); 490 491 // reenable other state 492 // int wait=0; 493 // while (!query.ResultAvailable()) { 494 // wait++; 495 // } 496 497 int pixelCount = query->GetQueryResult(); 498 pErrorPixels = ((float)pixelCount)/(GetWidth()*GetHeight()); 499 cout<<"error pixels="<<pixelCount<<endl; 500 566 501 mRenderError = pErrorPixels; 502 567 503 return pErrorPixels; 568 504 } … … 719 655 if (!ok) 720 656 break; 657 721 658 if (sscanf(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) { 722 updateGL(); 659 text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z); 660 text = QInputDialog::getText(this, 661 "Enter a direction", 662 "", 663 QLineEdit::Normal, 664 text, 665 &ok); 666 if (!ok) 667 break; 668 if (sscanf(text.toAscii(), "%f %f %f", &mViewDirection.x, 669 &mViewDirection.y, &mViewDirection.z) == 3) { 670 updateGL(); 671 } 672 break; 723 673 } 724 break;725 674 } 726 675 default: … … 1058 1007 1059 1008 glEnable(GL_CULL_FACE); 1060 //glDisable(GL_CULL_FACE);1061 1009 glCullFace(GL_FRONT); 1010 1011 glDisable(GL_CULL_FACE); 1062 1012 double eq[4]; 1063 1013 eq[0] = mSceneCutPlane.mNormal.x; … … 1089 1039 // Mesh *m = vc->GetMesh(); 1090 1040 1091 1092 1041 RgbColor c; 1093 1042 … … 1097 1046 } else { 1098 1047 // const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 1099 const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().GetSize() / (float)maxPvs); 1048 const float importance = 5.0f*mTransferFunction * 1049 ((float)vc->GetPvs().GetSize() / (float)maxPvs); 1100 1050 c = RgbColor(importance, 1.0f - importance, 0.0f); 1101 1051 } -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r2046 r2049 175 175 } 176 176 177 if (mTotalTime != -1 && time/1000 > mTotalTime)178 break;179 177 } 178 179 long time = TimeDiff(startTime, GetTime()); 180 if (mTotalTime != -1 && time/1000 > mTotalTime) 181 break; 182 180 183 } 181 184 if (0) { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
r2048 r2049 1461 1461 } 1462 1462 1463 // cout<<"parsing started"<<endl<<flush;1463 // cout<<"parsing started"<<endl<<flush; 1464 1464 1465 1465 // … … 1508 1508 #endif 1509 1509 1510 if ( PVS_HACK)1510 if (0 && PVS_HACK) 1511 1511 handler.ExchangeElements(); 1512 1512 -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r2011 r2049 199 199 200 200 ViewCells { 201 importRandomViewCells true 202 201 203 useKdPvs true 202 204 useKdPvsAfterFiltering true -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2048 r2049 212 212 213 213 const string externKdTree = ReplaceSuffix(filename, ".obj", ".kdf"); 214 const string internKdTree = GetInternFilename(filename, preprocessor->mLoadMeshes ? ".kdm" : ".kdt"); 214 const string internKdTree = GetInternFilename(filename, preprocessor->mLoadMeshes ? 215 ".kdm" : ".kdt"); 215 216 216 217 if (preprocessor->InitRayCast(externKdTree, internKdTree)) … … 260 261 else 261 262 { 263 262 264 const string objname = GetInternFilename(filename, ".obj"); 263 265 … … 265 267 bool success = preprocessor->ExportObj(objname, preprocessor->mObjects); 266 268 269 267 270 if (success) 268 271 { … … 342 345 343 346 bool guiSupported = false; 344 347 348 bool useRendererBuffer = true; 349 350 int frames; 351 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames); 352 353 354 #ifdef USE_QT 355 356 if (importRandomViewCells || frames) 357 { 358 QGLFormat f; 359 f.setStencil(true); 360 QGLFormat::setDefaultFormat(f); 361 362 // NOTE: render texture should be power of 2 and square 363 // renderer must be initialised 364 // $$matt 365 preprocessor->renderer = 366 new QtGlRendererBuffer(1024, 1024, 367 preprocessor->mSceneGraph, 368 preprocessor->mViewCellsManager, 369 preprocessor->mKdTree); 370 } 371 #endif 372 345 373 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 346 {374 { 347 375 #ifdef USE_QT 348 376 cout << "using gl widget" << endl; … … 355 383 if (!rendererWidget) 356 384 { 357 if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 358 QMessageBox::information(0, "OpenGL pbuffers", 359 "This system does not support OpenGL/pbuffers.", 360 QMessageBox::Ok); 361 return NULL; 385 386 if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 387 QMessageBox::information(0, "OpenGL pbuffers", 388 "This system does not support OpenGL/pbuffers.", 389 QMessageBox::Ok); 390 return NULL; 362 391 } 363 392 364 rendererWidget = 365 new QtGlRendererWidget(preprocessor->mSceneGraph, 366 preprocessor->mViewCellsManager, 367 preprocessor->mKdTree); 368 369 rendererWidget->Show(); 370 371 QtGlViewer *viewer = 372 new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget); 373 374 viewer->show(); 375 guiSupported = true; 376 } 377 378 int frames; 379 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames); 380 381 if (1)//frames) 382 { 383 // NOTE: render texture should be power of 2 and square 384 // renderer must be initialised 385 // $$matt 386 preprocessor->renderer = 387 new QtGlRendererBuffer(1024, 1024, 388 preprocessor->mSceneGraph, 389 preprocessor->mViewCellsManager, 390 preprocessor->mKdTree); 391 } 392 393 rendererWidget = 394 new QtGlRendererWidget(preprocessor->mSceneGraph, 395 preprocessor->mViewCellsManager, 396 preprocessor->mKdTree); 397 398 rendererWidget->Show(); 399 400 QtGlViewer *viewer = 401 new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget); 402 403 viewer->show(); 404 guiSupported = true; 405 } 406 407 393 408 bool exportRandomViewCells; 394 409 Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells", … … 410 425 preprocessor->ComputeRenderError(); 411 426 }*/ 412 427 413 428 qApp->exec(); 414 429 #endif -
GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
r2042 r2049 47 47 } 48 48 49 win32:LIBS += devil.lib ilu.lib ilut.lib glew32.lib zlib.lib zdll.lib zziplibd.lib 49 win32:LIBS += devil.lib ilu.lib ilut.lib glew32.lib zlib.lib 50 51 #zdll.lib 52 #zziplibd.lib 50 53 51 54 CONFIG(release) { -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
r2039 r2049 31 31 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 32 32 33 PREFIX=../work/plots/osp- 1e533 PREFIX=../work/plots/osp-TEST-1e5 34 34 35 35 #SCENE=../data/atlanta/atlanta2.x3d -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test_pompeii
r2043 r2049 10 10 PREFIX=../work/plots/osp-pompeii4-1e5 11 11 12 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 13 -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \ 14 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4n.xml \ 15 -preprocessor_stats=$PREFIX-i-mixed-b1-n4n.log \ 16 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4n.hlog 12 13 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 14 # -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \ 15 # -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4n.xml \ 16 # -preprocessor_stats=$PREFIX-i-mixed-b1-n4n.log \ 17 # -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4n.hlog 17 18 18 19 # # n - no origin mutation, q=2, reverse samples -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test_powerplant
r2022 r2049 2 2 3 3 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace -"4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -preprocessor_detect_empty_viewspace+ -total_samples=500000000" 5 5 6 6 … … 12 12 13 13 14 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \15 -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \16 -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \17 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \18 -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \19 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog14 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 15 # -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \ 16 # -view_cells_use_kd_pvs+ -af_use_kd_pvs+ \ 17 # -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 18 # -preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 19 # -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog 20 20 21 21 # n - no origin mutation, q=2, reverse samples 22 22 23 #$COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \24 #-preprocessor_visibility_file=$PREFIX-r-reference.xml \25 #-view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \26 #-preprocessor_histogram_file=$PREFIX-r-reference.hlog23 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 24 -preprocessor_visibility_file=$PREFIX-r-reference.xml \ 25 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \ 26 -preprocessor_histogram_file=$PREFIX-r-reference.hlog 27 27 28 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \29 #-rss_distributions=direction -view_cells_filter_max_size=1 \30 #-preprocessor_visibility_file=$PREFIX-r-reference-global.xml \31 #-preprocessor_stats=$PREFIX-r-reference-global.log \32 #-preprocessor_histogram_file=$PREFIX-r-reference-global.hlog28 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 29 -rss_distributions=direction -view_cells_filter_max_size=1 \ 30 -preprocessor_visibility_file=$PREFIX-r-reference-global.xml \ 31 -preprocessor_stats=$PREFIX-r-reference-global.log \ 32 -preprocessor_histogram_file=$PREFIX-r-reference-global.hlog 33 33 34 34 #mutation+object_direction+
Note: See TracChangeset
for help on using the changeset viewer.