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  XYZ camera_position;
117  XYZ camera_lookat;
118  XYZ camera_up;
120 
122  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
QSize sizeHint() const
Guideline size.
Definition: triangle_mesh_viewer_display.cpp:66
Interface for class TriangleMesh.
void resizeGL(int w, int h)
Deal with resize.
Definition: triangle_mesh_viewer_display.cpp:438
void initializeGL()
Set up OpenGL.
Definition: triangle_mesh_viewer_display.cpp:407
~TriangleMeshViewerDisplay()
Destructor.
Definition: triangle_mesh_viewer_display.cpp:54
Aggregates controllable parameters for all things related to OpenGL rendering.
Definition: parameters_render.h:32
QSize minimumSizeHint() const
Specify a minimum size.
Definition: triangle_mesh_viewer_display.cpp:61
Class to hold vectors in 3D cartesian co-ordinates.
Definition: xyz.h:34
void draw_frame(const XYZ &p, const XYZ &l, const XYZ &u, float r, float t)
Called to redisplay scene.
Definition: triangle_mesh_viewer_display.cpp:464
void set_mesh(const std::vector< const TriangleMesh * > &m)
Set the mesh being rendered.
Definition: triangle_mesh_viewer_display.cpp:71
Contains the actual rendering functionality of a TriangleMeshViewer.
Definition: triangle_mesh_viewer_display.h:34
A class to display a triangle mesh.
Definition: triangle_mesh_viewer.h:36
Class to represent red-green-blue-alpha colours stored to floating point accuracy.
Definition: rgb.h:173
void paintGL()
Called to repaint GL area.
Definition: triangle_mesh_viewer_display.cpp:128
Interface for class Random and derived classes.
TriangleMeshViewerDisplay(TriangleMeshViewer *parent, const QGLFormat &format, const ParametersRender *param, const std::vector< const TriangleMesh * > &m, bool verbose)
Constructor.
Definition: triangle_mesh_viewer_display.cpp:29
Interface for class ParametersRender.