-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLight.cpp
More file actions
175 lines (132 loc) · 2.79 KB
/
Light.cpp
File metadata and controls
175 lines (132 loc) · 2.79 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#include "Light.h"
Light::Light(QObject* parent) : QObject(parent)
{
}
QVector3D Light::position() const
{
return lightPosition;
}
void Light::setPosition(QVector3D position)
{
if (!qFuzzyCompare((lightPosition - position).length(), 0))
{
lightPosition = position;
positionChanged(position);
}
}
QVector3D Light::direction() const
{
return lightDirection;
}
void Light::setDirection(QVector3D direction)
{
if (!qFuzzyCompare((lightDirection.normalized() - direction.normalized()).length(), 0))
{
lightDirection = direction;
positionChanged(direction);
}
}
QString Light::name() const
{
return lightName;
}
void Light::setName(QString name)
{
if (lightName != name)
{
lightName = name;
emit nameChanged(name);
}
}
Light::LightType Light::lightType() const
{
return type;
}
void Light::setLightType(Light::LightType lightType)
{
if (type != lightType)
{
type = lightType;
emit lightTypeChanged(lightType);
}
}
bool Light::visibility() const
{
return lightVisibility;
}
void Light::setVisibility(bool visibility)
{
if (lightVisibility != visibility)
{
lightVisibility = visibility;
emit visibilityChanged(visibility);
}
}
QColor Light::color() const
{
return lightColor;
}
void Light::setColor(QColor color)
{
if (lightColor != color)
{
lightColor = color;
emit colorChanged(color);
}
}
float Light::brightness() const
{
return lightBrightness;
}
void Light::setBrightness(float brightness)
{
if (lightBrightness != brightness)
{
lightBrightness = brightness;
emit brightnessChanged(brightness);
}
}
float Light::attenuationRadius() const
{
return lightAttenuationRadius;
}
void Light::setAttenuationRadius(float attenuationRadius)
{
if (lightAttenuationRadius != attenuationRadius)
{
lightAttenuationRadius = attenuationRadius;
emit attenuationRadiusChanged(attenuationRadius);
}
}
float Light::innerConeAngle() const
{
return lightInnerConeAngle;
}
void Light::setInnerConeAngle(float innerConeAngle)
{
if (innerConeAngle > lightOuterConeAngle)
{
innerConeAngle = lightOuterConeAngle;
}
if (lightInnerConeAngle != innerConeAngle)
{
lightInnerConeAngle = innerConeAngle;
emit innerConeAngleChanged(innerConeAngle);
}
}
float Light::outerConeAngle() const
{
return lightOuterConeAngle;
}
void Light::setOuterConeAngle(float outerConeAngle)
{
if (outerConeAngle < lightInnerConeAngle)
{
outerConeAngle = lightInnerConeAngle;
}
if (lightOuterConeAngle != outerConeAngle)
{
lightOuterConeAngle = outerConeAngle;
emit outerConeAngleChanged(outerConeAngle);
}
}