My Project
 All Classes Files Functions Variables Enumerations Pages
triangle_mesh_viewer.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_h_
25 #define _triangle_mesh_viewer_h_
26 
27 #include "parameters_render.h"
28 #include "random.h"
29 #include "triangle_mesh.h"
31 
33 
36 class TriangleMeshViewer : public QWidget
37 {
38  private:
39 
40  Q_OBJECT;
41 
42  public:
43 
45  TriangleMeshViewer(QWidget* parent,const ParametersRender* param,const std::vector<const TriangleMesh*>& m,bool verbose);
46 
49 
51  void notify(const std::string&);
52 
54  void set_mesh(const std::vector<const TriangleMesh*>& m);
55 
56  public slots:
57 
58  void fly();
59  void unfly();
60 
61  void set_tilt(int v);
62  void set_spinrate(int v);
63 
64  private:
65 
67  const bool _verbose;
68 
70  const ParametersRender* parameters;
71 
74 
76  boost::scoped_ptr<QTime> clock;
77 
79  int last_t;
80 
82  QGroupBox* tilt_box;
83 
85  QSlider* tilt_slider;
86 
88  QWidget* button_box;
89 
91  QGroupBox* spinrate_box;
92 
94  QSlider* spinrate_slider;
95 
97  QStatusBar* statusbar;
98 
100  std::string notify_message;
101 
103  XYZ camera_position;
105  XYZ camera_forward;
106  XYZ camera_up;
107  float camera_velocity;
108  float camera_yaw_rate;
109  float camera_pitch_rate;
110  float camera_roll_rate;
112 
114  float object_tilt;
116  float object_rotation;
117  float object_spinrate;
119 
121  bool keypressed_arrow_left;
123  bool keypressed_arrow_right;
124  bool keypressed_arrow_up;
125  bool keypressed_arrow_down;
126  bool keypressed_mouse_left;
127  bool keypressed_mouse_right;
129 
131  bool fly_mode;
132 
134  void keyPressEvent(QKeyEvent* e);
135 
137  void keyReleaseEvent(QKeyEvent* e);
138 
140  void mousePressEvent(QMouseEvent* e);
141 
143  void mouseReleaseEvent(QMouseEvent* e);
144 
146  void mouseMoveEvent(QMouseEvent* e);
147 
149  void wheelEvent(QWheelEvent* e);
150 
151  private slots:
152 
153  void tick();
154 
155  void reset();
156 };
157 
158 #endif
Interface for class TriangleMesh.
Aggregates controllable parameters for all things related to OpenGL rendering.
Definition: parameters_render.h:32
Class to hold vectors in 3D cartesian co-ordinates.
Definition: xyz.h:34
~TriangleMeshViewer()
Destructor.
Definition: triangle_mesh_viewer.cpp:136
void notify(const std::string &)
Used to set message in statusbar.
Definition: triangle_mesh_viewer.cpp:139
Contains the actual rendering functionality of a TriangleMeshViewer.
Definition: triangle_mesh_viewer_display.h:34
TriangleMeshViewer(QWidget *parent, const ParametersRender *param, const std::vector< const TriangleMesh * > &m, bool verbose)
Constructor.
Definition: triangle_mesh_viewer.cpp:27
A class to display a triangle mesh.
Definition: triangle_mesh_viewer.h:36
Interface for class TriangleMeshViewerDisplay.
Interface for class Random and derived classes.
void set_mesh(const std::vector< const TriangleMesh * > &m)
Sets the TriangleMesh to be displayed.
Definition: triangle_mesh_viewer.cpp:236
Interface for class ParametersRender.