Changeset 1146 for GTP/trunk/Lib/Vis
- Timestamp:
- 07/24/06 17:17:18 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 6 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r1004 r1146 1055 1055 if (!(*oit).first) continue; 1056 1056 1057 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>((*oit).first);1057 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>((*oit).first); 1058 1058 omi->GetMesh()->setVisible(load); 1059 1059 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidHalfBoundingBox.cpp
r117 r1146 41 41 // 0+------+4 *---x 42 42 43 // fan 144 if (isFirstHalf) 43 44 if (isFirstHalf) // fan 1 45 45 { 46 46 *pPos++ = min.x; *pPos++ = max.y; *pPos++ = max.z; //011 … … 54 54 *pPos++ = min.x; *pPos++ = min.y; *pPos++ = max.z; //001 55 55 } 56 else 57 // fan 2 56 else // fan 2 58 57 { 59 58 *pPos++ = max.x; *pPos++ = min.y; *pPos++ = min.z; //100 -
GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj
r1145 r1146 64 64 FavorSizeOrSpeed="0" 65 65 OptimizeForWindowsApplication="TRUE" 66 AdditionalIncludeDirectories="..\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)";..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces "66 AdditionalIncludeDirectories="..\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)";..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(BOOST_INCLUDE)"" 67 67 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;" 68 68 ExceptionHandling="TRUE" … … 119 119 </File> 120 120 <File 121 RelativePath="..\src\BoostPreprocessorThread.cpp"> 122 </File> 123 <File 124 RelativePath="..\src\BoostPreprocessorThread.h"> 125 </File> 126 <File 121 127 RelativePath="..\src\BoundingBoxConverter.h"> 122 128 </File> … … 338 344 </File> 339 345 <File 340 RelativePath="..\src\RenderSimulator.cpp">341 </File>342 <File343 RelativePath="..\src\RenderSimulator.h">344 </File>345 <File346 346 RelativePath="..\src\ResourceManager.h"> 347 347 </File> … … 530 530 </File> 531 531 <File 532 RelativePath="..\src\QtGlRenderer.cpp">533 </File>534 <File535 RelativePath="..\src\QtGlRenderer.h">536 </File>537 <File538 532 RelativePath="..\src\Renderer.cpp"> 539 533 </File> 540 534 <File 541 535 RelativePath="..\src\Renderer.h"> 536 </File> 537 <File 538 RelativePath="..\src\RenderSimulator.cpp"> 539 </File> 540 <File 541 RelativePath="..\src\RenderSimulator.h"> 542 542 </File> 543 543 </Filter> -
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(); -
GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln
r1011 r1146 31 31 EndProject 32 32 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "..\..\OnlineCullingCHC\IVReader\scripts\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}" 33 ProjectSection(ProjectDependencies) = postProject 34 EndProjectSection 35 EndProject 36 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QtRenderer", "..\..\QtRenderer\QtRenderer.vcproj", "{B85DC7B1-58B6-4912-BD64-8B452630A368}" 33 37 ProjectSection(ProjectDependencies) = postProject 34 38 EndProjectSection … … 68 72 {7319E499-473D-4CE5-9983-725D6E68A55D}.Release.ActiveCfg = Release|Win32 69 73 {7319E499-473D-4CE5-9983-725D6E68A55D}.Release.Build.0 = Release|Win32 74 {B85DC7B1-58B6-4912-BD64-8B452630A368}.Debug.ActiveCfg = Debug|Win32 75 {B85DC7B1-58B6-4912-BD64-8B452630A368}.Debug.Build.0 = Debug|Win32 76 {B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.ActiveCfg = Release|Win32 77 {B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.Build.0 = Release|Win32 70 78 EndGlobalSection 71 79 GlobalSection(ExtensibilityGlobals) = postSolution
Note: See TracChangeset
for help on using the changeset viewer.