- Timestamp:
- 07/25/06 18:20:07 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManagerDll.cpp
r971 r1151 25 25 26 26 //#include <OgreVisibilityTerrainSceneManager.h> 27 //#include <OgreVisibilityOctreeSceneManager.h>28 27 #include <OgreOcclusionCullingSceneManager.h> 29 28 … … 40 39 namespace Ogre { 41 40 42 //VisibilityOctreeSceneManagerFactory *visibilityOctreePlugin;43 41 //VisibilityTerrainSceneManagerFactory *visibilityTerrainPlugin; 44 42 OcclusionCullingSceneManagerFactory *occlusionCullingPlugin; … … 52 50 53 51 // Create new scene manager 54 //visibilityOctreePlugin = new VisibilityOctreeSceneManagerFactory(visManager);55 52 //visibilityTerrainPlugin = new VisibilityTerrainSceneManagerFactory(visManager); 56 53 occlusionCullingPlugin = new OcclusionCullingSceneManagerFactory(visManager); … … 59 56 60 57 // Register 61 //Root::getSingleton().addSceneManagerFactory(visibilityOctreePlugin);62 58 //Root::getSingleton().addSceneManagerFactory(visibilityTerrainPlugin); 63 59 Root::getSingleton().addSceneManagerFactory(occlusionCullingPlugin); … … 66 62 extern "C" void __declspec(dllexport) dllShutdownPlugin() 67 63 { 68 //Root::getSingleton().removeSceneManagerFactory(visibilityOctreePlugin);69 64 //Root::getSingleton().removeSceneManagerFactory(visibilityTerrainPlugin); 70 65 Root::getSingleton().removeSceneManagerFactory(occlusionCullingPlugin); … … 77 72 //delete heightmapTerrainPageSource; 78 73 79 // (HACK: crashes on delete!!!! FIX this80 //delete visibilityOctreePlugin; 81 74 // BUG: crashes on delete!!!! FIX this 75 76 //delete visibilityTerrainPlugin; 82 77 delete occlusionCullingPlugin; 83 78 -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1146 r1151 78 78 79 79 public: 80 ObjectContainer mObjects; 81 82 Vector3 mViewPoint; 83 Vector3 mViewDirection; 84 85 int timerId; 86 bool mUseFalseColors; 87 bool mUseForcedColors; 88 89 HaltonSequence halton; 90 91 int mFrame; 92 bool mWireFrame; 93 94 bool mDetectEmptyViewSpace; 95 bool mSnapErrorFrames; 96 97 bool mUseGlLists; 98 99 string mSnapPrefix; 100 101 KdTree *mKdTree; 102 103 //QWaitCondition mRenderingFinished; 104 105 vector<OcclusionQuery *> mOcclusionQueries; 106 80 107 81 GlRenderer(SceneGraph *sceneGraph, 108 82 ViewCellsManager *viewcells, 109 83 KdTree *tree); 110 84 85 GlRenderer() {} 86 111 87 virtual ~GlRenderer(); 112 88 … … 140 116 141 117 int GetId(int r, int g, int b) const; 118 119 inline const bool GetSnapErrorFrames() { return mSnapErrorFrames; } 120 inline const string GetSnapPrefix() { return mSnapPrefix; } 121 122 inline void SetSnapErrorFrames(bool snapframes) { mSnapErrorFrames = snapframes; } 123 inline void SetSnapPrefix(const string &pref) { mSnapPrefix = pref; } 124 125 protected: 126 127 128 vector<OcclusionQuery *> mOcclusionQueries; 129 130 ObjectContainer mObjects; 131 132 Vector3 mViewPoint; 133 Vector3 mViewDirection; 134 135 int timerId; 136 bool mUseFalseColors; 137 bool mUseForcedColors; 138 139 HaltonSequence halton; 140 141 int mFrame; 142 bool mWireFrame; 143 144 bool mDetectEmptyViewSpace; 145 bool mSnapErrorFrames; 146 147 bool mUseGlLists; 148 149 string mSnapPrefix; 150 151 KdTree *mKdTree; 152 142 153 }; 143 154 … … 147 158 { 148 159 149 //Q_OBJECT150 160 public: 161 151 162 GlRendererBuffer(SceneGraph *sceneGraph, 152 163 ViewCellsManager *viewcells, … … 259 270 /** Abstract class for implmenenting a gl render widget. 260 271 */ 261 class GlRender Widget272 class GlRendererWidget: public GlRenderer 262 273 { 263 274 public: 264 275 265 GlRenderWidget(SceneGraph *sceneGraph, ViewCellsManager *vcm, KdTree *kdTree): 266 mSceneGraph(sceneGraph), mViewCellsManager(vcm), mKdTree(kdTree) 267 { 268 } 269 270 271 GlRenderWidget() {} 272 273 virtual ~GlRenderWidget() {} 276 GlRendererWidget(SceneGraph *sceneGraph, ViewCellsManager *vcm, KdTree *kdTree): 277 GlRenderer(sceneGraph, vcm, kdTree) 278 {} 279 280 GlRendererWidget() {} 281 282 virtual ~GlRendererWidget() {} 274 283 275 284 //virtual void Create() {} … … 285 294 }; 286 295 296 //extern GlRendererWidget *rendererWidget; 297 287 298 }; 288 299 -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r1150 r1151 841 841 sprintf(buf, "snap/i-%02d-", mPass); 842 842 843 renderer-> mSnapPrefix = buf;843 renderer->SetSnapPrefix(buf); 844 844 } 845 845 else … … 847 847 sprintf(buf, "snap/r-%02d-", mPass); 848 848 849 renderer-> mSnapPrefix = buf;849 renderer->SetSnapPrefix(buf); 850 850 } 851 851 852 renderer-> mSnapErrorFrames = true;852 renderer->SetSnapErrorFrames(true); 853 853 } 854 854 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1148 r1151 1289 1289 sort(mViewCells.begin(), mViewCells.end(), ViewCell::SmallerPvs); 1290 1290 1291 int start = mViewCells.size() * minValid;1292 int end = mViewCells.size() * maxValid;1293 1294 for (int i = 0; i < mViewCells.size(); ++ i)1291 int start = (int)(mViewCells.size() * minValid); 1292 int end = (int)(mViewCells.size() * maxValid); 1293 1294 for (int i = 0; i < (int)mViewCells.size(); ++ i) 1295 1295 { 1296 1296 mViewCells[i]->SetValid(i >= start && i <= end); -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1146 r1151 1 #include <windows.h> 2 #include <stdio.h> 3 #include <crtdbg.h> 4 1 5 #include "SamplingPreprocessor.h" 2 6 #include "VssPreprocessor.h" … … 19 23 #define USE_EXE_PATH false 20 24 21 #include <crtdbg.h>22 25 23 26 using namespace GtpVisibilityPreprocessor; 24 27 25 28 Preprocessor *preprocessor = NULL; 26 GlRenderWidget *renderWidget = NULL; 29 GlRendererWidget *rendererWidget = NULL; 30 31 // DLL function signature 32 typedef GlRendererWidget *(*importFunction)(); 33 34 int LoadMyDll() 35 { 36 importFunction LoadRenderWidget; 37 38 // Load DLL file 39 HINSTANCE hinstLib = LoadLibrary("QtRenderer.dll"); 40 41 if (hinstLib == NULL) 42 { 43 cout << "ERROR: unable to load DLL\n"; 44 return 1; 45 } 46 47 // Get function pointer 48 LoadRenderWidget = (importFunction)GetProcAddress(hinstLib, "LoadRenderWidget"); 49 50 if (LoadRenderWidget == NULL) 51 { 52 cout << "ERROR: unable to find DLL function\n"; 53 return 1; 54 } 55 56 // load the render window 57 rendererWidget = LoadRenderWidget(); 58 59 return 0; 60 } 61 27 62 28 63 29 64 void Cleanup() 30 65 { 31 DEL_PTR(render Widget);66 DEL_PTR(rendererWidget); 32 67 DEL_PTR(preprocessor); 33 68 … … 40 75 void DisplayWidget() 41 76 { 77 if (!rendererWidget) 78 LoadMyDll(); 79 42 80 // note matt: capsulate qt dependent code as good as possible 43 renderWidget = 44 new GlRenderWidget(preprocessor->mSceneGraph, 81 /*new GlRendererWidget(preprocessor->mSceneGraph, 45 82 preprocessor->mViewCellsManager, 46 83 preprocessor->mKdTree); 47 48 render Widget->Show();84 */ 85 rendererWidget->Show(); 49 86 50 87 #if QT_ENABLED -
GTP/trunk/Lib/Vis/QtRenderer/QtGlRenderer.cpp
r1148 r1151 30 30 //static vector<OcclusionQuery *> sQueries; 31 31 32 GlRendererWidget *rendererWidget = NULL; 33 GlDebuggerWidget *debuggerWidget = NULL; 32 QtGlRendererWidget *rendererWidget = NULL; 33 QtGlDebuggerWidget *debuggerWidget = NULL; 34 34 35 35 36 static inline bool ilt(Intersectable *obj1, Intersectable *obj2) … … 909 910 910 911 void 911 GlRendererWidget::SetupProjection(const int w, const int h, const float angle)912 QtGlRendererWidget::SetupProjection(const int w, const int h, const float angle) 912 913 { 913 914 if (!mTopView) … … 923 924 924 925 void 925 GlRendererWidget::RenderPvs()926 QtGlRendererWidget::RenderPvs() 926 927 { 927 928 SetupCamera(); … … 984 985 985 986 float 986 GlRendererWidget::RenderErrors()987 QtGlRendererWidget::RenderErrors() 987 988 { 988 989 float pErrorPixels = -1.0f; … … 1110 1111 1111 1112 void 1112 GlRendererWidget::mousePressEvent(QMouseEvent *e)1113 QtGlRendererWidget::mousePressEvent(QMouseEvent *e) 1113 1114 { 1114 1115 int x = e->pos().x(); … … 1121 1122 1122 1123 void 1123 GlRendererWidget::mouseMoveEvent(QMouseEvent *e)1124 QtGlRendererWidget::mouseMoveEvent(QMouseEvent *e) 1124 1125 { 1125 1126 float MOVE_SENSITIVITY = Magnitude(mSceneGraph->GetBox().Diagonal())*1e-3; … … 1149 1150 1150 1151 void 1151 GlRendererWidget::mouseReleaseEvent(QMouseEvent *)1152 { 1153 1154 1155 } 1156 1157 void 1158 GlRendererWidget::resizeGL(int w, int h)1152 QtGlRendererWidget::mouseReleaseEvent(QMouseEvent *) 1153 { 1154 1155 1156 } 1157 1158 void 1159 QtGlRendererWidget::resizeGL(int w, int h) 1159 1160 { 1160 1161 SetupProjection(w, h); … … 1163 1164 1164 1165 void 1165 GlRendererWidget::paintGL()1166 QtGlRendererWidget::paintGL() 1166 1167 { 1167 1168 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); … … 1189 1190 1190 1191 void 1191 GlRendererWidget::SetupCamera()1192 QtGlRendererWidget::SetupCamera() 1192 1193 { 1193 1194 if (!mTopView) … … 1227 1228 1228 1229 void 1229 GlRendererWidget::keyPressEvent ( QKeyEvent * e )1230 QtGlRendererWidget::keyPressEvent ( QKeyEvent * e ) 1230 1231 { 1231 1232 switch (e->key()) { … … 1253 1254 1254 1255 1255 GlRendererWidget::GlRendererWidget(SceneGraph *sceneGraph,1256 QtGlRendererWidget::QtGlRendererWidget(SceneGraph *sceneGraph, 1256 1257 ViewCellsManager *viewcells, 1257 1258 KdTree *tree, … … 1261 1262 ) 1262 1263 : 1263 GlRenderer (sceneGraph, viewcells, tree), QGLWidget(parent, shareWidget, f)1264 GlRendererWidget(sceneGraph, viewcells, tree), QGLWidget(parent, shareWidget, f) 1264 1265 { 1265 1266 mTopView = false; … … 1286 1287 mPvsSize = 0; 1287 1288 mRenderError = 0.0f; 1288 mControlWidget = new RendererControlWidget(NULL);1289 mControlWidget = new QtRendererControlWidget(NULL); 1289 1290 1290 1291 connect(mControlWidget, SIGNAL(SetViewCellGranularity(int)), this, SLOT(SetViewCellGranularity(int))); … … 1313 1314 1314 1315 void 1315 GlRendererWidget::RenderInfo()1316 QtGlRendererWidget::RenderInfo() 1316 1317 { 1317 1318 QString s; … … 1438 1439 1439 1440 void 1440 GlRendererWidget::SetViewCellGranularity(int number)1441 QtGlRendererWidget::SetViewCellGranularity(int number) 1441 1442 { 1442 1443 if (mViewCellsManager) … … 1448 1449 1449 1450 void 1450 GlRendererWidget::SetVisibilityFilterSize(int number)1451 QtGlRendererWidget::SetVisibilityFilterSize(int number) 1451 1452 { 1452 1453 if (mViewCellsManager) … … 1456 1457 1457 1458 void 1458 GlRendererWidget::SetSpatialFilterSize(int number)1459 QtGlRendererWidget::SetSpatialFilterSize(int number) 1459 1460 { 1460 1461 mSpatialFilterSize = 1e-3*number; … … 1463 1464 1464 1465 void 1465 GlRendererWidget::SetSceneCut(int number)1466 QtGlRendererWidget::SetSceneCut(int number) 1466 1467 { 1467 1468 // assume the cut plane can only be aligned with xz plane … … 1478 1479 1479 1480 void 1480 GlRendererWidget::SetTopDistance(int number)1481 QtGlRendererWidget::SetTopDistance(int number) 1481 1482 { 1482 1483 mTopDistance = number/1000.0f; … … 1485 1486 1486 1487 void 1487 GlRendererWidget::RenderViewCells()1488 QtGlRendererWidget::RenderViewCells() 1488 1489 { 1489 1490 mUseFalseColors = true; … … 1543 1544 1544 1545 /***********************************************************************/ 1545 /* GlDebuggerWidget implementation */1546 /* QtGlDebuggerWidget implementation */ 1546 1547 /***********************************************************************/ 1547 1548 1548 1549 1549 GlDebuggerWidget::GlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent)1550 QtGlDebuggerWidget::QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent) 1550 1551 : QGLWidget(QGLFormat(QGL::SampleBuffers), parent), mRenderBuffer(buf) 1551 1552 { … … 1557 1558 1558 1559 1559 GlDebuggerWidget::~GlDebuggerWidget()1560 QtGlDebuggerWidget::~QtGlDebuggerWidget() 1560 1561 { 1561 1562 mRenderBuffer->releaseFromDynamicTexture(); … … 1567 1568 1568 1569 1569 RendererControlWidget::RendererControlWidget(QWidget * parent, Qt::WFlags f):1570 QtRendererControlWidget::QtRendererControlWidget(QWidget * parent, Qt::WFlags f): 1570 1571 QWidget(parent, f) 1571 1572 { … … 1730 1731 1731 1732 void 1732 RendererControlWidget::FocusNextPvsErrorFrame(void)1733 { 1734 1735 1736 } 1737 1738 void 1739 RendererControlWidget::UpdatePvsErrorItem(int row,1733 QtRendererControlWidget::FocusNextPvsErrorFrame(void) 1734 { 1735 1736 1737 } 1738 1739 void 1740 QtRendererControlWidget::UpdatePvsErrorItem(int row, 1740 1741 GlRendererBuffer::PvsErrorEntry &pvsErrorEntry) 1741 1742 { … … 1753 1754 1754 1755 1755 void GlDebuggerWidget::initializeGL()1756 void QtGlDebuggerWidget::initializeGL() 1756 1757 { 1757 1758 glMatrixMode(GL_PROJECTION); … … 1770 1771 1771 1772 1772 void GlDebuggerWidget::resizeGL(int w, int h)1773 void QtGlDebuggerWidget::resizeGL(int w, int h) 1773 1774 { 1774 1775 glViewport(0, 0, w, h); … … 1776 1777 1777 1778 1778 void GlDebuggerWidget::paintGL()1779 void QtGlDebuggerWidget::paintGL() 1779 1780 { 1780 1781 // draw a spinning cube into the pbuffer.. … … 1809 1810 1810 1811 1811 void GlDebuggerWidget::initPbuffer()1812 void QtGlDebuggerWidget::initPbuffer() 1812 1813 { 1813 1814 // set up the pbuffer context … … 1833 1834 } 1834 1835 1835 void GlDebuggerWidget::initCommon()1836 void QtGlDebuggerWidget::initCommon() 1836 1837 { 1837 1838 glEnable(GL_TEXTURE_2D); -
GTP/trunk/Lib/Vis/QtRenderer/QtGlRenderer.h
r1150 r1151 126 126 127 127 128 class __declspec(dllexport) RendererControlWidget : public QWidget128 class __declspec(dllexport) QtRendererControlWidget : public QWidget 129 129 { 130 130 Q_OBJECT … … 133 133 QListWidget *mPvsErrorWidget; 134 134 135 RendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0);135 QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0); 136 136 137 137 public slots: … … 163 163 }; 164 164 165 class __declspec(dllexport) GlRendererWidget : public QGLWidget, public GlRenderer165 class __declspec(dllexport) QtGlRendererWidget : public QGLWidget, public GlRendererWidget 166 166 { 167 167 Q_OBJECT … … 191 191 float mRenderError; 192 192 193 RendererControlWidget *mControlWidget;194 195 GlRendererWidget(SceneGraph *sceneGraph,193 QtRendererControlWidget *mControlWidget; 194 195 QtGlRendererWidget(SceneGraph *sceneGraph, 196 196 ViewCellsManager *viewcells, 197 197 KdTree *tree, … … 199 199 ); 200 200 201 QtGlRendererWidget() {}; 201 202 202 203 virtual void SetupCamera(); … … 305 306 306 307 307 extern GlRendererWidget *rendererWidget; 308 309 class GlDebuggerWidget : public QGLWidget 308 class QtGlDebuggerWidget : public QGLWidget 310 309 { 311 310 Q_OBJECT 312 311 public: 313 GlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL);314 ~ GlDebuggerWidget();312 QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL); 313 ~QtGlDebuggerWidget(); 315 314 void initializeGL(); 316 315 void resizeGL(int w, int h); … … 335 334 }; 336 335 337 extern GlDebuggerWidget *debuggerWidget;336 extern QtGlDebuggerWidget *debuggerWidget; 338 337 339 338 }; -
GTP/trunk/Lib/Vis/QtRenderer/QtRenderer.vcproj
r1150 r1151 126 126 RelativePath=".\QtGlRenderer.cpp"> 127 127 </File> 128 <File 129 RelativePath=".\QtRendererDll.cpp"> 130 </File> 128 131 </Filter> 129 132 <Filter
Note: See TracChangeset
for help on using the changeset viewer.