SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Light.cpp
Go to the documentation of this file.
1#include <Lighting/Light.hpp>
2
3namespace Sleak {
4
5Light::Light(const std::string& name) : GameObject(name) {}
6
7void Light::SetColor(float r, float g, float b) {
8 m_color = Math::Vector3D(r, g, b);
9}
10
11void Light::SetColor(const Math::Color& color) {
12 Math::Vector4D norm = color.normalize();
13 m_color = Math::Vector3D(norm.GetX(), norm.GetY(), norm.GetZ());
14}
15
16} // namespace Sleak
GameObject(const std::string &name="GameObject")
Math::Vector3D m_color
Definition Light.hpp:57
Light(const std::string &name="Light")
Definition Light.cpp:5
void SetColor(float r, float g, float b)
Definition Light.cpp:7
Vector4D normalize() const noexcept
Converts to a Vector4D with each channel in [0,1].
Definition Color.hpp:93
float GetX() const
Definition Vector.hpp:536
float GetZ() const
Definition Vector.hpp:538
float GetY() const
Definition Vector.hpp:537
Root namespace for everything the engine exposes.
Definition Camera.hpp:10