Renderable.hpp
Go to the documentation of this file.
1 
28  /*
29  * Renderable.h
30  *
31  * Created on: 26.08.2008
32  * Author: Thomas Wiemann
33  *
34  */
35 
36 #ifndef RENDERABLE_H_
37 #define RENDERABLE_H_
38 
39 #if _MSC_VER
40 #include <Windows.h>
41 #endif
42 
43 
44 #ifndef __APPLE__
45 #include <GL/gl.h>
46 #include <GL/glut.h>
47 #else
48 #include <OpenGL/gl.h>
49 #include <GLUT/glut.h>
50 #endif
51 
52 #include <string>
53 using namespace std;
54 
59 
60 #include "lvr2/io/Model.hpp"
61 
62 namespace lvr2
63 {
64 
65 class Renderable {
66 
67 public:
68 
70 
71  Renderable();
72  Renderable(const Renderable &other);
73  Renderable(string name);
74  Renderable(Matrix4<Vec> m, string name);
75 
76 
77  virtual ~Renderable();
78  virtual void render() = 0;
79 
80  void setTransformationMatrix(Matrix4<Vec> m);
81 
82  virtual void setName(string s){m_name = s;};
83  void setVisible(bool s){m_visible = s;};
84  void setRotationSpeed(float s){m_rotationSpeed = s;};
85  void setTranslationSpeed(float s){m_translationSpeed = s;};
86  void setActive(bool a){m_active = a;};
87  void setSelected(bool s) {m_selected = s;};
88 
89  bool isActive(){return m_active;}
90  bool isSelected() { return m_selected;}
91 
92  void toggle(){m_active = !m_active;}
93 
94  void moveX(bool invert = 0)
95  {invert ? m_position.x -= m_translationSpeed: m_position.x += m_translationSpeed; computeMatrix();};
96 
97  void moveY(bool invert = 0)
98  {invert ? m_position.y -= m_translationSpeed: m_position.y += m_translationSpeed; computeMatrix();};
99 
100  void moveZ(bool invert = 0)
101  {invert ? m_position.z -= m_translationSpeed: m_position.z += m_translationSpeed; computeMatrix();};
102 
103  void rotX(bool invert = 0);
104  void rotY(bool invert = 0);
105  void rotZ(bool invert = 0);
106 
107  void yaw(bool invert = 0);
108  void pitch(bool invert = 0);
109  void roll(bool invert = 0);
110 
111  void accel(bool invert = 0);
112  void lift(bool invert = 0);
113  void strafe(bool invert = 0);
114 
115  void scale(float s);
116 
117  void showAxes(bool on){ m_showAxes = on;};
118 
119  void compileAxesList();
120 
121  string Name() {return m_name;};
122  Matrix4<Vec> getTransformation(){return m_transformation;};
123 
124  BoundingBox<Vec>* boundingBox() { return m_boundingBox;};
125 
126  virtual ModelPtr model()
127  {
128  return m_model;
129  }
130 
131  void setPointSize(float size) { m_pointSize = size;}
132  void setLineWidth(float width) { m_lineWidth = width;}
133 
134  float lineWidth() { return m_lineWidth;}
135  float pointSize() { return m_pointSize;}
136 
137 protected:
138 
139  virtual void transform();
140  void computeMatrix();
141 
142  bool m_visible;
144  bool m_active;
146 
147 
151 
155 
156  string m_name;
157 
161 
163 
166 
168 
169  float m_lineWidth;
170  float m_pointSize;
171 };
172 
173 } // namespace lvr2
174 
175 #endif /* RENDERABLE_H_ */
float m_translationSpeed
Definition: Renderable.hpp:153
Normal< typename Vec::CoordType > m_z_Axis
Definition: Renderable.hpp:160
void render()
A 4x4 matrix class implementation for use with the provided vertex types.
Definition: Matrix4.hpp:64
Normal< typename Vec::CoordType > m_xAxis
Definition: Renderable.hpp:158
void setRotationSpeed(float s)
Definition: Renderable.hpp:84
void moveX(bool invert=0)
Definition: Renderable.hpp:94
void setTranslationSpeed(float s)
Definition: Renderable.hpp:85
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
void moveY(bool invert=0)
Definition: Renderable.hpp:97
void setActive(bool a)
Definition: Renderable.hpp:86
virtual void setName(string s)
Definition: Renderable.hpp:82
BoundingBox< Vec > * boundingBox()
Definition: Renderable.hpp:124
void setPointSize(float size)
Definition: Renderable.hpp:131
std::shared_ptr< Model > ModelPtr
Definition: Model.hpp:80
Matrix4< Vec > getTransformation()
Definition: Renderable.hpp:122
void setVisible(bool s)
Definition: Renderable.hpp:83
BoundingBox< Vec > * m_boundingBox
Definition: Renderable.hpp:165
virtual ModelPtr model()
Definition: Renderable.hpp:126
void moveZ(bool invert=0)
Definition: Renderable.hpp:100
Matrix4< Vec > m_transformation
Definition: Renderable.hpp:164
void showAxes(bool on)
Definition: Renderable.hpp:117
Normal< typename Vec::CoordType > m_yAxis
Definition: Renderable.hpp:159
void setLineWidth(float width)
Definition: Renderable.hpp:132
void setSelected(bool s)
Definition: Renderable.hpp:87
PointBufferPtr transform(PointBufferPtr pc_in, const Transformd &T)
Definition: qttf.cpp:32


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:09