- Timestamp:
- 12/11/07 17:00:08 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2565 r2566 865 865 mShowPvsSizes = false; 866 866 mShowPiercingRays = false; 867 mShowWeightedRays = false; 868 867 869 mSpatialFilterSize = 0.01; 868 870 mPvsSize = 0; … … 902 904 connect(mControlWidget, SIGNAL(SetRenderBoxes(bool)), this, SLOT(SetRenderBoxes(bool))); 903 905 connect(mControlWidget, SIGNAL(SetRenderFilter(bool)), this, SLOT(SetRenderFilter(bool))); 904 connect(mControlWidget, SIGNAL(SetRenderVisibilityEstimates(bool)), 905 this, SLOT(SetRenderVisibilityEstimates(bool))); 906 connect(mControlWidget, SIGNAL(SetRenderVisibilityEstimates(bool)), this, SLOT(SetRenderVisibilityEstimates(bool))); 906 907 connect(mControlWidget, SIGNAL(SetUseFilter(bool)), this, SLOT(SetUseFilter(bool))); 907 connect(mControlWidget, SIGNAL(SetUseSpatialFilter(bool)), 908 this, SLOT(SetUseSpatialFilter(bool))); 908 connect(mControlWidget, SIGNAL(SetUseSpatialFilter(bool)), this, SLOT(SetUseSpatialFilter(bool))); 909 909 connect(mControlWidget, SIGNAL(SetShowPiercingRays(bool)), this, SLOT(SetShowPiercingRays(bool))); 910 connect(mControlWidget, SIGNAL(SetShowWeightedRays(bool)), this, SLOT(SetShowWeightedRays(bool))); 910 911 911 912 connect(mControlWidget, … … 1198 1199 ViewCellContainer &viewcells = mViewCellsManager->GetViewCells(); 1199 1200 int maxPvs = -1; 1200 int maxPiercingRays = 1; // for savety 1201 int maxPiercingRays = 1; // not zero for savety 1202 float maxRelativeRays = Limits::Small; // not zero for savety 1201 1203 1202 1204 for (i = 0; i < viewcells.size(); ++ i) … … 1213 1215 if (piercingRays > maxPiercingRays) 1214 1216 maxPiercingRays = piercingRays; 1215 } 1216 1217 if (!mShowPvsSizes && !mShowPiercingRays) 1217 1218 const float relativeArea = vc->GetBox().SurfaceArea() / mViewCellsManager->GetViewSpaceBox().SurfaceArea(); 1219 1220 if ((float)piercingRays / relativeArea > maxRelativeRays) 1221 maxRelativeRays = (float)piercingRays / relativeArea; 1222 } 1223 1224 if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays) 1218 1225 { 1219 1226 for (i = 0; i < viewcells.size(); ++ i) … … 1260 1267 { 1261 1268 ViewCell *vc = viewcells[i]; 1262 const Vector3 dummyViewPoint(0.0, 0.0, 1.0); 1263 const float dist = SqrDistance( dummyViewPoint, vc->GetBox().Center());1269 1270 const float dist = SqrDistance(mDummyViewPoint, vc->GetBox().Center()); 1264 1271 1265 1272 vc->SetDistance(dist); … … 1269 1276 } 1270 1277 1271 RgbColor c; 1272 1273 for (i = 0; i < viewcells.size(); ++ i) 1278 for (i = 0; i < viewcells.size(); ++ i) 1274 1279 { 1280 RgbColor c; 1275 1281 ViewCell *vc = viewcells[i]; 1276 1282 … … 1283 1289 ((float)vc->GetNumPiercingRays() / (float)maxPiercingRays); 1284 1290 } 1285 else 1291 else if (mShowWeightedRays) // relative number of rays 1292 { 1293 // importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 1294 float relativeArea = vc->GetBox().SurfaceArea() / mViewCellsManager->GetViewSpaceBox().SurfaceArea(); 1295 1296 if (relativeArea < Limits::Small) 1297 relativeArea = Limits::Small; 1298 1299 importance = mTransferFunction * ((float)vc->GetNumPiercingRays() / relativeArea) / maxRelativeRays; 1300 } 1301 else // pvs size 1286 1302 { 1287 1303 //importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 1288 1304 importance = mTransferFunction * 1289 1305 ((float)vc->GetPvs().GetSize() / (float)maxPvs); 1290 // c = RgbColor(importance, 1.0f - importance, 0.0f);1291 c = RainbowColorMapping(5.0f * importance);1292 1306 } 1293 1307 … … 1452 1466 1453 1467 1454 QRadioButton *rb1, *rb2, *rb3 ;1468 QRadioButton *rb1, *rb2, *rb3, *rb4; 1455 1469 1456 1470 // Create a check box to be in the group box … … 1468 1482 rb3 = new QRadioButton("wireframe", hbox); 1469 1483 rb3->setText("wireframe"); 1484 1485 rb4 = new QRadioButton("weighted rays", hbox); 1486 rb4->setText("weighted rays"); 1487 connect(rb4, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedRays(bool))); 1488 1470 1489 //vl->addWidget(rb2); 1471 1490 //connect(rb2, SIGNAL(toggled(bool)), SIGNAL(SetShowPvsSizes(bool))); … … 1478 1497 vbox2->addWidget(rb1); 1479 1498 vbox2->addWidget(rb2); 1480 rb2->setChecked(true); 1499 vbox2->addWidget(rb4); 1500 rb3->setChecked(true); 1481 1501 1482 1502 vbox2->addStretch(1); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2564 r2566 115 115 void SetShowPvsSizes(bool); 116 116 void SetShowPiercingRays(bool); 117 void SetShowWeightedRays(bool); 117 118 void SetTopView(bool); 118 119 void SetCutViewCells(bool); … … 144 145 bool mShowRenderCost; 145 146 bool mShowPiercingRays; 147 bool mShowWeightedRays; 146 148 bool mShowRays; 147 149 … … 163 165 164 166 unsigned int mIndexBufferSize; 167 168 Vector3 mDummyViewPoint; 165 169 166 170 QtRendererControlWidget *mControlWidget; … … 316 320 void SetShowPiercingRays(bool b) { 317 321 mShowPiercingRays = b; 322 updateGL(); 323 } 324 325 void SetShowWeightedRays(bool b) { 326 mShowWeightedRays = b; 318 327 updateGL(); 319 328 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r2564 r2566 55 55 //glDisable(GL_DEPTH_TEST); 56 56 57 mRenderer->mDummyViewPoint = mDummyViewPoint; 57 58 glColor3f(0.8f, 0.8f, 0.8f); 58 59 mRenderer->RenderPvs(); … … 108 109 glLoadIdentity(); 109 110 110 float m[4][4]; 111 //float m[4][4]; 112 Matrix4x4 m; 111 113 112 114 glLoadIdentity(); 113 115 gluLookAt(0.0, 0.0, 1.0, /* eye is at (0,0,30) */ 114 0.0, 0.0, 0.0,/* center is at (0,0,0) */115 0.0, 1.0, 0.);/* up is in positive Y direction */116 117 build_rotmatrix(m , manipulatorLastQuat);118 glMultMatrixf( &m[0][0]);119 120 float s = scale *20.0f/Magnitude(mRenderer->mSceneGraph->GetBox().Diagonal());116 0.0, 0.0, 0.0, /* center is at (0,0,0) */ 117 0.0, 1.0, 0.); /* up is in positive Y direction */ 118 119 build_rotmatrix(m.x, manipulatorLastQuat); 120 glMultMatrixf((float *)m.x); 121 122 float s = scale * 20.0f / Magnitude(mRenderer->mSceneGraph->GetBox().Diagonal()); 121 123 glScalef(s, s, s); 122 124 … … 124 126 glTranslatef(t.x, t.y, t.z); 125 127 128 mDummyViewPoint = -t; 129 mDummyViewPoint /= s; 130 131 //glGetFloatv(GL_MODELVIEW_MATRIX, m1); 132 133 m.Invert(); 134 135 mDummyViewPoint = m * mDummyViewPoint; 126 136 RenderScene(); 127 137 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.h
r2562 r2566 3 3 4 4 #include <QtOpenGL> 5 5 #include "Vector3.h" 6 6 7 7 namespace GtpVisibilityPreprocessor … … 22 22 23 23 QtGlViewer(QWidget *parent, 24 QtGlRendererWidget *renderer);24 QtGlRendererWidget *renderer); 25 25 26 26 virtual ~QtGlViewer(){}; … … 41 41 void mouseMoveEvent(QMouseEvent *event); 42 42 43 void keyPressEvent ( QKeyEvent * e);43 void keyPressEvent(QKeyEvent * e); 44 44 45 45 bool mWireframe; 46 46 47 47 int timerId; 48 49 Vector3 mDummyViewPoint; 48 50 49 51 private: -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2548 r2566 750 750 Vector3 origin, termination, direction; 751 751 752 float radius = 0.5f *752 const float radius = 0.5f * 753 753 Magnitude(mPreprocessor.mViewCellsManager->GetViewSpaceBox().Size()); 754 754
Note: See TracChangeset
for help on using the changeset viewer.