-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqml_camera.cpp
83 lines (58 loc) · 1.98 KB
/
qml_camera.cpp
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
#include "qml_camera.h"
#include "openglitem.h"
CustomItemBase* getParent();
Qml_camera::Qml_camera(QObject* parent) : QObject(parent) {
}
QObject* Qml_camera::getParent(){
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
return parent;
}
void Qml_camera::updateRenderer(){
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
parent->update();
}
void Qml_camera::setMovementSpeed(const float &movSpeed){
if (movSpeed != m_movementSpeed){
m_movementSpeed = movSpeed;
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
parent->getCamera()->setMovementSpeed(m_movementSpeed);
parent->update();
emit movementSpeedChanged();
}
}
void Qml_camera::setRotationSpeed(const float &rotSpeed){
if (rotSpeed != m_rotationSpeed){
m_rotationSpeed = rotSpeed;
CustomItemBase *parent = (CustomItemBase*) getParent();
parent->getCamera()->setRotationSpeed(m_rotationSpeed);
parent->update();
emit rotationSpeedChanged();
}
}
void Qml_camera::setFov(const float &fov){
if (fov != m_fov){
m_fov = fov;
CustomItemBase *parent = (CustomItemBase*) getParent();
parent->getCamera()->setFov(m_fov);
parent->update();
emit fovChanged();
}
}
void Qml_camera::setNearDistance(const float &nearDistance){
if (nearDistance != m_nearDistance){
m_nearDistance = nearDistance;
CustomItemBase *parent = (CustomItemBase*) getParent();
parent->getCamera()->setNearDistance(m_nearDistance);
parent->update();
emit nearDistanceChanged();
}
}
void Qml_camera::setFarDistance(const float &farDistance){
if (farDistance != m_farDistance){
m_farDistance = farDistance;
CustomItemBase *parent = (CustomItemBase*) getParent();
parent->getCamera()->setFarDistance(m_farDistance);
parent->update();
emit farDistanceChanged();
}
}