Changeset 1926 for GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer
- Timestamp:
- 01/02/07 01:44:59 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer
- Files:
-
- 4 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.cpp
r1925 r1926 28 28 const int depthMapSize = 512; 29 29 30 //static vector<OcclusionQuery *> sQueries;31 32 30 QtGlRendererWidget *rendererWidget = NULL; 33 31 QtGlDebuggerWidget *debuggerWidget = NULL; … … 55 53 mViewCellsManager->GetViewPoint(mViewPoint); 56 54 sample.mPosition = mViewPoint; 57 //cout << "viewpoint: " << mViewPoint << endl;58 55 59 56 // take a render cost sample by rendering a cube -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.h
r1925 r1926 37 37 { 38 38 Q_OBJECT 39 39 40 public: 40 41 QtGlRendererBuffer(const int w, … … 68 69 const int threshold = 0); 69 70 70 71 void 72 EvalPvsStat(); 73 74 void 75 ClearErrorBuffer(); 76 77 78 virtual int GetWidth() const { return width(); } 79 virtual int GetHeight() const { return height(); } 80 81 82 83 void SampleBeamContributions( 84 Intersectable *sourceObject, 85 Beam &beam, 86 const int samples, 87 BeamSampleStatistics &stat 88 ); 89 90 void 91 SampleViewpointContributions( 92 Intersectable *sourceObject, 93 const Vector3 viewPoint, 94 Beam &beam, 95 const int desiredSamples, 96 BeamSampleStatistics &stat 97 ); 98 99 void InitGL(); 100 101 /** Computes rays from information gained with hw sampling- 102 */ 103 void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays); 104 105 float 106 GetPixelError(int &pvsSize); 107 108 int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 109 110 71 void 72 EvalPvsStat(); 73 74 void 75 ClearErrorBuffer(); 76 77 virtual int GetWidth() const { return width(); } 78 virtual int GetHeight() const { return height(); } 79 80 void SampleBeamContributions( 81 Intersectable *sourceObject, 82 Beam &beam, 83 const int samples, 84 BeamSampleStatistics &stat 85 ); 86 87 void 88 SampleViewpointContributions( 89 Intersectable *sourceObject, 90 const Vector3 viewPoint, 91 Beam &beam, 92 const int desiredSamples, 93 BeamSampleStatistics &stat 94 ); 95 96 void InitGL(); 97 98 /** Computes rays from information gained with hw sampling- 99 */ 100 void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays); 101 102 float 103 GetPixelError(int &pvsSize); 104 105 int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 106 107 111 108 private: 112 109 113 110 void SetupProjectionForViewPoint(const Vector3 &viewPoint, 114 115 116 117 118 public: 119 111 const Beam &beam, 112 Intersectable *sourceObject); 113 114 115 public: 116 signals: 120 117 void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &); 121 118 }; … … 124 121 class __declspec(dllexport) QtRendererControlWidget : public QWidget 125 122 { 126 Q_OBJECT 127 public: 128 129 QListWidget *mPvsErrorWidget; 130 131 QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0); 132 133 public slots: 134 135 void FocusNextPvsErrorFrame(); 136 void UpdatePvsErrorItem(int i, 137 GlRendererBuffer::PvsErrorEntry &); 138 139 signals: 140 141 void SetViewCellGranularity(int); 142 void SetSceneCut(int); 143 void SetTopDistance(int); 144 void SetVisibilityFilterSize(int); 145 void SetSpatialFilterSize(int); 146 147 void SetRenderFilter(bool); 148 void SetUseFilter(bool); 149 void SetUseSpatialFilter(bool); 150 void SetRenderErrors(bool); 151 void SetShowViewCells(bool); 152 void SetShowRenderCost(bool); 153 void SetShowPvsSizes(bool); 154 void SetTopView(bool); 155 void SetCutViewCells(bool); 156 void SetCutScene(bool); 157 158 159 }; 123 Q_OBJECT 124 public: 125 126 QListWidget *mPvsErrorWidget; 127 128 QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0); 129 130 public slots: 131 132 void FocusNextPvsErrorFrame(); 133 void UpdatePvsErrorItem(int i, 134 GlRendererBuffer::PvsErrorEntry &); 135 136 signals: 137 138 void SetViewCellGranularity(int); 139 void SetSceneCut(int); 140 void SetTopDistance(int); 141 void SetVisibilityFilterSize(int); 142 void SetSpatialFilterSize(int); 143 144 void SetRenderFilter(bool); 145 void SetUseFilter(bool); 146 void SetUseSpatialFilter(bool); 147 void SetRenderErrors(bool); 148 void SetShowViewCells(bool); 149 void SetShowRenderCost(bool); 150 void SetShowPvsSizes(bool); 151 void SetTopView(bool); 152 void SetCutViewCells(bool); 153 void SetCutScene(bool); 154 155 156 }; 157 160 158 161 159 class __declspec(dllexport) QtGlRendererWidget : public QGLWidget, public GlRendererWidget 162 160 { 163 Q_OBJECT 164 public: 165 166 // point of the last mouse click used for movement in the scene 167 Vector3 mousePoint; 168 169 bool mTopView; 170 bool mRenderViewCells; 171 bool mCutViewCells; 172 bool mCutScene; 173 bool mRenderErrors; 174 bool mRenderFilter; 175 bool mUseFilter; 176 bool mUseSpatialFilter; 177 bool mShowRenderCost; 178 179 bool mShowPvsSizes; 180 float mSpatialFilterSize; 181 182 Plane3 mSceneCutPlane; 183 float mTopDistance; 184 185 // some statistics 186 int mPvsSize; 187 float mRenderError; 188 189 QtRendererControlWidget *mControlWidget; 190 191 QtGlRendererWidget(SceneGraph *sceneGraph, 192 ViewCellsManager *viewcells, 193 KdTree *tree, 194 QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WFlags f = 0 195 ); 196 197 QtGlRendererWidget() {}; 198 199 virtual void SetupCamera(); 200 201 void initializeGL() { 202 InitGL(); 203 } 204 void resizeGL(int w, int h); 205 void paintGL(); 206 void timerEvent(QTimerEvent *) { 207 update(); 208 } 209 210 void mousePressEvent(QMouseEvent *); 211 void mouseReleaseEvent(QMouseEvent *); 212 void mouseMoveEvent(QMouseEvent *); 213 214 void keyPressEvent ( QKeyEvent * e ) ; 215 216 void 217 RenderPvs(); 218 219 float 220 RenderErrors(); 221 void 222 RenderInfo(); 223 224 virtual int GetWidth() const { return width(); } 225 virtual int GetHeight() const { return height(); } 226 227 virtual void 228 SetupProjection(const int w, const int h, const float angle = 70.0f); 229 230 void 231 RenderViewCells(); 232 233 public slots: 234 235 void SetRenderErrors(bool b) { 236 mRenderErrors = b; 237 updateGL(); 238 } 239 240 void SetRenderFilter(bool b) { 241 mRenderFilter = b; 242 updateGL(); 243 } 244 245 void SetUseFilter(bool b) { 246 mUseFilter = b; 247 updateGL(); 248 } 249 250 void SetUseSpatialFilter(bool b) { 251 mUseSpatialFilter = b; 252 updateGL(); 253 } 254 255 256 void 257 SetViewCellGranularity(int number); 258 259 void 260 SetVisibilityFilterSize(int number); 261 262 void 263 SetSpatialFilterSize(int number); 264 265 void 266 SetSceneCut(int cut); 267 268 void 269 SetTopDistance(int dist); 270 271 void SetShowViewCells(bool b) { 272 mRenderViewCells = b; 273 updateGL(); 274 } 275 276 void SetShowRenderCost(bool b) { 277 mShowRenderCost = b; 278 updateGL(); 279 } 280 281 void SetShowPvsSizes(bool b) { 282 mShowPvsSizes = b; 283 updateGL(); 284 } 285 286 void SetTopView(bool b) { 287 mTopView = b; 288 updateGL(); 289 } 290 291 void SetCutViewCells(bool b) { 292 mCutViewCells = b; 293 updateGL(); 294 } 295 void SetCutScene(bool b) { 296 mCutScene = b; 297 updateGL(); 298 } 299 161 Q_OBJECT 162 public: 163 164 // point of the last mouse click used for movement in the scene 165 Vector3 mousePoint; 166 167 bool mTopView; 168 bool mRenderViewCells; 169 bool mCutViewCells; 170 bool mCutScene; 171 bool mRenderErrors; 172 bool mRenderFilter; 173 bool mUseFilter; 174 bool mUseSpatialFilter; 175 bool mShowRenderCost; 176 177 bool mShowPvsSizes; 178 float mSpatialFilterSize; 179 180 Plane3 mSceneCutPlane; 181 float mTopDistance; 182 183 // some statistics 184 int mPvsSize; 185 float mRenderError; 186 187 QtRendererControlWidget *mControlWidget; 188 189 QtGlRendererWidget(SceneGraph *sceneGraph, 190 ViewCellsManager *viewcells, 191 KdTree *tree, 192 QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WFlags f = 0 193 ); 194 195 QtGlRendererWidget() {}; 196 197 virtual void SetupCamera(); 198 199 void initializeGL() { 200 InitGL(); 201 } 202 void resizeGL(int w, int h); 203 void paintGL(); 204 void timerEvent(QTimerEvent *) { 205 update(); 206 } 207 208 void mousePressEvent(QMouseEvent *); 209 void mouseReleaseEvent(QMouseEvent *); 210 void mouseMoveEvent(QMouseEvent *); 211 212 void keyPressEvent ( QKeyEvent * e ) ; 213 214 void 215 RenderPvs(); 216 217 float 218 RenderErrors(); 219 void 220 RenderInfo(); 221 222 virtual int GetWidth() const { return width(); } 223 virtual int GetHeight() const { return height(); } 224 225 virtual void 226 SetupProjection(const int w, const int h, const float angle = 70.0f); 227 228 void 229 RenderViewCells(); 230 231 public slots: 232 233 void SetRenderErrors(bool b) { 234 mRenderErrors = b; 235 updateGL(); 236 } 237 238 void SetRenderFilter(bool b) { 239 mRenderFilter = b; 240 updateGL(); 241 } 242 243 void SetUseFilter(bool b) { 244 mUseFilter = b; 245 updateGL(); 246 } 247 248 void SetUseSpatialFilter(bool b) { 249 mUseSpatialFilter = b; 250 updateGL(); 251 } 252 253 254 void 255 SetViewCellGranularity(int number); 256 257 void 258 SetVisibilityFilterSize(int number); 259 260 void 261 SetSpatialFilterSize(int number); 262 263 void 264 SetSceneCut(int cut); 265 266 void 267 SetTopDistance(int dist); 268 269 void SetShowViewCells(bool b) { 270 mRenderViewCells = b; 271 updateGL(); 272 } 273 274 void SetShowRenderCost(bool b) { 275 mShowRenderCost = b; 276 updateGL(); 277 } 278 279 void SetShowPvsSizes(bool b) { 280 mShowPvsSizes = b; 281 updateGL(); 282 } 283 284 void SetTopView(bool b) { 285 mTopView = b; 286 updateGL(); 287 } 288 289 void SetCutViewCells(bool b) { 290 mCutViewCells = b; 291 updateGL(); 292 } 293 void SetCutScene(bool b) { 294 mCutScene = b; 295 updateGL(); 296 } 297 298 // matt: dummy file 299 void RenderRenderCost() {} 300 300 301 301 }; … … 306 306 Q_OBJECT 307 307 public: 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 308 QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL); 309 ~QtGlDebuggerWidget(); 310 void initializeGL(); 311 void resizeGL(int w, int h); 312 void paintGL(); 313 void timerEvent(QTimerEvent *) { update(); } 314 void mousePressEvent(QMouseEvent *) { killTimer(timerId); } 315 void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); } 316 317 void initCommon(); 318 void initPbuffer(); 319 320 321 QtGlRendererBuffer *mRenderBuffer; 322 323 Beam mBeam; 324 int mSamples; 325 Intersectable *mSourceObject; 326 326 327 327 private: 328 GLuint dynamicTexture; 329 int timerId; 328 329 GLuint dynamicTexture; 330 int timerId; 330 331 }; 331 332 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.sln
r1252 r1926 8 8 Debug = Debug 9 9 Release = Release 10 release_internal = release_internal 10 11 EndGlobalSection 11 12 GlobalSection(ProjectConfiguration) = postSolution … … 14 15 {B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.ActiveCfg = Release|Win32 15 16 {B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.Build.0 = Release|Win32 17 {B85DC7B1-58B6-4912-BD64-8B452630A368}.release_internal.ActiveCfg = release_internal|Win32 18 {B85DC7B1-58B6-4912-BD64-8B452630A368}.release_internal.Build.0 = release_internal|Win32 16 19 EndGlobalSection 17 20 GlobalSection(ExtensibilityGlobals) = postSolution -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.vcproj
r1925 r1926 90 90 <Tool 91 91 Name="VCLinkerTool" 92 AdditionalDependencies="Preprocessor.lib qtmain.lib QtGui4.lib Qt3Support4.lib QAxContainer.lib QtCore4.lib QtOpenGL4.lib xerces-c_2.lib glew32.lib OpenGL32.Lib glu32.lib cg.lib RTScene.lib RTWorld.lib cgGL.lib" 93 OutputFile="$(OutDir)/QtGlRenderer.dll" 92 AdditionalDependencies="Preprocessor.lib qtmain.lib QtGui4.lib Qt3Support4.lib QAxContainer.lib QtCore4.lib QtOpenGL4.lib xerces-c_2.lib glew32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib" 93 OutputFile="Release/QtGlRenderer.dll" 94 LinkIncremental="1" 95 AdditionalLibraryDirectories=""..\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";..\..\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;"$(CG_LIB_PATH)";"$(QTDIR)\lib"" 96 GenerateDebugInformation="FALSE" 97 SubSystem="2" 98 OptimizeReferences="2" 99 EnableCOMDATFolding="2" 100 ImportLibrary="$(OutDir)/QtGlRenderer.lib" 101 TargetMachine="1"/> 102 <Tool 103 Name="VCMIDLTool"/> 104 <Tool 105 Name="VCPostBuildEventTool" 106 Description=""copy dll to preprocessor dir"" 107 CommandLine="copy $(OutDir)\*.dll ..\..\bin\"/> 108 <Tool 109 Name="VCPreBuildEventTool"/> 110 <Tool 111 Name="VCPreLinkEventTool"/> 112 <Tool 113 Name="VCResourceCompilerTool"/> 114 <Tool 115 Name="VCWebServiceProxyGeneratorTool"/> 116 <Tool 117 Name="VCXMLDataGeneratorTool"/> 118 <Tool 119 Name="VCWebDeploymentTool"/> 120 <Tool 121 Name="VCManagedWrapperGeneratorTool"/> 122 <Tool 123 Name="VCAuxiliaryManagedWrapperGeneratorTool"/> 124 </Configuration> 125 <Configuration 126 Name="release_internal|Win32" 127 OutputDirectory="$(ConfigurationName)" 128 IntermediateDirectory="$(ConfigurationName)" 129 ConfigurationType="2" 130 CharacterSet="2"> 131 <Tool 132 Name="VCCLCompilerTool" 133 AdditionalIncludeDirectories="..\..\src;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\..\..\..\..\..\..\NonGTP\Zlib\include;"$(CG_INC_PATH)"" 134 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS" 135 RuntimeLibrary="2" 136 UsePrecompiledHeader="0" 137 WarningLevel="3" 138 Detect64BitPortabilityProblems="TRUE" 139 DebugInformationFormat="3"/> 140 <Tool 141 Name="VCCustomBuildTool" 142 Description="Performing moc on $(InputName).h" 143 CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp 144 " 145 Outputs="$(InputDir) moc_$(InputName).cpp"/> 146 <Tool 147 Name="VCLinkerTool" 148 AdditionalDependencies="Preprocessor.lib qtmain.lib QtGui4.lib Qt3Support4.lib QAxContainer.lib QtCore4.lib QtOpenGL4.lib xerces-c_2.lib glew32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib RTScene.lib RTWorld.lib" 149 OutputFile="Release/QtGlRenderer.dll" 94 150 LinkIncremental="1" 95 151 AdditionalLibraryDirectories=""$(QTDIR)\lib";..\..\..\..\..\..\..\NonGTP\Zlib\lib;"$(CG_LIB_PATH)";..\..\src\GL;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;"..\..\lib\$(ConfigurationName)";..\..\MultiLevelRayTracing\RTScene\Release;..\..\MultiLevelRayTracing\RTWorld\Release" … … 135 191 </File> 136 192 <File 193 RelativePath=".\moc_QtGlViewer.cpp"> 194 </File> 195 <File 137 196 RelativePath=".\QtGlRenderer.cpp"> 138 197 </File> 139 198 <File 140 199 RelativePath=".\QtGlRendererDll.cpp"> 200 </File> 201 <File 202 RelativePath=".\QtGlViewer.cpp"> 141 203 </File> 142 204 </Filter> … … 154 216 CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp 155 217 " 218 Outputs="$(InputDir) moc_$(InputName).cpp"/> 219 </FileConfiguration> 220 <FileConfiguration 221 Name="release_internal|Win32"> 222 <Tool 223 Name="VCCustomBuildTool" 224 Description="Performing moc on $(InputName).h" 225 CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp 226 " 227 Outputs="$(InputDir) moc_$(InputName).cpp"/> 228 </FileConfiguration> 229 </File> 230 <File 231 RelativePath=".\QtGlViewer.h"> 232 <FileConfiguration 233 Name="Release|Win32"> 234 <Tool 235 Name="VCCustomBuildTool" 236 Description="Performing moc on $(InputName).h" 237 CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp" 156 238 Outputs="$(InputDir) moc_$(InputName).cpp"/> 157 239 </FileConfiguration> -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.cpp
r1833 r1926 7 7 8 8 // C++ standard headers 9 #include <cmath>9 //#include <cmath> 10 10 11 11 // local headers -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.h
r1833 r1926 3 3 4 4 #include <QtOpenGL> 5 5 #include <QWaitCondition> 6 6 7 7 namespace GtpVisibilityPreprocessor { … … 9 9 class QtGlRendererWidget; 10 10 11 class QtGlViewer : public QGLWidget12 {13 14 Q_OBJECT15 11 16 friend class QtGlRendererWidget; 17 friend class GlRenderer; 12 class __declspec(dllexport) QtGlViewer: public QGLWidget 13 { 14 //Q_OBJECT 18 15 19 16 public: 17 18 QtGlViewer(QWidget *parent, QtGlRendererWidget *renderer); 19 20 virtual ~QtGlViewer() {}; 21 22 QSize minimumSizeHint() const; 23 QSize sizeHint() const; 24 25 // This method has to be rendefined by all renderer implementations 26 virtual void RenderScene(); 27 20 28 QtGlRendererWidget *mRenderer; 21 22 QtGlViewer(QWidget *parent, 23 QtGlRendererWidget *renderer); 24 25 virtual ~QtGlViewer(){}; 26 27 QSize minimumSizeHint() const; 28 QSize sizeHint() const; 29 30 // This method has to be rendefined by all renderer implementations 31 virtual void RenderScene(); 32 29 33 30 protected: 34 void initializeGL(); 35 void paintGL(); 36 void resizeGL(int width, int height); 37 void mousePressEvent(QMouseEvent *event); 38 void mouseMoveEvent(QMouseEvent *event); 31 32 void initializeGL(); 33 void paintGL(); 34 void resizeGL(int width, int height); 35 void mousePressEvent(QMouseEvent *event); 36 void mouseMoveEvent(QMouseEvent *event); 39 37 40 38 void keyPressEvent ( QKeyEvent * e ); 41 42 39 40 bool mWireframe; 43 41 44 42 private: 45 43 46 44 float manipulatorLastQuat[4]; 47 float scale; 48 QPoint lastPos; 45 float scale; 46 47 QPoint lastPos; 49 48 49 friend class QtGlRendererWidget; 50 friend class GlRenderer; 50 51 }; 51 52
Note: See TracChangeset
for help on using the changeset viewer.