YAGE
1.0
Yet Another Game Engine
|
A light is a special class of Game Object that mostly just sends uniform data to the shaders. Lights are fundamental to the shading pipeline! Without a light, nothing will show up in the scene. More...
#include <Light.h>
Classes | |
struct | LightUniformLocations |
Holds the various uniform location ID's of the Light. More... | |
Public Member Functions | |
Light () | |
~Light () | |
virtual void | Draw (GLuint) override |
Sets up the light uniform location id's from the program. Each subclass must then send their corresponding params to the shader. More... | |
virtual void | DrawShadow (GLuint) override |
Sends shadow information. Each subclass must implement this functionality! More... | |
virtual void | Update () override |
Updates the light. This currently does nothing! Draw() does update the light. More... | |
virtual void | Destroy () override |
Destroys the light. This currently only turns off the enabled flag! More... | |
virtual void | SetTexture (const std::string &, const TextureType &, const GLuint &) override |
Adds a texture to an object. More... | |
virtual const GLuint | GetTexture (const std::string &) const override |
Gets a texture. More... | |
bool | EnableShadows () |
Enables shadow generation for this light. More... | |
bool | DisableShadows () |
Disables shadow generation for this light. More... | |
void | SetAttenuation (float constant=0.0f, float linear=1.0f, float quadratic=0.0f) |
Sets the attenutation parameters. See this wiki article for more information about attenuation: https://developer.valvesoftware.com/wiki/Constant-Linear-Quadratic_Falloff. More... | |
![]() | |
virtual | ~IGameObject () |
Destructor that deletes the unique shader program and shadow program belonging to the object. More... | |
virtual void | SetProgram (GLuint shaderName) |
Sets the main shader program corresponding to this object. More... | |
virtual void | SetShadowProgram (GLuint shaderName) |
Sets the shadow pass shader program corresponding to this object. More... | |
virtual GLuint | GetProgram () |
Gets the object's main shader program. More... | |
virtual GLuint | GetShadowProgram () |
Gets the object's shadow program. More... | |
Public Attributes | |
glm::vec3 | ambient |
light's contribution to ambient light. More... | |
glm::vec3 | color |
The color/intensity of the light. More... | |
glm::vec3 | position |
location of light if isLocal is true. For directional light, it is the direction More... | |
glm::vec3 | halfVector |
?? direction of headlights for directional light ?? More... | |
glm::vec3 | coneDirection |
spotlight cone direction. More... | |
float | spotCosCutoff |
how wide the spotlight is [0-1]. More... | |
float | spotExponent |
control light fall-off in the spotlight. More... | |
float | constantAttenuation |
constant light fall-out More... | |
float | linearAttenuation |
linear light fall-off More... | |
float | quadraticAttenuation |
quadratic light fall-out More... | |
bool | isEnabled |
true if this object is enabled. More... | |
Protected Attributes | |
GLuint | texture |
unsigned int | _id |
bool | castsShadow |
int | type |
struct Light::LightUniformLocations | ids |
![]() | |
GLuint | program = 0 |
GLuint | shadowProgram = 0 |
A light is a special class of Game Object that mostly just sends uniform data to the shaders. Lights are fundamental to the shading pipeline! Without a light, nothing will show up in the scene.
Light::Light | ( | ) |
|
inline |
|
overridevirtual |
Destroys the light. This currently only turns off the enabled flag!
Implements IGameObject.
bool Light::DisableShadows | ( | ) |
Disables shadow generation for this light.
|
overridevirtual |
Sets up the light uniform location id's from the program. Each subclass must then send their corresponding params to the shader.
program | The shader program. |
Implements IGameObject.
Reimplemented in SpotLight, PointLight, AmbientLight, and DirectionalLight.
|
overridevirtual |
Sends shadow information. Each subclass must implement this functionality!
program | The shader program. |
Implements IGameObject.
Reimplemented in DirectionalLight.
bool Light::EnableShadows | ( | ) |
Enables shadow generation for this light.
|
overridevirtual |
Gets a texture.
textureName | The name of the texture. |
Implements IGameObject.
void Light::SetAttenuation | ( | float | constant = 0.0f , |
float | linear = 1.0f , |
||
float | quadratic = 0.0f |
||
) |
Sets the attenutation parameters. See this wiki article for more information about attenuation: https://developer.valvesoftware.com/wiki/Constant-Linear-Quadratic_Falloff.
constant | The constant attenuation factor. |
linear | The linear attenuation factor. |
quadratic | The quadratic attenuation factor. |
|
overridevirtual |
Adds a texture to an object.
textureName | Name of the texture. |
textureType | Type of the texture. |
texture | The texture id. |
Implements IGameObject.
|
overridevirtual |
Updates the light. This currently does nothing! Draw() does update the light.
Implements IGameObject.
|
protected |
glm::vec3 Light::ambient |
light's contribution to ambient light.
|
protected |
glm::vec3 Light::color |
The color/intensity of the light.
glm::vec3 Light::coneDirection |
spotlight cone direction.
float Light::constantAttenuation |
constant light fall-out
glm::vec3 Light::halfVector |
?? direction of headlights for directional light ??
|
protected |
bool Light::isEnabled |
true if this object is enabled.
float Light::linearAttenuation |
linear light fall-off
glm::vec3 Light::position |
location of light if isLocal is true. For directional light, it is the direction
float Light::quadraticAttenuation |
quadratic light fall-out
float Light::spotCosCutoff |
how wide the spotlight is [0-1].
float Light::spotExponent |
control light fall-off in the spotlight.
|
protected |
|
protected |