Cutout Vis2012
TUWienVisualisierung2(SS2012)-AdaptiveCutaways
Main Page
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Pages
src
Gizmo.h
1
#ifndef _GIZMO_H_
2
#define _GIZMO_H_
3
4
#include "Identifiable.h"
5
#include "Renderable.h"
6
#include "Mesh.h"
7
#include "SceneNode.h"
8
#include "Plane.h"
9
#include <glm/glm.hpp>
10
11
class
TranslateGizmo
;
12
class
ScaleGizmo
;
13
class
Scene
;
14
20
class
Gizmo
:
public
Renderable
21
{
22
public
:
23
Gizmo
(
Scene
* scene);
24
28
void
setTarget
(
SceneNode
* target);
33
void
render
(
Shader
* shader);
37
void
update
();
38
39
void
setVisible(
bool
visible);
40
bool
isVisible();
41
45
void
stopEdit
();
46
47
private
:
48
SceneNode
* _target;
49
TranslateGizmo
*_tX, *_tY, *_tZ;
50
ScaleGizmo
* _s;
51
bool
_visible;
52
53
Scene
* _scene;
54
};
55
59
class
SubGizmo
:
public
Identifiable
60
{
61
public
:
62
friend
class
Gizmo
;
63
64
SubGizmo
(
Scene
* scene);
65
66
Scene
* getScene();
67
71
virtual
void
render
(
Shader
* shader)=0;
75
virtual
void
hover
();
79
virtual
UserAction
press
()=0;
80
84
void
stopEdit
();
88
void
setTarget
(
SceneNode
* target);
92
SceneNode
*
getTarget
();
93
97
virtual
void
update
()=0;
98
102
bool
isIdle
();
106
bool
isHovering
();
110
bool
isEditing
();
111
115
void
setIdle
();
119
void
setEditing
();
120
121
private
:
122
enum
SubGizmoState
123
{
124
IDLE,
125
HOVERING,
126
EDITING
127
};
128
129
Scene
* _scene;
130
131
SceneNode
* _target;
132
133
SubGizmoState _state;
134
};
135
139
class
ScaleGizmo
:
public
SubGizmo
140
{
141
public
:
142
ScaleGizmo
(
Scene
* scene);
143
144
virtual
void
render
(
Shader
* shader);
145
virtual
UserAction
press
();
146
147
virtual
void
update
();
148
149
private
:
150
Mesh
* _mesh;
151
152
int
_mouseStartX, _mouseStartY;
153
float
_scaleStart;
154
155
static
GLfloat VERTEX_POSITION[], VERTEX_COLOR[];
156
static
GLuint VERTEX_INDICES[];
157
};
158
163
class
TranslateGizmo
:
public
SubGizmo
164
{
165
public
:
166
// x=0, y=1, z=2
171
TranslateGizmo
(
Scene
* scene,
int
axis);
172
173
virtual
void
render
(
Shader
* shader);
174
virtual
UserAction
press
();
175
176
virtual
void
update
();
177
178
private
:
179
180
Mesh
* _mesh;
181
int
_axis;
182
183
glm::vec3 _color;
184
185
float
_mouseOffsetX, _mouseOffsetY;
186
Plane
_translationPlane;
187
188
static
GLfloat VERTEX_POSITION_X[], VERTEX_POSITION_Y[], VERTEX_POSITION_Z[], VERTEX_COLOR[];
189
};
190
191
192
#endif
Generated on Mon Jun 10 2013 17:20:11 for Cutout Vis2012 by
1.8.4