-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransformController.h
More file actions
67 lines (55 loc) · 1.85 KB
/
TransformController.h
File metadata and controls
67 lines (55 loc) · 1.85 KB
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
#ifndef TRANSFORM_CONTROLLER
#define TRANSFORM_CONTROLLER
#define AXIS_HEIGHT 1.2
#define AXIS_WIDTH 0.2
#define TC_AXIS_X 1
#define TC_AXIS_Y 2
#define TC_AXIS_Z 3
#include "Cube.h"
#include "Camera.h"
#include "TransformShader.h"
#include <glm/glm.hpp>
class TransformController {
public:
TransformController();
~TransformController();
void deselectAxis();
void render(Camera& camera, TransformShader& shader);
Cube* getXController() {return _xControl;}
Cube* getYController() {return _yControl;}
Cube* getZController() {return _zControl;}
glm::vec3 getPosition() {return _controlPosition;}
glm::vec3 getAxisPosition(int id)
{
if(id == TC_AXIS_X)
return _controlPosition + _xControl->getPosition();
else if(id == TC_AXIS_Y)
return _controlPosition + _yControl->getPosition();
else if(id == TC_AXIS_Z)
return _controlPosition + _zControl->getPosition();
else
printf("Axis id: %d does not exist\n", id);
return glm::vec3(0.0f);
}
bool isVisible() {return _visible;}
bool inControl() {return _inControl;}
bool allAxisSelected() {return _allAxisSelected;}
void setPosition(glm::vec3 position) {_controlPosition = position;}
void setVisible(bool visible) {_visible = visible;}
void setControlling(bool control) {_inControl = control;}
void setAllAxisSelected(bool selected) {_allAxisSelected = selected;}
void moveX(float amount) {_controlPosition.x += amount;}
void moveY(float amount) {_controlPosition.y += amount;}
void moveZ(float amount) {_controlPosition.z += amount;}
float distance;
bool selectLocUpdated = false;
private:
Cube* _xControl;
Cube* _yControl;
Cube* _zControl;
glm::vec3 _controlPosition;
bool _visible;
bool _inControl;
bool _allAxisSelected;
};
#endif