-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointLightComponent.cpp
More file actions
62 lines (39 loc) · 1.16 KB
/
PointLightComponent.cpp
File metadata and controls
62 lines (39 loc) · 1.16 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
#include "PointLightComponent.h"
PointLightComponent::PointLightComponent() : LightComponent(Component::POINT_LIGHT) {
m_fRadius = 10.0f;
m_vColor = glm::vec3(1.0f);
m_fStrength = 1.0f;
}
PointLightComponent::~PointLightComponent() {
}
void PointLightComponent::init(float radius, glm::vec3 color, float strength) {
m_fRadius = radius;
m_vColor = color;
m_fStrength = strength;
}
void PointLightComponent::accept(Visitor* visitor) {
visitor->visitPointLightComponent(this);
}
void PointLightComponent::setRadius(float radius) {
m_fRadius = radius;
}
void PointLightComponent::setColor(glm::vec3 color) {
m_vColor = color;
}
void PointLightComponent::setStrength(float strength) {
m_fStrength = strength;
}
float PointLightComponent::getRadius() const {
return m_fRadius;
}
glm::vec3 PointLightComponent::getColor() const {
return m_vColor;
}
float PointLightComponent::getStrength() const {
return m_fStrength;
}
void PointLightComponent::glData(float* dst) {
glm::vec4 global_position = getGameObject()->getMatrix() * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
memcpy(dst, &global_position, sizeof(float) * 3);
memcpy(dst + 3, &m_fRadius, sizeof(float) * 5);
}