2#ifdef StevEngine_RENDERER_GL
3#include "main/Component.hpp"
4#include "utilities/Vector3.hpp"
5#include "visuals/shaders/ShaderProgram.hpp"
7#define DIRECTIONAL_LIGHT_TYPE "DirectionalLight"
8#define POINT_LIGHT_TYPE "PointLight"
9#define SPOT_LIGHT_TYPE "SpotLight"
11namespace StevEngine::Visuals {
73 std::string
GetType()
const {
return DIRECTIONAL_LIGHT_TYPE; }
115 std::string
GetType()
const {
return POINT_LIGHT_TYPE; }
160 std::string
GetType()
const {
return SPOT_LIGHT_TYPE; }
Component()
Create new component.
Definition Component.cpp:10
static bool RegisterComponentType(std::string type)
Register a component type for creation.
Definition Component.hpp:133
Compiled and linked shader program.
Definition ShaderProgram.hpp:22
Stream for serialization of data.
Definition Stream.hpp:20
3D vector class
Definition Vector3.hpp:19
Directional light for parallel light rays.
Definition Lights.hpp:54
std::string GetType() const
Get component type.
Definition Lights.hpp:73
DirectionalLight(Utilities::Vector3 diffuse=Utilities::Vector3(1.0), Utilities::Vector3 specular=Utilities::Vector3(1.0))
Create directional light.
Definition Lights.cpp:14
Utilities::Stream Export(Utilities::StreamType type) const
Serialize component to a stream.
Definition Lights.cpp:104
void UpdateShader(const Renderer::ShaderProgram &program) const
Update shader uniforms for this light.
Definition Lights.cpp:27
void ResetShader(const Renderer::ShaderProgram &program) const
Reset shader uniforms for this light.
Definition Lights.cpp:34
Base class for light components.
Definition Lights.hpp:18
virtual void ResetShader(const Renderer::ShaderProgram &program) const =0
Reset shader uniforms for this light.
const uint32_t shaderLightID
Light index in shader.
Definition Lights.hpp:44
virtual void UpdateShader(const Renderer::ShaderProgram &program) const =0
Update shader uniforms for this light.
Utilities::Vector3 specular
Specular light color.
Definition Lights.hpp:21
uint32_t GetShaderLightID() const
Get shader light ID.
Definition Lights.hpp:39
Utilities::Vector3 diffuse
Diffuse light color.
Definition Lights.hpp:20
void ResetShader(const Renderer::ShaderProgram &program) const
Reset shader uniforms for this light.
Definition Lights.cpp:55
PointLight(Utilities::Vector3 diffuse=Utilities::Vector3(1.0), Utilities::Vector3 specular=Utilities::Vector3(1.0), float constant=1.0, float linear=0.02, float quadratic=0.0017)
Create point light.
Definition Lights.cpp:18
float linear
Linear attenuation factor.
Definition Lights.hpp:125
float quadratic
Quadratic attenuation factor.
Definition Lights.hpp:126
void UpdateShader(const Renderer::ShaderProgram &program) const
Update shader uniforms for this light.
Definition Lights.cpp:44
std::string GetType() const
Get component type.
Definition Lights.hpp:115
float constant
Constant attenuation factor.
Definition Lights.hpp:124
Utilities::Stream Export(Utilities::StreamType type) const
Serialize component to a stream.
Definition Lights.cpp:114
float outerCutOff
Outer cone angle in degrees.
Definition Lights.hpp:170
SpotLight(Utilities::Vector3 diffuse=Utilities::Vector3(1.0), Utilities::Vector3 specular=Utilities::Vector3(1.0), float cutOff=12.5, float outerCutOff=17.5)
Create spot light.
Definition Lights.cpp:22
void ResetShader(const Renderer::ShaderProgram &program) const
Reset shader uniforms for this light.
Definition Lights.cpp:80
void UpdateShader(const Renderer::ShaderProgram &program) const
Update shader uniforms for this light.
Definition Lights.cpp:69
float cutOff
Inner cone angle in degrees.
Definition Lights.hpp:169
std::string GetType() const
Get component type.
Definition Lights.hpp:160
Utilities::Stream Export(Utilities::StreamType type) const
Serialize component to a stream.
Definition Lights.cpp:127