diff options
author | jjesswan <jessica_wan@brown.edu> | 2024-04-22 21:56:26 -0400 |
---|---|---|
committer | jjesswan <jessica_wan@brown.edu> | 2024-04-22 21:56:26 -0400 |
commit | a556b45abf18f1bd509daaf63b66b7d55e9fd291 (patch) | |
tree | bc9b8a2d184c12aee236e7f9f276a34b84ca552d /engine-ocean/Graphics/light.cpp | |
parent | cd7c76017a12bb548036571c1ff13e551369d06d (diff) |
add engine version
Diffstat (limited to 'engine-ocean/Graphics/light.cpp')
-rw-r--r-- | engine-ocean/Graphics/light.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/engine-ocean/Graphics/light.cpp b/engine-ocean/Graphics/light.cpp new file mode 100644 index 0000000..e2e5a38 --- /dev/null +++ b/engine-ocean/Graphics/light.cpp @@ -0,0 +1,69 @@ +#include "light.h" + + +Light::Light(LightType type, glm::vec3 lightData, glm::vec3 lightColor): + m_lightType(type), + m_lightColor(lightColor), + m_lightFunction(glm::vec3(1)) +{ + switch(type){ + case LightType::POINT: + m_lightPos = lightData; + break; + case LightType::DIRECTIONAL: + m_lightDir = lightData; + break; + } +} + +Light::~Light(){ + +} + +void Light::setPos(glm::vec3 newPos){ + m_lightPos = newPos; +} + +glm::vec3 Light::getPos(){ + return m_lightPos; +} + +void Light::translate(glm::vec3 delta){ + m_lightPos += delta; +} + +void Light::setAttenuation(glm::vec3 attenuation){ + m_lightFunction = attenuation; +} + +glm::vec3 Light::getAttenuation(){ + return m_lightFunction; +} + +void Light::setDir(glm::vec3 newDir){ + m_lightDir = newDir; +} + +glm::vec3 Light::getDir(){ + return m_lightDir; +} + +void Light::rotate(float angle, glm::vec3 axis){ + m_lightDir = glm::vec3(glm::rotate(glm::mat4(1), angle, axis)*glm::vec4(m_lightDir, 0)); +} + +void Light::setColor(glm::vec3 newColor){ + m_lightColor = newColor; +} + +glm::vec3 Light::getColor(){ + return m_lightColor; +} + +void Light::setType(LightType newType){ + m_lightType = newType; +} + +LightType Light::getType(){ + return m_lightType; +} |