Temp
This commit is contained in:
37
project/src/Light.cpp
Normal file
37
project/src/Light.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "Light.h"
|
||||
#include <cmath>
|
||||
|
||||
Light::Light()
|
||||
: m_Position(0.0f, 10.0f, 0.0f),
|
||||
m_Target(0.0f, 0.0f, 0.0f),
|
||||
m_Up(0.0f, 1.0f, 0.0f),
|
||||
m_ViewMatrix(dae::Matrix()),
|
||||
m_ProjectionMatrix(dae::Matrix()) {}
|
||||
|
||||
void Light::SetPosition(const dae::Vector3 &position) {
|
||||
m_Position = position;
|
||||
}
|
||||
|
||||
void Light::SetTarget(const dae::Vector3 &target) {
|
||||
m_Target = target;
|
||||
}
|
||||
|
||||
void Light::SetUp(const dae::Vector3 &up) {
|
||||
m_Up = up;
|
||||
}
|
||||
|
||||
dae::Matrix Light::GetViewMatrix() const {
|
||||
return dae::Matrix::CreateLookAtLH(m_Position, m_Target, m_Up);
|
||||
}
|
||||
|
||||
dae::Matrix Light::GetProjectionMatrix(float nearPlane, float farPlane, float size) const {
|
||||
return dae::Matrix::CreateOrthographic(size, size, nearPlane, farPlane);
|
||||
}
|
||||
|
||||
dae::Matrix Light::GetViewProjectionMatrix(float nearPlane, float farPlane, float size) const {
|
||||
return GetViewMatrix() * GetProjectionMatrix(nearPlane, farPlane, size);
|
||||
}
|
||||
|
||||
void Light::Update() {
|
||||
// If the light position or target changes dynamically, this is where updates would be managed.
|
||||
}
|
||||
Reference in New Issue
Block a user