source: trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.h @ 494

Revision 494, 2.1 KB checked in by bittner, 19 years ago (diff)

changes for qt 4.1.0

  • Property svn:executable set to *
Line 
1#ifndef __RENDERER_H
2#define __RENDERER_H
3
4#include <QtOpenGL>
5#include <QWaitCondition>
6
7#include "Vector3.h"
8#include "Containers.h"
9#include "Halton.h"
10
11class SceneGraph;
12class ViewCellsManager;
13class Mesh;
14class MeshInstance;
15class Intersectable;
16class Material;
17
18struct PvsRenderStatistics {
19 
20  float maxError;
21  float sumError;
22  int frames;
23  int errorFreeFrames;
24 
25  PvsRenderStatistics() { Reset(); }
26 
27  Reset() {
28        maxError = 0.0f;
29        sumError = 0.0f;
30        frames = 0;
31        errorFreeFrames = 0;
32  }
33
34  float GetMaxError() { return maxError; }
35  float GetAvgError() { return sumError/frames; }
36  float GetErrorFreeFrames() { return errorFreeFrames/(float)frames; }
37 
38};
39
40class GlRenderer : public QGLWidget
41{
42  Q_OBJECT
43public:
44  SceneGraph *mSceneGraph;
45  ObjectContainer mObjects;
46  ViewCellsManager *mViewCellsManager;
47 
48  Vector3 mViewPoint;
49  Vector3 mViewDirection;
50
51  int timerId;
52  Vector3 mousePoint;
53  bool mUseFalseColors;
54
55  HaltonSequence halton;
56 
57  bool mRender;
58  int mFrame;
59
60  int mPvsStatFrames;
61  vector<float> mPvsErrorBuffer;
62 
63  PvsRenderStatistics mPvsStat;
64 
65  QWaitCondition mRenderingFinished;
66
67  QGLPixelBuffer *pbuffer;
68 
69 
70  GlRenderer(SceneGraph *sceneGraph,
71                   ViewCellsManager *viewcells);
72
73  ~GlRenderer();
74
75  void SetupFalseColor(const int id);
76 
77  void RenderIntersectable(Intersectable *);
78  void RenderMeshInstance(MeshInstance *mi);
79  void RenderMesh(Mesh *m);
80  void SetupMaterial(Material *m);
81  void SetupCamera();
82  void RandomViewPoint();
83
84  void initializeGL();
85  void resizeGL(int w, int h);
86  void paintGL();
87  void timerEvent(QTimerEvent *) {
88        if (mRender)
89          update();
90  }
91
92  void mousePressEvent(QMouseEvent *);
93  void mouseReleaseEvent(QMouseEvent *);
94  void mouseMoveEvent(QMouseEvent *);
95
96  void
97  ClearErrorBuffer();
98
99  void
100  RenderScene();
101
102  void
103  SetupProjection(const int w, const int h);
104
105 public slots:
106 void
107 EvalPvsStat();
108 
109  float Render();
110
111  float
112  GetPixelError();
113
114
115};
116
117
118extern GlRenderer *renderer;
119
120#endif
121
Note: See TracBrowser for help on using the repository browser.