Changeset 1146 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 07/24/06 17:17:18 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r1145 r1146 11 11 #include "Environment.h" 12 12 13 14 //#define GL_GLEXT_PROTOTYPES 15 16 17 #include <Cg/cg.h> 18 #include <Cg/cgGL.h> 19 20 21 #include <QVBoxLayout> 13 //#include <Cg/cg.h> 14 //#include <Cg/cgGL.h> 15 22 16 23 17 namespace GtpVisibilityPreprocessor { 24 18 25 26 /*27 GLuint frontDepthMap;28 GLuint backDepthMap;29 30 const int depthMapSize = 512;31 32 //static vector<OcclusionQuery *> sQueries;33 */34 19 35 20 static bool arbQuerySupport = false; -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1145 r1146 1 1 #ifndef __GLRENDERER_H 2 2 #define __GLRENDERER_H 3 4 //#include "glInterface.h"5 6 //#include <QWaitCondition>7 //#include <QtOpenGL>8 //#include <QGLPixelBuffer>9 10 //class QWidget;11 3 12 4 #include "Vector3.h" … … 82 74 derived classes 83 75 */ 84 85 76 class GlRenderer: public Renderer 86 77 { … … 151 142 }; 152 143 153 144 /* Class implementing an OpenGl render buffer. 145 */ 154 146 class GlRendererBuffer: public GlRenderer 155 147 { … … 253 245 */ 254 246 void EvalQueryWithItemBuffer(); 247 255 248 /** Evaluates query for one direction using occlusion queries. 256 249 */ … … 263 256 }; 264 257 258 259 /** Abstract class for implmenenting a gl render widget. 260 */ 261 class GlRenderWidget 262 { 263 public: 264 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() {} 274 275 //virtual void Create() {} 276 virtual void Show() {} 277 278 279 protected: 280 281 282 SceneGraph *mSceneGraph; 283 ViewCellsManager *mViewCellsManager; 284 KdTree *mKdTree; 285 }; 286 265 287 }; 266 288 267 289 #endif 268 -
GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp
r1145 r1146 1 1 //#include <QApplication> 2 2 #include "PreprocessorThread.h" 3 #include "Camera.h"4 #include "KdTree.h"5 #include "SceneGraph.h"6 #include "Preprocessor.h"7 3 8 4 9 5 namespace GtpVisibilityPreprocessor { 10 6 11 12 // matt: remove qt dependencies13 /*14 PreprocessorThread::PreprocessorThread(Preprocessor *p,15 QObject *parent):QThread(parent)16 {17 mPreprocessor = p;18 19 if (p->mQuitOnFinish)20 connect(this, SIGNAL(finished()), qApp, SLOT(closeAllWindows(void)));21 }22 */23 7 24 8 PreprocessorThread::PreprocessorThread(Preprocessor *p): … … 28 12 29 13 30 void PreprocessorThread::operator()()31 {32 Main();33 }34 35 void PreprocessorThread::Main()36 {37 Camera camera;38 39 if (0)40 {41 // camera.LookAtBox(mPreprocessor->mKdTree->GetBox());42 // camera.LookInBox(mPreprocessor->mKdTree->GetBox());43 camera.SetPosition(Vector3(3473, 6.778, -1699));44 camera.SetDirection(Vector3(-0.2432, 0, 0.97));45 // camera.SetPosition(Vector3(991.7, 187.8, -271));46 // camera.SetDirection(Vector3(0.9, 0, -0.4));47 48 camera.SnapImage("camera.jpg", mPreprocessor->mKdTree, mPreprocessor->mSceneGraph);49 }50 51 if (0) {52 camera.LookInBox(mPreprocessor->mKdTree->GetBox());53 camera.SetPosition(camera.mPosition + Vector3(-250,0,-550));54 camera.SnapImage("camera2.jpg", mPreprocessor->mKdTree, mPreprocessor->mSceneGraph);55 }56 57 if (0) {58 camera.SetPosition( mPreprocessor->mKdTree->GetBox().Center() - Vector3(0,-100,0) );59 camera.SetDirection(Vector3(1, 0, 0));60 camera.SnapImage("camera3.jpg", mPreprocessor->mKdTree, mPreprocessor->mSceneGraph);61 }62 63 if (mPreprocessor->mComputeVisibility) {64 mPreprocessor->ComputeVisibility();65 // mPreprocessor->ExportPreprocessedData("scene.vis");66 mPreprocessor->PostProcessVisibility();67 }68 69 cerr << "Preprocessor main finished...\n";70 71 }72 73 14 PreprocessorThread::~PreprocessorThread() 74 15 { 75 cerr<<"Preprocessor thread destructor...\n";76 16 } 77 17 -
GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h
r1145 r1146 1 1 #ifndef __PREPROCESSOR_THREAD_H 2 2 #define __PREPROCESSOR_THREAD_H 3 // matt: remove qt dependencies4 //#include <QThread>5 3 6 namespace GtpVisibilityPreprocessor { 4 5 namespace GtpVisibilityPreprocessor 6 { 7 7 8 8 class Preprocessor; … … 10 10 /** This class represents a preprocessor thread. 11 11 */ 12 class PreprocessorThread //: public QThread12 class PreprocessorThread 13 13 { 14 //Q_OBJECT 14 public: 15 PreprocessorThread(Preprocessor *p); 16 virtual ~PreprocessorThread(); 15 17 16 Preprocessor *mPreprocessor; 17 public: 18 //PreprocessorThread(Preprocessor *p, QObject *parent = 0); 19 PreprocessorThread(Preprocessor *p); 20 ~PreprocessorThread(); 18 virtual void InitThread() = 0; 19 virtual void RunThread() = 0; 21 20 22 void operator()(); 23 24 void Main(); 25 26 /*protected: 27 void run() { 28 Main(); 29 }*/ 21 protected: 22 virtual void Main() = 0; 23 24 Preprocessor *mPreprocessor; 30 25 }; 31 26 -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r1145 r1146 707 707 GenerateRays(mRssSamplesPerPass*ratios[0], RSS_BASED_DISTRIBUTION, rays); 708 708 709 rays.NormalizePdf( rays.size());709 rays.NormalizePdf((int)rays.size()); 710 710 711 711 CastRays(rays, tmpVssRays); -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r1021 r1146 51 51 Vector3 origin, direction; 52 52 53 const int i = RandomValue(0, (int)mPreprocessor.mObjects.size() - 1);53 const int i = (int)RandomValue(0, (int)mPreprocessor.mObjects.size() - 1); 54 54 55 55 Intersectable *object = mPreprocessor.mObjects[i]; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
r1145 r1146 1444 1444 if (((*ci).value >= minBand) && ((*ci).value <= maxBand)) 1445 1445 { 1446 1447 float currentPos; 1448 1449 // HACK: current positition is BETWEEN visibility events 1450 if (ci != ci_end) 1451 currentPos = ((*ci).value + (*(ci + 1)).value) * 0.5f; 1452 else 1453 currentPos = (*ci).value; 1454 1446 1455 sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); 1447 1448 //Debug << "pos=" << (*ci).value << "\t pvs=(" << pvsl << "," << pvsr << ")" << "\t cost= " << sum << endl; 1456 Debug << "pos=" << (*ci).value << "\t newpos=" << currentPos << "\t pvs=(" << pvsl << "," << pvsr << ")" << "\t cost= " << sum << endl; 1449 1457 1450 1458 if (sum < minSum) -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1145 r1146 12 12 #include "ViewCell.h" 13 13 #include "SceneGraph.h" 14 #include " PreprocessorThread.h"14 #include "BoostPreprocessorThread.h" 15 15 #include "RenderSampler.h" 16 16 #include "ResourceManager.h" 17 18 //#include <QApplication>19 //#include <QtOpenGL>20 #include <boost/thread/thread.hpp>21 #include <boost/thread/xtime.hpp>22 17 #include "GlRenderer.h" 23 18 … … 29 24 30 25 Preprocessor *preprocessor = NULL; 31 32 #if QT_ENABLED 33 QApplication *app = NULL; 34 #endif 26 GlRenderWidget *renderWidget = NULL; 35 27 36 28 37 29 void Cleanup() 38 30 { 39 #if QT_ENABLED 40 DEL_PTR(rendererWidget); 41 #endif 42 31 DEL_PTR(renderWidget); 43 32 DEL_PTR(preprocessor); 44 33 … … 51 40 void DisplayWidget() 52 41 { 42 // note matt: capsulate qt dependent code as good as possible 43 renderWidget = 44 new GlRenderWidget(preprocessor->mSceneGraph, 45 preprocessor->mViewCellsManager, 46 preprocessor->mKdTree); 47 48 renderWidget->Show(); 49 53 50 #if QT_ENABLED 54 QApplication *app = NULL;55 51 56 52 // create a qt application first (must be created before any opengl widget ...) … … 175 171 // create a preprocessor thread 176 172 //PreprocessorThread *pt = new PreprocessorThread(p, app); 177 PreprocessorThread pt(preprocessor);173 BoostPreprocessorThread pt(preprocessor); 178 174 179 175 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) … … 182 178 DisplayWidget(); 183 179 184 // create and run the thread 185 boost::thread thrd(pt); 186 thrd.join(); 187 //pt->start(QThread::LowPriority); 180 // create and run the preprocessor application in a parallel thread 181 pt.InitThread(); 182 pt.RunThread(); 188 183 } 189 184 else … … 193 188 } 194 189 195 #if QT_ENABLED196 if (app)197 {198 returnCode = app->exec();199 DEL_PTR(app);200 }201 #endif202 190 203 191 Cleanup();
Note: See TracChangeset
for help on using the changeset viewer.