-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectionalLightComponent.cpp
More file actions
57 lines (35 loc) · 1.21 KB
/
DirectionalLightComponent.cpp
File metadata and controls
57 lines (35 loc) · 1.21 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
#include "DirectionalLightComponent.h"
#include <iostream>
DirectionalLightComponent::DirectionalLightComponent() : LightComponent(DIRECTIONAL_LIGHT) {
}
DirectionalLightComponent::~DirectionalLightComponent() {
}
void DirectionalLightComponent::init(glm::vec3 direction, glm::vec3 color, float strength) {
m_vDirection = direction;
m_vColor = color;
m_fStrength = strength;
}
void DirectionalLightComponent::setDirection(glm::vec3 direction) {
m_vDirection = direction;
}
void DirectionalLightComponent::setColor(glm::vec3 color) {
m_vColor = color;
}
void DirectionalLightComponent::setStrength(float strength) {
m_fStrength = strength;
}
glm::vec3 DirectionalLightComponent::getDirection() const {
return m_vDirection;
}
glm::vec3 DirectionalLightComponent::getColor() const {
return m_vColor;
}
float DirectionalLightComponent::getStrength() const {
return m_fStrength;
}
void DirectionalLightComponent::glData(float* dst) {
glm::vec4 transformed = getGameObject()->getMatrix() * glm::vec4(m_vDirection, 0.0f);
//std::cout << transformed.x << ", " << transformed.y << ", " << transformed.z << std::endl;
memcpy(dst, &transformed, sizeof(float) * 4);
memcpy(dst + 4, &m_vColor, sizeof(float) * 4);
}