YAGE  1.0
Yet Another Game Engine
SpotLight Class Reference

A spot light. More...

#include <Light.h>

Inheritance diagram for SpotLight:
Light IGameObject

Public Member Functions

 SpotLight (glm::vec3 color, glm::vec3 position, glm::vec3 coneDirection, float spotCosCutoff=0.99f, float spotExponent=0.0f, float constantAttenuation=0.0f, float linearAttenuation=1.0f, float quadraticAttenuation=0.0f)
 
virtual void Draw (GLuint) override final
 Sets up the light uniform location id's from the program. Each subclass must then send their corresponding params to the shader. More...
 
- Public Member Functions inherited from Light
 Light ()
 
 ~Light ()
 
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...
 
- Public Member Functions inherited from IGameObject
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...
 

Additional Inherited Members

- Public Attributes inherited from Light
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 inherited from Light
GLuint texture
 
unsigned int _id
 
bool castsShadow
 
int type
 
struct Light::LightUniformLocations ids
 
- Protected Attributes inherited from IGameObject
GLuint program = 0
 
GLuint shadowProgram = 0
 

Detailed Description

A spot light.

Constructor & Destructor Documentation

SpotLight::SpotLight ( glm::vec3  color,
glm::vec3  position,
glm::vec3  coneDirection,
float  spotCosCutoff = 0.99f,
float  spotExponent = 0.0f,
float  constantAttenuation = 0.0f,
float  linearAttenuation = 1.0f,
float  quadraticAttenuation = 0.0f 
)

Member Function Documentation

void SpotLight::Draw ( GLuint  program)
finaloverridevirtual

Sets up the light uniform location id's from the program. Each subclass must then send their corresponding params to the shader.

Parameters
programThe shader program.

Reimplemented from Light.