-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqml_light.cpp
136 lines (95 loc) · 3.12 KB
/
qml_light.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include "qml_light.h"
#include "openglitem.h"
CustomItemBase* getParent();
Qml_light::Qml_light(QObject* parent) : QObject(parent) {
}
QObject* Qml_light::getParent(){
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
return parent;
}
void Qml_light::updateRenderer(){
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
parent->update();
}
void Qml_light::setAmbient(const QString &ambient, bool init)
{
if (ambient != m_ambient){
m_ambient = ambient;
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
parent->getLight()->setAmbient(m_ambient);
parent->update();
emit ambientChanged();
}
}
void Qml_light::setDiffuse(const QString &diffuse){
if (diffuse != m_diffuse){
m_diffuse = diffuse;
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
parent->getLight()->setDiffuse(m_diffuse);
parent->update();
emit diffuseChanged();
}
}
void Qml_light::setSpecular(const QString &specular){
if (specular != m_specular){
m_specular = specular;
CustomItemBase* parent = static_cast<CustomItemBase*>(this->parent());
parent->getLight()->setSpecular(m_specular);
parent->update();
emit specularChanged();
}
}
void Qml_light::setPointLight(const bool &pointLight){
if (pointLight != m_pointLight){
m_pointLight = pointLight;
CustomItemBase *parent = (CustomItemBase*) getParent();
//parent->getLight()->setQuadratic(m_quadratic);
parent->update();
emit pointLightChanged();
}
}
void Qml_light::setLinear(const float &linear){
if (linear != m_linear){
m_linear = linear;
CustomItemBase *parent = (CustomItemBase*) getParent();
//parent->getLight()->setLinear(m_linear);
parent->update();
emit linearChanged();
}
}
void Qml_light::setQuadratic(const float &quadratic){
if (quadratic != m_quadratic){
m_quadratic = quadratic;
CustomItemBase *parent = (CustomItemBase*) getParent();
//parent->getLight()->setQuadratic(m_quadratic);
parent->update();
emit quadraticChanged();
}
}
void Qml_light::setSpotLight(const bool &spotLight){
if (spotLight != m_spotLight){
m_spotLight = spotLight;
CustomItemBase *parent = (CustomItemBase*) getParent();
//parent->getLight()->setQuadratic(m_quadratic);
parent->update();
emit spotLightChanged();
}
}
void Qml_light::setCutOff(const float &cutOff){
if (cutOff != m_cutOff){
m_cutOff = cutOff;
CustomItemBase *parent = (CustomItemBase*) getParent();
//parent->getLight()->setQuadratic(m_quadratic);
parent->update();
emit cutOffChanged();
}
}
void Qml_light::setOutCutOff(const float &outCutOff){
if (outCutOff != m_outCutOff){
m_outCutOff = outCutOff;
CustomItemBase *parent = (CustomItemBase*) getParent();
//parent->getLight()->setQuadratic(m_quadratic);
parent->update();
emit outCutOffChanged();
}
}