diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /apps/openmb/renderer/DirectionalLight.cpp | |
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 |