- Timestamp:
- 09/16/06 21:19:22 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1161 r1387 292 292 293 293 294 SceneGraph *mSceneGraph;295 ViewCellsManager *mViewCellsManager;296 KdTree *mKdTree;294 // SceneGraph *mSceneGraph; 295 // ViewCellsManager *mViewCellsManager; 296 // KdTree *mKdTree; 297 297 }; 298 298 -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r1344 r1387 193 193 float costRatio; 194 194 bool mOnlyDrivingAxis = false; 195 if (mOnlyDrivingAxis) { 195 196 if (mOnlyDrivingAxis) { 196 197 axis = box.Size().DrivingAxis(); 197 198 costRatio = BestCostRatio(leaf, … … 485 486 { 486 487 488 #define DEBUG_COST 0 489 490 #if DEBUG_COST 491 static int nodeId = -1; 492 char filename[256]; 493 494 static int lastAxis = 100; 495 if (axis <= lastAxis) 496 nodeId++; 497 498 lastAxis = axis; 499 500 sprintf(filename, "sah-cost%d-%d.log", nodeId, axis); 501 ofstream costStream; 502 503 if (nodeId < 100) 504 costStream.open(filename); 505 506 #endif 507 487 508 SortSubdivisionCandidates(node, axis); 488 509 … … 543 564 // cout<<"pos="<<(*ci).value<<"\t q=("<<ql<<","<<qr<<")\t r=("<<rl<<","<<rr<<")"<<endl; 544 565 // cout<<"cost= "<<sum<<endl; 545 566 567 #if DEBUG_COST 568 if (nodeId < 100) { 569 float oldCost = mSahUseFaces ? totalIntersections : node->mObjects.size(); 570 float newCost = mCt_div_ci + sum/boxArea; 571 float ratio = newCost/oldCost; 572 costStream<<(*ci).value<<" "<<ratio<<endl; 573 } 574 #endif 575 546 576 if (sum < minSum) { 547 577 minSum = sum; -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1292 r1387 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 28. VIII 11:32:1920063 # Generated by qmake (2.00a) (Qt 4.1.2) on: so 16. IX 21:15:03 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 71 71 C:\Qt\4.1.2\mkspecs\features\debug_and_release.prf \ 72 72 C:\Qt\4.1.2\mkspecs\features\default_post.prf \ 73 C:\Qt\4.1.2\mkspecs\features\qt.prf \ 74 C:\Qt\4.1.2\mkspecs\features\win32\opengl.prf \ 75 C:\Qt\4.1.2\mkspecs\features\moc.prf \ 73 76 C:\Qt\4.1.2\mkspecs\features\win32\thread.prf \ 74 77 C:\Qt\4.1.2\mkspecs\features\warn_off.prf \ … … 89 92 C:\Qt\4.1.2\mkspecs\features\debug_and_release.prf: 90 93 C:\Qt\4.1.2\mkspecs\features\default_post.prf: 94 C:\Qt\4.1.2\mkspecs\features\qt.prf: 95 C:\Qt\4.1.2\mkspecs\features\win32\opengl.prf: 96 C:\Qt\4.1.2\mkspecs\features\moc.prf: 91 97 C:\Qt\4.1.2\mkspecs\features\win32\thread.prf: 92 98 C:\Qt\4.1.2\mkspecs\features\warn_off.prf: … … 110 116 distclean: release-distclean debug-distclean FORCE 111 117 -$(DEL_FILE) Makefile 118 119 release-mocclean: $(MAKEFILE).Release 120 $(MAKE) -f $(MAKEFILE).Release mocclean 121 debug-mocclean: $(MAKEFILE).Debug 122 $(MAKE) -f $(MAKEFILE).Debug mocclean 123 mocclean: release-mocclean debug-mocclean 124 125 release-mocables: $(MAKEFILE).Release 126 $(MAKE) -f $(MAKEFILE).Release mocables 127 debug-mocables: $(MAKEFILE).Debug 128 $(MAKE) -f $(MAKEFILE).Debug mocables 129 mocables: release-mocables debug-mocables 112 130 FORCE: 113 131 -
GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h
r1154 r1387 13 13 { 14 14 public: 15 PreprocessorThread(Preprocessor *p); 16 virtual ~PreprocessorThread(); 15 PreprocessorThread(Preprocessor *p); 16 virtual ~PreprocessorThread(); 17 18 virtual void InitThread() = 0; 19 virtual void RunThread() = 0; 17 20 18 virtual void InitThread() = 0; 19 virtual void RunThread() = 0; 20 21 virtual void Main() = 0; 21 22 protected: 22 virtual void Main() = 0; 23 24 Preprocessor *mPreprocessor; 23 24 Preprocessor *mPreprocessor; 25 25 }; 26 26 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.cpp
r1252 r1387 195 195 ViewCellsManager *viewcells, 196 196 KdTree *tree): 197 QGLPixelBuffer(QSize(w, h)), GlRendererBuffer(sceneGraph, viewcells, tree) { 197 QGLPixelBuffer(QSize(w, h)), 198 GlRendererBuffer(sceneGraph, viewcells, tree) { 198 199 199 200 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1299 r1387 6 6 Scene { 7 7 8 filename ../data/City4M/City4M.obj9 # filename ../data/CityModel/CityModel.obj8 # filename ../data/City4M/City4M.obj 9 # filename ../data/CityModel/CityModel.obj 10 10 # filename ../data/GrandCanyon/grandcanyon1_RotXmin90.obj 11 11 # filename ../data/glasgow/glasgow1.x3d 12 12 # filename vienna.x3d 13 13 # filename ../data/vienna/vienna-simple.x3d 14 # filename ../data/vienna/vienna-buildings.x3d15 #filename ../data/vienna/city1500_flat_1.x3d14 # filename ../data/vienna/vienna-buildings.x3d 15 filename ../data/vienna/city1500_flat_1.x3d 16 16 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d 17 17 #;../data/vienna/vienna-plane.x3d;../data/vienna/vienna-roads.x3d 18 18 # filename ../data/vienna/viewcells-25-sel.x3d 19 19 #filename ../data/atlanta/atlanta2.x3d 20 # filename ../data/soda/soda.dat20 # filename ../data/soda/soda.dat 21 21 #filename ../data/test1/test2.x3d 22 22 #filename ../data/soda/soda5.dat … … 34 34 # stored sample rays 35 35 samplesFilename rays.out 36 useGlRenderer false36 useGlRenderer true 37 37 useGlDebugger false 38 38 # 0 = INTERNAL 1 = MLRT … … 53 53 visibilityFilterWidth 0.01 54 54 visibilityFile visibility.xml 55 loadPolygonsAsMeshes true55 loadPolygonsAsMeshes false 56 56 } 57 57 … … 302 302 # filename ../data/soda/soda5-viewcell-single.xm 303 303 # filename ../data/soda/vienna-viewcell-single.xml 304 #filename ../data/CityModel/CityModel-viewcells-5000.xml305 filename ../data/City4M/City4M-viewcells-5000.xml304 filename ../data/CityModel/CityModel-viewcells-5000.xml 305 # filename ../data/City4M/City4M-viewcells-5000.xml 306 306 307 307 -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1344 r1387 3 3 #endif 4 4 5 #define USE_ BOOST15 #define USE_THREADS 1 6 6 7 7 #ifdef UNICODE … … 27 27 #include "SceneGraph.h" 28 28 29 #if USE_ BOOST29 #if USE_THREADS && !USE_QT 30 30 #include "BoostPreprocessorThread.h" 31 31 #endif … … 36 36 37 37 #if USE_QT 38 #include "QtRenderer/QtGlRenderer.h" 38 #include "QtPreprocessorThread.h" 39 #include "QtGlRenderer.h" 39 40 #endif 40 41 … … 51 52 52 53 53 int LoadMyDll()54 {55 importFunction LoadRenderWidget;56 57 // Load DLL file58 HINSTANCE hinstLib = LoadLibrary("../QtGlRenderer/Release/QtGlRenderer.dll");59 60 if (hinstLib == NULL)61 {62 cout << "ERROR: unable to load DLL\n";63 return 1;64 }65 66 // Get function pointer67 LoadRenderWidget = (importFunction)GetProcAddress(hinstLib, "LoadRenderWidget");68 69 if (LoadRenderWidget == NULL)70 {71 cout << "ERROR: unable to find DLL function\n";72 return 1;73 }74 75 cout << "loading widget ... ";76 // load the render window77 rendererWidget = LoadRenderWidget(preprocessor);78 cout << "finished" << endl;79 // Unload DLL file80 //FreeLibrary(hinstLib);81 82 return 0;83 }84 54 85 55 … … 95 65 96 66 97 void DisplayWidget()98 {99 if (!rendererWidget)100 {101 LoadMyDll();102 }103 104 //rendererWidget->Show();105 }106 67 107 68 … … 254 215 // create a preprocessor thread (note: capsulates calls to boost fuctions!) 255 216 //PreprocessorThread *pt = PreprocessorThreadFactory::Create(preprocessor); 256 #if USE_BOOST 257 BoostPreprocessorThread pt(preprocessor); 258 #endif 217 #if USE_THREADS 218 PreprocessorThread *pt; 219 220 #if USE_QT 221 pt = new QtPreprocessorThread(preprocessor); 222 #else 223 pt = new BoostPreprocessorThread(preprocessor); 224 #endif 225 #endif 226 259 227 260 228 bool guiSupported = false; 261 229 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 262 {230 { 263 231 cout << "using gl widget" << endl; 264 232 // create and run the preprocessor application in a parallel thread 265 #if USE_BOOST 266 pt.InitThread(); 267 #endif 268 //pt.RunThread(); 269 233 #if USE_THREADS 234 pt->InitThread(); 235 pt->RunThread(); 236 #endif 237 238 #if USE_QT 270 239 // display the render widget 271 240 if (!rendererWidget) 272 241 { 273 #if !USE_QT 274 guiSupported = LoadMyDll(); 275 #else 276 rendererWidget = new QtGlRendererWidget(preprocessor->mSceneGraph, 277 preprocessor->mViewCellsManager, 278 preprocessor->mKdTree); 279 #endif 242 // create a qt application first (must be created before any opengl widget ...) 243 QApplication *app = new QApplication(argc, NULL); 244 245 if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 246 QMessageBox::information(0, "OpenGL pbuffers", 247 "This system does not support OpenGL/pbuffers.", 248 QMessageBox::Ok); 249 return NULL; 250 } 251 252 253 rendererWidget = new QtGlRendererWidget(preprocessor->mSceneGraph, 254 preprocessor->mViewCellsManager, 255 preprocessor->mKdTree); 256 257 rendererWidget->Show(); 258 guiSupported = true; 259 260 280 261 } 281 262 282 } 263 qApp->exec(); 264 265 #endif 266 } 283 267 284 268 if (!guiSupported) { … … 289 273 if (!(preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger)) { 290 274 // just call the mail method -> will be executed in the main thread 291 #if USE_ BOOST292 pt .Main();275 #if USE_THREADS 276 pt->RunThread(); 293 277 #endif 294 278 } -
GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
r1292 r1387 1 1 CONFIG -= qt debug 2 CONFIG += console warn_off thread release mlrt 2 CONFIG += console warn_off thread release mlrt qt 3 3 4 4 TEMPLATE = app … … 88 88 CONFIG(qt) { 89 89 win32:LIBS += cg.lib cgGL.lib 90 LIBS += QtRenderer.lib 90 #LIBS += QtRenderer.lib 91 DEFINES += USE_QT 91 92 } 92 93 … … 112 113 GzBinFileInputStream.cpp GzFileInputSource.cpp \ 113 114 LogManager.cpp VspTree.cpp \ 114 SamplingStrategy.cpp KdIntersectable.cpp \115 SamplingStrategy.cpp IntersectableWrapper.cpp \ 115 116 OspTree.cpp HierarchyManager.cpp ObjParser.cpp \ 116 117 BvHierarchy.cpp \ … … 120 121 121 122 CONFIG(qt) { 122 SOURCES += OcclusionQuery.cpp 123 HEADERS += QtPreprocessorThread.h QtGlRenderer.h 124 SOURCES += OcclusionQuery.cpp QtPreprocessorThread.cpp QtGlRenderer.cpp 123 125 } 124 126
Note: See TracChangeset
for help on using the changeset viewer.