/
RotateManipulator.h
83 lines (69 loc) · 1.96 KB
/
RotateManipulator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#include "irender.h"
#include "Rotatable.h"
#include "ManipulatorBase.h"
#include "ManipulatorComponents.h"
#include "selection/Renderables.h"
#include "selection/Pivot2World.h"
#include "selection/BasicSelectable.h"
#include "selection/ManipulationPivot.h"
#include "render.h"
namespace selection
{
/**
* Manipulator for performing rotations with the mouse.
*
* Draws circles for rotation around individual axes, plus a circle for free
* rotation.
*/
class RotateManipulator :
public ManipulatorBase,
public Rotatable,
public OpenGLRenderable
{
private:
ManipulationPivot& _pivot;
TranslatablePivot _pivotTranslatable;
RotateFree _rotateFree;
RotateAxis _rotateAxis;
TranslateFree _translatePivot;
Vector3 _axisScreen;
RenderableSemiCircle _circleX;
RenderableSemiCircle _circleY;
RenderableSemiCircle _circleZ;
RenderableCircle _circleScreen;
RenderableCircle _circleSphere;
RenderablePointVector _pivotPoint;
BasicSelectable _selectableX;
BasicSelectable _selectableY;
BasicSelectable _selectableZ;
BasicSelectable _selectableScreen;
BasicSelectable _selectableSphere;
BasicSelectable _selectablePivotPoint;
Pivot2World _pivot2World;
Matrix4 _local2worldX;
Matrix4 _local2worldY;
Matrix4 _local2worldZ;
bool _circleX_visible;
bool _circleY_visible;
bool _circleZ_visible;
public:
static ShaderPtr _stateOuter;
static ShaderPtr _pivotPointShader;
// Constructor
RotateManipulator(ManipulationPivot& pivot, std::size_t segments, float radius);
Type getType() const override
{
return Rotate;
}
void UpdateColours();
void updateCircleTransforms();
void render(RenderableCollector& collector, const VolumeTest& volume) override;
void render(const RenderInfo& info) const override;
void testSelect(const render::View& view, const Matrix4& pivot2world) override;
Component* getActiveComponent() override;
void setSelected(bool select) override;
bool isSelected() const override;
void rotate(const Quaternion& rotation) override;
};
}