blob: 28fe28101ab01bdd53242f057a353f320bf2978a (
plain)
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
|
#include "DirectionalLight.hpp"
namespace renderer {
DirectionalLight::DirectionalLight ()
: mDirection( 0.3f, 1.0f, 0.5f ), mColor( 1.0f, 1.0f, 1.0f ), mIntensity( 1.0f ) {
}
void DirectionalLight::setDirection ( const glm::vec3& dir ) {
mDirection = dir;
}
void DirectionalLight::setColor ( const glm::vec3& c ) {
mColor = c;
}
void DirectionalLight::setIntensity ( float i ) {
mIntensity = i;
}
const glm::vec3& DirectionalLight::getDirection () const {
return mDirection;
}
const glm::vec3& DirectionalLight::getColor () const {
return mColor;
}
float DirectionalLight::getIntensity () const {
return mIntensity;
}
void DirectionalLight::applyToShader ( const Shader& shader, const std::string& uniformName ) const {
shader.setVec3( uniformName + ".direction", mDirection );
shader.setVec3( uniformName + ".color", mColor );
shader.setFloat( uniformName + ".intensity", mIntensity );
}
} // namespace renderer
|