CG-Project2
Loading...
Searching...
No Matches
LightComponent Class Reference

Component to store light data. A light is an emitting mesh, rendered or not, that for each ogl::ShaderProgram used in the scene, its data will be sent to the shader. More...

#include <Component.hpp>

Inheritance diagram for LightComponent:
Collaboration diagram for LightComponent:

Public Member Functions

 LightComponent (const glm::vec3 &direction)
 Instances a directional light with the given direction.
 LightComponent (const glm::vec3 &position, const LightConstraint &constraint)
 Instances a point light with the given position and LightConstraint.
 LightComponent (const glm::vec3 &position, const glm::vec3 &direction, const LightConstraint &constraint, const float &cutOff=12.5f, const float &outerCutoff=17.5f)
 Instances a spot light with the given position, direction, LightConstraint, light cutoff and outer cutoof.

Public Attributes

glm::vec3 color {1, 1, 1}
 light color, default white
float intensity = 1.f
 light intensity
LightType type = LightType::LIGHT_DIRECTIONAL
 Light type for shader programs. This member is mainly used to create shader data blocks.
LightVectors vectors {}
 Light components vectors.
glm::vec3 direction {1, -1, -1}
 light direction
glm::vec3 position {}
 light position
LightConstraint attenuation {}
 light attenuation
float cutOff = 12.5f
 light cutoff
float outerCutoff = 17.5f
 light outer cutoff
bool caster = true
 light caster

Detailed Description

Component to store light data. A light is an emitting mesh, rendered or not, that for each ogl::ShaderProgram used in the scene, its data will be sent to the shader.

Constructor & Destructor Documentation

◆ LightComponent() [1/3]

LightComponent::LightComponent ( const glm::vec3 & direction)
inline

Instances a directional light with the given direction.

Parameters
directionlight direction

◆ LightComponent() [2/3]

LightComponent::LightComponent ( const glm::vec3 & position,
const LightConstraint & constraint )
inline

Instances a point light with the given position and LightConstraint.

Parameters
positionlight position
constraintlight attenuation parameter
See also
LightConstraint

◆ LightComponent() [3/3]

LightComponent::LightComponent ( const glm::vec3 & position,
const glm::vec3 & direction,
const LightConstraint & constraint,
const float & cutOff = 12.5f,
const float & outerCutoff = 17.5f )
inline

Instances a spot light with the given position, direction, LightConstraint, light cutoff and outer cutoof.

Parameters
positionlight position
directionlight direction
constraintlight attenuation parameter
cutOfflight cutoff parameter
outerCutofflight outer cutoff parameter
See also
LightConstraint

Member Data Documentation

◆ type

LightType LightComponent::type = LightType::LIGHT_DIRECTIONAL

Light type for shader programs. This member is mainly used to create shader data blocks.

See also
LightType

◆ vectors

LightVectors LightComponent::vectors {}

Light components vectors.

See also
LightVectors

The documentation for this class was generated from the following file: