Changeset 2604
- Timestamp:
- 01/16/08 23:32:51 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/demo1.env
r2586 r2604 170 170 171 171 KdTree { 172 pvsArea 5e-4172 pvsArea 8e-4 173 173 sahUseFaces false 174 174 Termination { -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2601 r2604 396 396 glEnable(GL_NORMALIZE); 397 397 398 glClearColor(0.0f, 0.0f, 1.0f, 1.0f);398 glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 399 399 400 400 OcclusionQuery::GenQueries(mOcclusionQueries, 10); -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.cpp
r2575 r2604 170 170 171 171 KdIntersectable::KdIntersectable(KdNode *item, const AxisAlignedBox3 &box) : 172 IntersectableWrapper<KdNode *>(item), mNumTriangles(-1), mBox(box) 172 IntersectableWrapper<KdNode *>(item), mNumTriangles(-1), mBox(box), mGenericIdx(-1) 173 173 { 174 174 } -
GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
r2599 r2604 182 182 AxisAlignedBox3 mBox; 183 183 184 int mGenericIdx; 185 184 186 protected: 185 187 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2601 r2604 47 47 const static int SAMPLES_INCR = 2000000; 48 48 49 50 49 51 static inline bool ilt(Intersectable *obj1, Intersectable *obj2) 50 52 { … … 271 273 GlRenderer::InitGL(); 272 274 273 GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; 274 /* mat_specular and mat_shininess are NOT default values */ 275 GLfloat mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; 276 GLfloat mat_specular[] = { 0.3, 0.3, 0.3, 1.0 }; 277 GLfloat mat_shininess[] = { 1.0 }; 278 279 GLfloat light_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; 280 GLfloat light_diffuse[] = { 0.4, 0.4, 0.4, 1.0 }; 281 GLfloat light_specular[] = { 0.3, 0.3, 0.3, 1.0 }; 282 283 GLfloat lmodel_ambient[] = { 0.3, 0.3, 0.3, 1.0 }; 275 GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f}; 276 277 // mat_specular and mat_shininess are NOT default values 278 GLfloat mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; 279 GLfloat mat_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 280 GLfloat mat_shininess[] = {1.0f}; 281 282 GLfloat light_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f}; 283 GLfloat light_diffuse[] = {0.4f, 0.4f, 0.4f, 1.0f}; 284 GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 285 286 GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 284 287 285 288 … … 515 518 else 516 519 { 517 if (!mRenderVisibilityEstimates )520 if (!mRenderVisibilityEstimates && !mUseRandomColorPerPvsObject) 518 521 { 519 522 _RenderPvs(); … … 529 532 Intersectable *object = it.Next(pvsData); 530 533 534 RgbColor color; 535 531 536 //float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 532 537 // glColor3f(visibility, 0.0f, 0.0f); 533 538 //cerr << "sumpdf: " << pvsData.mSumPdf << endl; 534 RgbColor color = RainbowColorMapping(mTransferFunction*log10(pvsData.mSumPdf + 1)); 539 if (mUseRandomColorPerPvsObject) 540 { 541 KdIntersectable *kdint = static_cast<KdIntersectable *>(object); 542 543 if (kdint->mGenericIdx == -1) 544 { 545 kdint->mGenericIdx = (int)mColors.size(); 546 mColors.push_back(RandomColor()); 547 } 548 color = mColors[kdint->mGenericIdx]; 549 } 550 else 551 { 552 color = RainbowColorMapping(mTransferFunction * log10(pvsData.mSumPdf + 1)); 553 } 554 535 555 glColor3f(color.r, color.g, color.b); 536 556 … … 562 582 else 563 583 { 564 / *ObjectContainer::const_iterator oi = mObjects.begin();565 for (; oi != mObjects.end(); oi++)566 RenderIntersectable(*oi);*/584 //ObjectContainer::const_iterator oi = mObjects.begin(); 585 //for (; oi != mObjects.end(); oi++) 586 // RenderIntersectable(*oi); 567 587 RenderScene(); 568 588 } … … 772 792 QtGlRendererWidget::keyPressEvent ( QKeyEvent * e ) 773 793 { 774 switch (e->key()) { 794 switch (e->key()) 795 { 796 case Qt::Key_E: 797 mRenderErrors = !mRenderErrors; 798 updateGL(); 799 break; 800 case Qt::Key_R: 801 mUseRandomColorPerPvsObject = !mUseRandomColorPerPvsObject;; 802 updateGL(); 803 break; 775 804 case Qt::Key_T: 776 805 mTopView = !mTopView; … … 819 848 } 820 849 default: 850 cerr << "unknown key" << endl; 821 851 e->ignore(); 822 852 break; … … 848 878 mRenderVisibilityEstimates = false; 849 879 880 mUseRandomColorPerPvsObject = false; 881 850 882 mHideByCost = false; 851 883 mUseTransparency = false; … … 874 906 mShowPiercingRays = false; 875 907 mShowWeightedRays = false; 876 mShowWeightedCost = false; 908 mUseStandardColors = false; 909 mShowWeightedCost = true; 877 910 878 911 mShowDistanceWeightedPvs = true; … … 922 955 connect(mControlWidget, SIGNAL(SetUseSpatialFilter(bool)), this, SLOT(SetUseSpatialFilter(bool))); 923 956 connect(mControlWidget, SIGNAL(SetShowPiercingRays(bool)), this, SLOT(SetShowPiercingRays(bool))); 957 connect(mControlWidget, SIGNAL(SetShowWireFrame(bool)), this, SLOT(SetShowWireFrame(bool))); 924 958 connect(mControlWidget, SIGNAL(SetShowWeightedRays(bool)), this, SLOT(SetShowWeightedRays(bool))); 925 959 connect(mControlWidget, SIGNAL(SetShowWeightedCost(bool)), this, SLOT(SetShowWeightedCost(bool))); … … 1108 1142 1109 1143 QString s; 1144 1110 1145 int vc = 0; 1111 1146 if (mViewCellsManager) … … 1116 1151 filter = mViewCellsManager->GetMaxFilterSize(); 1117 1152 1118 glColor3f(1.0f,1.0f,1.0f); 1119 1153 glColor3f(0.0f, 0.0f, 1.0f); 1154 1155 #if REMOVE_TEMPORARY 1120 1156 s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f)", 1121 1157 mFrame, … … 1128 1164 ); 1129 1165 1130 renderText(20, 20,s);1166 renderText(20, 20, s); 1131 1167 1132 1168 s.sprintf("viewcells:%04d filter:%04d pvs:%04d error:%5.5f %", … … 1136 1172 mRenderError*100.0f); 1137 1173 1138 1139 renderText(20,40,s); 1140 1141 1142 1143 1174 renderText(20, 40, s); 1175 #endif 1176 1177 QFont font40; font40.setPointSize(30); 1178 s.sprintf("pvs:%04d", mPvsSize); 1179 renderText(20, 40, s, font40); 1144 1180 } 1145 1181 … … 1361 1397 int i; 1362 1398 1399 // transparency 1400 if (!mUseTransparency) 1401 { 1402 glEnable(GL_DEPTH_TEST); 1403 glDisable(GL_BLEND); 1404 } 1405 else 1406 { 1407 glDisable(GL_DEPTH_TEST); 1408 glEnable(GL_BLEND); 1409 1410 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 1411 //glBlendFunc(GL_SRC_ALPHA, GL_ONE); 1412 1413 for (i = 0; i < viewcells.size(); ++ i) 1414 { 1415 ViewCell *vc = viewcells[i]; 1416 1417 const float dist = SqrDistance(mDummyViewPoint, vc->GetBox().Center()); 1418 vc->SetDistance(dist); 1419 } 1420 1421 sort(viewcells.begin(), viewcells.end(), nearerThan); 1422 } 1423 1424 //mWireFrame = true; 1425 1363 1426 // normal rendering 1364 if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays && !mShowWeightedCost && !mShowComparison) 1427 //if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays && !mShowWeightedCost && !mShowComparison) 1428 if (mUseStandardColors) 1365 1429 { 1366 1430 for (i = 0; i < viewcells.size(); ++ i) … … 1369 1433 RgbColor c; 1370 1434 1371 if (!mShowPvsSizes && !mShowPiercingRays) 1372 { 1373 mWireFrame = true; 1374 c = vc->GetColor(); 1375 } 1376 1435 //if (!mShowPvsSizes && !mShowPiercingRays) 1436 c = vc->GetColor(); 1437 1377 1438 glColor3f(c.r, c.g, c.b); 1378 1439 … … 1385 1446 else // using specialised colors 1386 1447 { 1387 // transparency 1388 if (!mUseTransparency) 1389 { 1390 glEnable(GL_DEPTH_TEST); 1391 glDisable(GL_BLEND); 1392 } 1393 else 1394 { 1395 glDisable(GL_DEPTH_TEST); 1396 glEnable(GL_BLEND); 1397 1398 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 1399 //glBlendFunc(GL_SRC_ALPHA, GL_ONE); 1400 1401 for (i = 0; i < viewcells.size(); ++ i) 1402 { 1403 ViewCell *vc = viewcells[i]; 1404 1405 const float dist = SqrDistance(mDummyViewPoint, vc->GetBox().Center()); 1406 vc->SetDistance(dist); 1407 } 1408 1409 sort(viewcells.begin(), viewcells.end(), nearerThan); 1410 } 1448 1411 1449 1412 1450 if (!mShowComparison) … … 1499 1537 if (viewcells.size() > compareInfo.size()) 1500 1538 { 1501 cerr << "loaded size (" << compareInfo.size() << ") does not fit to view cells size (" <<viewcells.size() << ")" << endl;1539 cerr << "loaded size (" << (int)compareInfo.size() << ") does not fit to view cells size (" << (int)viewcells.size() << ")" << endl; 1502 1540 return; 1503 1541 } … … 1556 1594 QRadioButton *rb1, *rb2, *rb3, *rb4, *rb5; 1557 1595 1558 rb1 = new QRadioButton(" wireframe", parent);1596 rb1 = new QRadioButton("random colors", parent); 1559 1597 rb1->setText("wireframe"); 1560 1598 connect(rb1, SIGNAL(toggled(bool)), SIGNAL(SetShowWireFrame(bool))); … … 1588 1626 vbox2->addWidget(rb5); 1589 1627 1590 rb 1->setChecked(true);1628 rb5->setChecked(true); 1591 1629 1592 1630 vbox2->addStretch(1); … … 1710 1748 vbox->setLayout(vl); 1711 1749 1712 QLabel *label = new QLabel("Granularity"); 1750 QLabel *label; 1751 QSlider *slider; 1752 QPushButton *button; 1753 1754 #if REMOVE_TEMPORARY 1755 1756 label = new QLabel("Granularity"); 1713 1757 vbox->layout()->addWidget(label); 1714 1758 1715 QSlider *slider = new QSlider(Qt::Horizontal, vbox);1759 slider = new QSlider(Qt::Horizontal, vbox); 1716 1760 vl->addWidget(slider); 1717 1761 slider->show(); … … 1739 1783 ////////////////////////////////////////7 1740 1784 1741 1742 QPushButton *button = new QPushButton("Update all PVSs", vbox); 1785 button = new QPushButton("Update all PVSs", vbox); 1743 1786 vbox->layout()->addWidget(button); 1744 1787 connect(button, SIGNAL(clicked()), SLOT(UpdateAllPvs())); 1745 1746 1788 1747 1789 ////////////////////////////////////////77777 … … 1758 1800 1759 1801 connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetVisibilityFilterSize(int))); 1802 1803 #endif 1760 1804 1761 1805 … … 1923 1967 ////////////////////////////// 1924 1968 1925 1969 #if REMOVE_TEMPORARY 1926 1970 cb = new QCheckBox("Cut scene", vbox); 1927 1971 vbox->layout()->addWidget(cb); 1928 1972 cb->setChecked(false); 1929 1973 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetCutScene(bool))); 1930 1974 #endif 1931 1975 cb = new QCheckBox("Render boxes", vbox); 1932 1976 vbox->layout()->addWidget(cb); … … 1945 1989 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderErrors(bool))); 1946 1990 1947 1948 1991 bool tmp; 1992 #if REMOVE_TEMPORARY 1949 1993 1950 1994 cb = new QCheckBox("Use filter", vbox); … … 1953 1997 cb->setChecked(tmp); 1954 1998 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetUseFilter(bool))); 1955 1999 #endif 1956 2000 1957 2001 cb = new QCheckBox("Use spatial filter", vbox); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2591 r2604 14 14 #include "QtPreprocessorThread.h" 15 15 #include "LogReader.h" 16 #include "Material.h" 17 16 18 17 19 … … 127 129 void SetShowRenderCost(bool); 128 130 void SetShowPvsSizes(bool); 131 void SetShowWireFrame(bool); 129 132 void SetShowPiercingRays(bool); 130 133 void SetShowWeightedRays(bool); 131 134 void SetShowComparison(bool); 132 135 void SetShowWeightedCost(bool); 133 136 … … 176 179 bool mShowPiercingRays; 177 180 bool mShowWeightedRays; 181 bool mUseStandardColors; 178 182 bool mShowRays; 179 183 … … 215 219 216 220 ViewCellInfoContainer mCompareInfo; 221 222 vector<RgbColor> mColors; 223 224 bool mUseRandomColorPerPvsObject; 217 225 218 226 QtGlRendererWidget(SceneGraph *sceneGraph, … … 392 400 updateGL(); 393 401 } 402 403 void SetShowWireFrame(bool b) { 404 mUseStandardColors = b; 405 updateGL(); 406 } 407 394 408 395 409 void SetShowWeightedRays(bool b) { -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r2593 r2604 52 52 void QtGlViewer::RenderScene() 53 53 { 54 GLfloat mat_ambient[] = {0.1, 0.1, 0.1, 1.0};55 54 GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; 55 56 56 // mat_specular and mat_shininess are NOT default values 57 GLfloat mat_diffuse[] = {0.5, 1.0, 0.5, 1.0}; 58 GLfloat mat_specular[] = {0.3, 0.3, 0.3, 1.0}; 59 GLfloat mat_shininess[] = {1.0}; 60 61 GLfloat light_ambient[] = {0.1, 0.1, 0.1, 1.0}; 62 GLfloat light_diffuse[] = {0.5, 0.5, 0.5, 1.0}; 63 GLfloat light_specular[] = {0.0, 0.0, 0.0, 1.0}; 64 65 GLfloat lmodel_ambient[] = {0.2, 0.2, 0.2, 1.0}; 66 57 GLfloat mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; 58 GLfloat mat_specular[] = { 0.3, 0.3, 0.3, 1.0 }; 59 GLfloat mat_shininess[] = { 1.0 }; 60 61 GLfloat light_ambient[] = { 0.2, 0.2, 0.2, 1.0 }; 62 GLfloat light_diffuse[] = { 0.4, 0.4, 0.4, 1.0 }; 63 GLfloat light_specular[] = { 0.3, 0.3, 0.3, 1.0 }; 64 65 GLfloat lmodel_ambient[] = {0.3, 0.3, 0.3, 1.0}; 66 67 68 // set position of the light 69 GLfloat infinite_light[] = {1.0, 0.8, 1.0, 0.0}; 70 glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); 71 72 // set position of the light2 73 GLfloat infinite_light2[] = {-0.3, 1.5, 1.0, 0.0}; 74 glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 67 75 68 76 // default material … … 76 84 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 77 85 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 86 87 glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient); 88 glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse); 89 glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); 90 78 91 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); 79 92 80 81 93 //GLfloat infinite_light2[] = {-0.3, 1.5f, 1.0f, 0.0f}; 82 94 //glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 95 //glColor3f(1.0f, 1.0f, 1.0f); 83 96 glColor3f(0.8f, 0.8f, 0.8f); 84 97 85 98 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 86 glDisable(GL_COLOR_MATERIAL); 87 //glEnable(GL_COLOR_MATERIAL); 99 glEnable(GL_COLOR_MATERIAL); 88 100 89 101 ++ mRenderer->mFrame; … … 99 111 mRenderer->mDummyViewPoint = mDummyViewPoint; 100 112 101 glDisable(GL_LIGHTING); 102 //glEnable(GL_LIGHTING); 113 glEnable(GL_NORMALIZE); 114 glEnable(GL_LIGHTING); 115 glEnable(GL_LIGHT0); 116 glEnable(GL_LIGHT1); 103 117 104 118 mRenderer->RenderPvs(); … … 163 177 164 178 glLoadIdentity(); 165 gluLookAt(0.0 , 0.0, 1.0, /* eye is at (0,0,30) */166 0.0 , 0.0, 0.0, /* center is at (0,0,0) */167 0.0 , 1.0, 0.); /* up is in positive Y direction */179 gluLookAt(0.0f, 10.0f, 0.0f, // eye is at (0,0,30) 180 0.0f, 0.0f, 0.0f, // center is at (0,0,0) 181 0.0f, 0.0f, 1.0f); // up is in positive Y direction 168 182 169 183 build_rotmatrix(m.x, manipulatorLastQuat); … … 212 226 213 227 void 214 QtGlViewer::keyPressEvent ( QKeyEvent * e)228 QtGlViewer::keyPressEvent(QKeyEvent * e) 215 229 { 216 230 switch (e->key()) { 217 231 case Qt::Key_W: 218 mWireframe 232 mWireframe = !mWireframe; 219 233 updateGL(); 220 234 default: 221 235 e->ignore(); 236 cerr << "unknown key" << endl; 222 237 break; 223 238 } 224 updateGL();239 //updateGL(); 225 240 } 226 241 … … 228 243 QtGlViewer::mouseMoveEvent(QMouseEvent *event) 229 244 { 230 int dx = event->x() -lastPos.x();231 int dy = event->y() -lastPos.y();245 int dx = event->x() + lastPos.x(); 246 int dy = event->y() + lastPos.y(); 232 247 233 248 if (event->modifiers() & Qt::CTRL) -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2598 r2604 82 82 struct VizBuffer 83 83 { 84 VizBuffer(): mIndex(0), mMaxSize(1000 0)84 VizBuffer(): mIndex(0), mMaxSize(1000) 85 85 { 86 86 }
Note: See TracChangeset
for help on using the changeset viewer.