My Project
 All Classes Files Functions Variables Enumerations Pages
triangle_mesh_viewer_display.h
Go to the documentation of this file.
1 /**************************************************************************/
2 /* Copyright 2009 Tim Day */
3 /* */
4 /* This file is part of Fracplanet */
5 /* */
6 /* Fracplanet is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* Fracplanet is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with Fracplanet. If not, see <http://www.gnu.org/licenses/>. */
18 /**************************************************************************/
19 
24 #ifndef _triangle_mesh_viewer_display_h_
25 #define _triangle_mesh_viewer_display_h_
26 
27 #include "parameters_render.h"
28 #include "random.h"
29 #include "triangle_mesh.h"
30 
31 class TriangleMeshViewer;
32 
34 class TriangleMeshViewerDisplay : public QGLWidget
35 {
36  private:
37 
38  Q_OBJECT;
39 
40  public:
41 
43  TriangleMeshViewerDisplay(TriangleMeshViewer* parent,const QGLFormat& format,const ParametersRender* param,const std::vector<const TriangleMesh*>& m,bool verbose
44 );
45 
48 
50  QSize minimumSizeHint() const;
51 
53  QSize sizeHint() const;
54 
56  void set_mesh(const std::vector<const TriangleMesh*>& m);
57 
58  protected:
59 
61  void paintGL();
62 
64  void initializeGL();
65 
67  void resizeGL(int w,int h);
68 
69  public slots:
70 
72  void draw_frame(const XYZ& p,const XYZ& l,const XYZ& u,float r,float t);
73 
74  private:
75 
77  TriangleMeshViewer& _notify;
78 
80  const bool _verbose;
81 
83 
85  std::vector<const TriangleMesh*> mesh;
86 
88  const ParametersRender* parameters;
89 
91 
92  uint gl_display_list_index;
93 
94 
95 
97  uint frame_number;
98 
100  uint width;
101 
103  uint height;
104 
106  QTime frame_time;
107 
109  QTime frame_time_reported;
110 
112  std::deque<uint> frame_times;
113 
115 
116  XYZ camera_position;
117  XYZ camera_lookat;
118  XYZ camera_up;
120 
122 
123  float object_tilt;
124  float object_rotation;
126 
127  void check_for_gl_errors(const char*) const;
128 
130  const FloatRGBA background_colour() const;
131 };
132 
133 #endif