Changeset 2709 for GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Timestamp:
- 05/26/08 01:05:56 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2707 r2709 50 50 QtGlDebuggerWidget *debuggerWidget = NULL; 51 51 52 const static int SAMPLES_INCR = 2000000;53 52 54 53 55 54 static SimpleRayContainer sViewPointsList; 56 55 static SimpleRayContainer::const_iterator sViewPointsListIt; 57 56 static int sCurrentSamples = 0; 57 static int sNextSamplesThreshold[] = {10000000, 50000000, 100000000, 250000000}; 58 //static int sNextSamplesThreshold[] = {100000000, 200000000}; 59 static int sNumReplays = 4; 60 static int sCurrentSamplesThreshold = 0; 58 61 59 62 … … 125 128 KdTree *tree): 126 129 QGLPixelBuffer(QSize(w, h), 127 QGLFormat(QGL::StencilBuffer | 130 QGLFormat(QGL::SampleBuffers) 131 /*,| 132 QGL::StencilBuffer | 128 133 QGL::DepthBuffer | 129 134 QGL::DoubleBuffer | 130 135 QGL::Rgba) 131 ),136 */), 132 137 GlRendererBuffer(sceneGraph, viewcells, tree) 133 138 { … … 190 195 191 196 // reimplemented here so that we can snap the error windows 192 float QtGlRendererBuffer::GetPixelError(int &pvsSize )197 float QtGlRendererBuffer::GetPixelError(int &pvsSize, int pass) 193 198 { 194 199 MakeLive(); … … 237 242 238 243 // use shading 239 if (mSnapErrorFrames) 240 { 244 if (1)//mSnapErrorFrames) 245 { 246 glEnable(GL_NORMALIZE); 247 248 // mat_specular and mat_shininess are NOT default values 249 GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f}; 250 GLfloat mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; 251 GLfloat mat_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 252 GLfloat mat_shininess[] = {1.0f}; 253 254 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); 255 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); 256 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); 257 glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); 258 241 259 GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 260 //GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 242 261 GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 243 262 GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0}; 244 263 264 glEnable(GL_LIGHTING); 245 265 //GLfloat light_position[] = {278.0f, 548.8f,279.0f, 1.0f}; 246 GLfloat light_position[] = {0.f,0.f,0.f, 1.0f}; 266 //GLfloat light_position[] = {0.f, 0.f, 0.f, 1.0f}; 267 GLfloat light_position[] = {0.f, 0.0f, 0.f, 1.0f}; 247 268 248 269 glEnable(GL_LIGHT0); … … 252 273 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 253 274 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 254 255 glEnable(GL_LIGHTING);256 275 glLightfv (GL_LIGHT0, GL_POSITION, light_position); 257 276 258 277 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 259 glEnable(GL_COLOR_MATERIAL); 278 //glEnable(GL_COLOR_MATERIAL); 279 280 GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 281 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 260 282 261 283 glShadeModel(GL_SMOOTH); 262 284 } 263 285 264 glDisable(GL_ALPHA_TEST);286 //glDisable(GL_ALPHA_TEST); 265 287 266 288 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 267 289 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 268 290 269 //glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE);270 glColor3f(0, 1, 0);291 glColor3f(0.6f, 0.6f, 0.6f); 292 //glColor3f(0, 1, 0); 271 293 272 294 glDepthFunc(GL_LESS); … … 274 296 glEnable(GL_DEPTH_TEST); 275 297 298 glFrontFace(GL_CCW); 299 glCullFace(GL_BACK); 300 276 301 glStencilFunc(GL_EQUAL, 0x0, 0x1); 277 302 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); … … 301 326 query->BeginQuery(); 302 327 328 // current frame has to be increased at each rendering pass 303 329 ++ mCurrentFrame; 304 330 … … 317 343 318 344 // some error happened 319 if ( pixelCount > pixelThres)345 if (1) // pixelCount > pixelThres) 320 346 { 321 347 cout << "f " << mFrame << " id " << viewcell->GetId() << " pvs " << pvsSize 322 348 << " e " << pixelCount << " vp " << mViewPoint << " vd " << mViewDirection << endl; 323 349 350 format().setSampleBuffers(true); 351 cout << "here3 " << format().sampleBuffers() << endl; 324 352 if (mSnapErrorFrames) 325 353 { … … 327 355 //glReadBuffer(GL_FRONT); 328 356 329 330 357 ////////////// 331 358 //-- output error visualization 332 359 333 360 char filename[256]; 334 //sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 335 sprintf(filename, "error-frame-%04d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount); 361 sprintf(filename, "error-frame-%04d-%05d.bmp", pass, mFrame); 362 //sprintf(filename, "error-frame-%05d-%0.5f.png", mFrame, pErrorPixels); 363 //sprintf_s(filename, "error-frame-%05d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount); 364 336 365 QImage im = toImage(); 337 366 string str = mSnapPrefix + filename; 338 367 QString qstr(str.c_str()); 339 368 340 im.save(qstr, "PNG"); 369 //im.save(qstr, "PNG"); 370 // use bmp for lossless storage (for video) 371 im.save(qstr, "BMP"); 341 372 342 373 if (0) … … 367 398 368 399 im = toImage(); 369 sprintf (filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount);400 sprintf_s(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 370 401 str = mSnapPrefix + filename; 371 402 qstr = str.c_str(); … … 433 464 //glEnable(GL_FOG); 434 465 //glFogi(GL_FOG_MODE, GL_EXP); 466 //glFogf(GL_FOG_DENSITY, .2f); 435 467 glFogi(GL_FOG_MODE, GL_LINEAR); 436 437 // glFogf(GL_FOG_DENSITY, .2f);438 468 glFogf(GL_FOG_START, 50.f); 439 469 glFogf(GL_FOG_END, 500.f); 440 470 441 GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 442 GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 443 GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0}; 444 GLfloat light_position[] = //{278.0f, 548.8f,279.0f, 1.0f }; 445 { 0.f,0.f,0.f,1.0f }; 446 447 /*glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 448 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 449 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 450 glLightfv(GL_LIGHT0, GL_POSITION, light_position); 451 */ 452 glEnable(GL_LIGHT0); 453 471 472 // mat_specular and mat_shininess are NOT default values 454 473 GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f}; 455 456 // mat_specular and mat_shininess are NOT default values457 474 GLfloat mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; 458 475 GLfloat mat_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 459 476 GLfloat mat_shininess[] = {1.0f}; 460 477 461 /* GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};462 GLfloat light_diffuse[] = {0.4f, 0.4f, 0.4f, 1.0f};463 GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f};464 465 GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f};466 */467 468 // default Material469 478 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); 470 479 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); … … 472 481 glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); 473 482 474 // a light 483 484 glEnable(GL_LIGHTING); 485 486 // a light 487 GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 488 GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 489 GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0}; 490 GLfloat light_position[] = {0.f, .0f, 0.f, 1.0f}; 491 //GLfloat light_position[] = {600.0f, 250.0f, -500.f, 1.0f}; 492 //GLfloat light_position[] = {278.0f, 548.8f,279.0f, 1.0f}; 493 475 494 glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 476 495 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 477 496 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 478 497 479 /*glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 498 glLightfv(GL_LIGHT0, GL_POSITION, light_position); 499 500 //glDisable(GL_LIGHT0); 501 glEnable(GL_LIGHT0); 502 503 glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 480 504 glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); 481 505 glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); 482 */ 483 //glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 484 485 glEnable(GL_LIGHTING); 486 glEnable(GL_LIGHT0); 487 // glEnable(GL_LIGHT1); 488 489 // set position of the light 490 /*GLfloat infinite_light[] = { 1.0, 0.8, 1.0, 0.0 }; 491 glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); 492 506 493 507 // set position of the light2 494 508 GLfloat infinite_light2[] = { -0.3, 1.5, 1.0, 0.0 }; 495 509 glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 496 */ 497 glLightfv (GL_LIGHT0, GL_POSITION, light_position); 498 499 glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 500 // glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR); 510 //glEnable(GL_LIGHT1); 511 512 GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 513 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 514 515 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 516 //glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); 501 517 glEnable(GL_COLOR_MATERIAL); 502 518 … … 568 584 dit, dit_end = p->mDynamicObjects.end(); 569 585 570 for (dit = p->mDynamicObjects.begin(); dit != dit_end; ++ dit) 571 { 572 glColor3f(0, 1, 0); 586 int i = 0; 587 for (dit = p->mDynamicObjects.begin(); dit != dit_end; ++ dit, ++ i) 588 { 589 if (i == mCurrentDynamicObjectIdx) 590 glColor3f(1, 0, 1); 591 else 592 glColor3f(0, 1, 0); 593 573 594 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 574 595 _RenderDynamicObject(*dit); 575 596 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 576 597 } 577 578 //_RenderDynamicObject(mPendingDynamicObject);579 598 } 580 599 … … 692 711 mWireFrame = false; 693 712 } 694 695 //mCurrentPvsCost = viewcell->GetPvs().EvalPvsCost();696 713 } 697 714 else … … 722 739 723 740 glEnable(GL_STENCIL_TEST); 724 725 741 glDisable(GL_LIGHTING); 726 742 … … 770 786 cout << "stopping replay" << endl; 771 787 mReplayMode = false; 788 GetPreprocessor()->mSynchronize = false; 772 789 } 773 790 else … … 781 798 } 782 799 783 784 800 updateGL(); 785 } 786 787 if (timerEvent->timerId() == mUpdateTimerId) 801 802 // output the current frame buffer 803 if (mExportFrameBuffer) 804 { 805 const int dist = sViewPointsListIt - sViewPointsList.begin(); 806 807 char filename[200]; 808 sprintf(filename, "error-frame-%04d-%05d.bmp", sCurrentSamples, dist); 809 //QPixmap img = renderPixmap(0, 0, true); 810 QImage im = grabFrameBuffer(); 811 812 string str = mSnapPrefix + filename; 813 QString qstr(str.c_str()); 814 815 //im.save(qstr, "PNG"); 816 // use bmp for lossless storage (for video) 817 im.save(qstr, "BMP"); 818 } 819 } 820 else if (timerEvent->timerId() == mUpdateTimerId) 821 // update pvss from time to time 788 822 update(); 823 824 // grab frame buffer after a certain number of samples 825 if (!mReplayMode && 826 (sCurrentSamplesThreshold < sNumReplays) && 827 ((GetPreprocessor()->mCurrentSamples > sNextSamplesThreshold[sCurrentSamplesThreshold]))) 828 { 829 ++ sCurrentSamplesThreshold; 830 cout << "replaying at total samples: " << GetPreprocessor()->mCurrentSamples << endl; 831 ReplayViewPoints(); 832 } 833 789 834 } 790 835 … … 803 848 { 804 849 Vector3 pt = Unproject(x, y); 805 cout << "unproject: " << pt << endl;806 850 807 851 mPlacer->PlaceObject(pt); … … 813 857 SceneGraphLeaf *newObj = new SceneGraphLeaf(*leaf); 814 858 815 mViewCellsManager->GetPreprocessor()->RegisterDynamicObject(newObj); 816 //mPendingDynamicObjects.push_back(); 859 // make current object 860 // the object is added at the end of the vector 861 mCurrentDynamicObjectIdx = (int)GetPreprocessor()->mDynamicObjects.size(); 862 863 GetPreprocessor()->RegisterDynamicObject(newObj); 817 864 } 818 865 } … … 828 875 mousePoint.y = y; 829 876 830 if (e->modifiers() & Qt:: AltModifier)877 if (e->modifiers() & Qt::ShiftModifier) 831 878 { 832 879 const Vector3 pt = Unproject(x, y); … … 834 881 int idx = FindDynamicObject(x, y); 835 882 836 Preprocessor *p = GetPreprocessor(); 837 838 swap(p->mDynamicObjects[idx], p->mDynamicObjects.back()); 839 p->mDynamicObjects.pop_back(); 840 //preprocessor->ScheduleUpdateDynamicObjects(); 883 if (idx >= 0) 884 { 885 mCurrentDynamicObjectIdx = idx; 886 } 841 887 } 842 888 } … … 865 911 mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY / 2.0; 866 912 } 867 #if 0// DYNAMIC_OBJECTS_HACK868 913 else if (e->modifiers() & Qt::AltModifier) 869 914 { … … 896 941 case 2: 897 942 { 898 899 943 // tm = RotationXMatrix(diffx) * RotationYMatrix(diffy); 944 tm = RotationYMatrix(diffx); 900 945 } 901 946 break; … … 911 956 } 912 957 } 913 #endif914 958 else 915 959 { … … 1043 1087 break; 1044 1088 1045 if (sscanf (text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) {1089 if (sscanf_s(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) { 1046 1090 text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z); 1047 1091 text = QInputDialog::getText(this, … … 1053 1097 if (!ok) 1054 1098 break; 1055 if (sscanf (text.toAscii(), "%f %f %f", &mViewDirection.x,1099 if (sscanf_s(text.toAscii(), "%f %f %f", &mViewDirection.x, 1056 1100 &mViewDirection.y, &mViewDirection.z) == 3) { 1057 1101 updateGL(); … … 1075 1119 QWidget * parent, 1076 1120 const QGLWidget * shareWidget, 1077 Qt::WFlags f 1078 ) 1079 : 1080 GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget(QGLFormat(QGL::SampleBuffers), parent, shareWidget, f) 1121 Qt::WFlags f): 1122 GlRendererWidget(sceneGraph, viewcells, tree), 1123 QGLWidget(QGLFormat(QGL::SampleBuffers), parent, shareWidget, f) 1081 1124 { 1082 1125 mPreprocessorThread = NULL; … … 1139 1182 mPlacer = new ObjectPlacer(); 1140 1183 1141 //mPendingDynamicObject = NULL; 1184 mCurrentDynamicObjectIdx = -1; 1185 1186 //mExportFrameBuffer = true; 1187 mExportFrameBuffer = false; 1142 1188 1143 1189 SetSceneCut(1000); … … 1200 1246 connect(mControlWidget, SIGNAL(SetShowRays(bool)), this, SLOT(SetShowRays(bool))); 1201 1247 1202 #if 01248 #if 1 1203 1249 connect(mControlWidget, SIGNAL(SetTranslation(bool)), this, SLOT(SetTranslation(bool))); 1204 1250 connect(mControlWidget, SIGNAL(SetRotation(bool)), this, SLOT(SetRotation(bool))); … … 1206 1252 #endif 1207 1253 connect(mControlWidget, SIGNAL(UpdateDynamicObjects()), this, SLOT(UpdateDynamicObjects())); 1254 connect(mControlWidget, SIGNAL(DeleteDynamicObject()), this, SLOT(DeleteDynamicObject())); 1208 1255 1209 1256 setWindowTitle("PVS Visualization"); 1210 1257 1211 1258 // setting the main window size here 1212 resize(800, 600);1213 //resize(640, 400);1259 //resize(800, 600); 1260 resize(640, 480); 1214 1261 1215 1262 mControlWidget->show(); … … 1428 1475 filter = mViewCellsManager->GetMaxFilterSize(); 1429 1476 1430 glColor3f(0.0f, 0.0f, 1.0f); 1431 1432 #if REMOVE_TEMPORARY 1477 #if 0 //REMOVE_TEMPORARY 1433 1478 s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f)", 1434 1479 mFrame, … … 1447 1492 filter, 1448 1493 mPvsSize, 1449 mRenderError *100.0f);1494 mRenderError * 100.0f); 1450 1495 1451 1496 renderText(20, 40, s); 1452 1497 #endif 1453 1498 1454 QFont font40; font40.setPointSize(30); 1499 glDisable(GL_LIGHTING); 1500 //qglColor(QColor(0, 255, 0)); 1501 glColor3f(0, 1, 0); 1502 QFont font40; font40.setPointSize(25); 1455 1503 //s.sprintf("PVS: %04d", mPvsSize); 1456 1504 //renderText(20, 40, s, font40); … … 1461 1509 //renderText(290, 70, s, font40); 1462 1510 1463 s.sprintf("PVS TRI: %07d", (int)mCurrentPvsCost); 1464 renderText(290, 70, s, font40); 1511 s.sprintf("PVS TRI: %08d", (int)mCurrentPvsCost); 1465 1512 //renderText(290, 70, s, font40); 1513 renderText(325, 40, s, font40); 1514 s.sprintf("error: %3.3f %", mRenderError * 100.0f); 1515 renderText(20, 40, s, font40); 1516 1517 //renderText(290, 70, s, font40); 1518 glEnable(GL_LIGHTING); 1466 1519 1467 1520 } … … 1809 1862 importance = rcCost / maxRcCost; 1810 1863 } 1811 if (importance > 1.0f) importance = 1.0f; 1864 1865 if (importance > 1.0f) importance = 1.0f; 1812 1866 // c = RgbColor(importance, 1.0f - importance, 0.0f); 1813 1867 c = RainbowColorMapping(importance); … … 1962 2016 connect(button, SIGNAL(clicked()), SIGNAL(UpdateDynamicObjects())); 1963 2017 2018 button = new QPushButton("Delete", groupBox); 2019 vbox2->addWidget(button); 2020 connect(button, SIGNAL(clicked()), SIGNAL(DeleteDynamicObject())); 1964 2021 1965 2022 groupBox->setLayout(vbox2); … … 2538 2595 // set up the pbuffer context 2539 2596 mRenderBuffer->makeCurrent(); 2540 2541 2597 // generate a texture that has the same size/format as the pbuffer 2542 2598 dynamicTexture = mRenderBuffer->generateDynamicTexture(); 2543 2544 2599 // bind the dynamic texture to the pbuffer - this is a no-op under X11 2545 2600 mRenderBuffer->bindToDynamicTexture(dynamicTexture); … … 2627 2682 { 2628 2683 cout << "replaying " << (int)sViewPointsList.size() << " view points " << endl; 2629 2684 2630 2685 mReplayMode = true; 2686 2687 if (mExportFrameBuffer) 2688 GetPreprocessor()->mSynchronize = true; 2689 2690 sCurrentSamples = GetPreprocessor()->mCurrentSamples; 2631 2691 sViewPointsListIt = sViewPointsList.begin(); 2632 2692 } … … 2662 2722 int QtGlRendererWidget::FindDynamicObject(float x, float y) 2663 2723 { 2724 2725 if (GetPreprocessor()->mDynamicObjects.empty()) 2726 return -1; 2727 2664 2728 makeCurrent(); 2665 // we need to lock the rendering context2666 //glw.lockGLContext();2667 2729 2668 2730 // this is the same as in every OpenGL picking example … … 2715 2777 glPopMatrix(); 2716 2778 2717 int hits; 2779 int hits = glRenderMode(GL_RENDER); 2780 2718 2781 // finally release the rendering context again 2719 if ( (hits = glRenderMode(GL_RENDER)) < 0)2782 if (!hits) 2720 2783 { 2721 2784 cout << "no object picked" << endl; 2722 //glw.unlockGLContext();2723 2785 return -1; 2724 2786 } 2725 2787 2726 2727 2788 //processHits(hits, buffer); 2728 2729 2730 //glw.unlockGLContext();2731 2789 2732 2790 // Each hit takes 4 items in the buffer. … … 2743 2801 2744 2802 2745 } 2803 void QtGlRendererWidget::DeleteDynamicObject() 2804 { 2805 Preprocessor *p = GetPreprocessor(); 2806 2807 if ((mCurrentDynamicObjectIdx < 0) || 2808 (mCurrentDynamicObjectIdx >= p->mDynamicObjects.size())) 2809 return; 2810 2811 cout << "deleting object" << endl; 2812 2813 SceneGraphLeaf *l = p->mDynamicObjects[mCurrentDynamicObjectIdx]; 2814 2815 // tell the preprocessor that an object was deleted 2816 p->ObjectRemoved(l); 2817 2818 swap(p->mDynamicObjects[mCurrentDynamicObjectIdx], p->mDynamicObjects.back()); 2819 p->mDynamicObjects.pop_back(); 2820 2821 delete l; 2822 2823 mCurrentDynamicObjectIdx = -1; 2824 } 2825 2826 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2704 r2709 72 72 void RenderPvs(const ObjectPvs &pvs); 73 73 74 float GetPixelError(int &pvsSize );74 float GetPixelError(int &pvsSize, int pass); 75 75 76 76 int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; … … 114 114 void ReplayViewPoints(); 115 115 void UpdateDynamicObjects(); 116 void DeleteDynamicObject(); 116 117 void ComputeVisibility(); 117 118 void StopComputation(); … … 246 247 ObjectPlacer *mPlacer; 247 248 248 //DynamicObjectsContainer mPendingDynamicObjects; 249 int mCurrentDynamicObjectIdx; 250 251 bool mExportFrameBuffer; 252 249 253 DynamicObjectsContainer mDynamicPvsObjects; 250 254 … … 334 338 void ReplayViewPoints(); 335 339 void UpdateDynamicObjects(); 340 void DeleteDynamicObject(); 336 341 void UpdateAllPvs(); 337 342 void ComputeVisibility(); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r2705 r2709 52 52 // set viewer size here 53 53 return QSize(512, 320); 54 55 54 //return QSize(512, 384); 56 55 //return QSize(640, 480); … … 68 67 69 68 GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f}; 70 GLfloat light_diffuse[] = {0. 4f, 0.4f, 0.4f, 1.0f};69 GLfloat light_diffuse[] = {0.6f, 0.6f, 0.6f, 1.0f}; 71 70 GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 72 71 … … 82 81 glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 83 82 84 // default material85 /*glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);86 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);87 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);88 glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);89 */90 83 // a light 91 84 glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
Note: See TracChangeset
for help on using the changeset viewer.