diff options
Diffstat (limited to 'apps/openmb/renderer/DirectionalLight.cpp')
| -rw-r--r-- | apps/openmb/renderer/DirectionalLight.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/openmb/renderer/DirectionalLight.cpp b/apps/openmb/renderer/DirectionalLight.cpp new file mode 100644 index 0000000..28fe281 --- /dev/null +++ b/apps/openmb/renderer/DirectionalLight.cpp @@ -0,0 +1,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 |