Light¶
-
struct
glen::Light¶ Base light class. Designed to be extended by specific light types
Subclassed by DirectionalLight, PointLight, SpotLight
Public Functions
-
const GLfloat &
brightness() const¶ - Return
The brightness of the light
-
const glm::vec3 &
color() const¶ - Return
a vector with the r, g, b color values of the light.
-
const bool &
mesh_enabled() const¶ - Return
True if mesh representing the light is renderable.
-
const bool &
specular_enabled() const¶ - Return
True if light casts a specular reflection.
-
const bool &
diffuse_enabled() const¶ - Return
True if light illuminates diffuse componenet of meshes.
-
const std::string &
type() const = 0¶ Get the type of the light. Useful for partitioning lights when rendering.
- Return
A string representing the type of the light.
-
void
set_brightness(const GLfloat brightness)¶ - Parameters
brightness: Set the brightness of the light.
-
void
set_color(const glm::vec3 color)¶ - Parameters
color: Set the color of the light with an r, g, b vector. Color values should be in the range 0 to 1.
-
void
enable_mesh()¶ Make the light itself renderable.
-
void
disable_mesh()¶ Make the light itself not renderable.
-
void
enable_diffuse()¶ Make the light illuminate the diffuse component of materials.
-
void
disable_diffuse()¶ Stop the light from illuminating the diffuse component of materials.
-
void
enable_specular()¶ Make the light cast specular reflections.
-
void
disable_specular()¶ Prevent the light from casting specular reflections.
-
const GLfloat &
Directional Light¶
-
struct
glen::DirectionalLight: public Light¶ Emits light in a single direction. Rays are parallel like the sun.
Public Functions
-
DirectionalLight()¶ Constructor.
-
DirectionalLight(GLfloat brightness, glm::vec3 color)¶ Constructor.
- Parameters
brightness: Set the brightness of the light.color: Set the color of the light with an r, g, b vector. Color values should be in the range 0 to 1.
-
const std::string &
type() const override¶ Get the type of the light. Useful for partitioning lights when rendering.
- Return
A string representing the type of the light.
Public Static Attributes
-
const std::string
TYPE= "directionalLight"¶
-
Point Light¶
-
struct
glen::PointLight: public Light¶ Emits light in all directions. Uses sphere mesh to display location and size in scene
Public Functions
-
PointLight()¶ Constructor.
-
PointLight(const GLfloat brightness, const glm::vec3 color)¶ Constructor.
- Parameters
brightness: Set the brightness of the light.color: Set the color of the light with an r, g, b vector. Color values should be in the range 0 to 1.
-
const float &
radius() const¶ - Return
The radius of the mesh representing the light
-
const std::string &
type() const override¶ Get the type of the light. Useful for partitioning lights when rendering.
- Return
A string representing the type of the light.
-
Spot Light¶
-
struct
glen::SpotLight: public Light¶ Emits light in a cone shape like it’s coming from a torch.
Public Functions
-
SpotLight()¶ Constructor.
-
SpotLight(GLfloat brightness, glm::vec3 color)¶ Constructor.
- Parameters
brightness: Set the brightness of the light.color: Set the color of the light with an r, g, b vector. Color values should be in the range 0 to 1.
-
const std::string &
type() const override¶ Get the type of the light. Useful for partitioning lights when rendering.
- Return
A string representing the type of the light.
-
const float
cos_inner_angle() const¶ - Return
Number between 0 and 1 represnting the inner angle of the penumbra
-
const float
cos_outer_angle() const¶ - Return
Number between 0 and 1 represnting the outer angle of the penumbra
-