|
lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
|
Class representing a light source in a 3D scene. More...
#include <light.hpp>
Public Member Functions | |
| Light (LightType type=LightType::Point) | |
| Constructs a Light object with the specified type. | |
| virtual | ~Light ()=default |
| Virtual destructor for the Light class. | |
| LightType | get_type () const |
| Gets the type of the light. | |
| const glm::vec3 & | get_color () const |
| Sets the type of the light. | |
| void | set_color (const glm::vec3 &color) |
| Sets the color of the light. | |
| float | get_intensity () const |
| Gets the intensity of the light. | |
| void | set_intensity (float intensity) |
| Sets the intensity of the light. | |
| const glm::vec3 & | get_direction () const |
| Gets the direction of the light. | |
| void | set_direction (const glm::vec3 &direction) |
| Sets the direction of the light. | |
| const glm::vec3 & | get_position () const |
| Gets the position of the light. | |
| void | set_position (const glm::vec3 &position) |
| Sets the position of the light. | |
| float | get_range () const |
| Gets the range of the light. | |
| void | set_range (float range) |
| Sets the range of the light. | |
| float | get_inner_cone () const |
| Gets the inner cone angle of the spotlight. | |
| void | set_inner_cone (float inner_cone) |
| Sets the inner cone angle of the spotlight. | |
| float | get_outer_cone () const |
| Gets the outer cone angle of the spotlight. | |
| void | set_outer_cone (float outer_cone) |
| Sets the outer cone angle of the spotlight. | |
| bool | casts_shadows () const |
| Checks if the light casts shadows. | |
| void | set_casts_shadows (bool casts_shadows) |
| Sets whether the light casts shadows. | |
Static Public Member Functions | |
| static std::shared_ptr< Light > | create_directional (const glm::vec3 &direction, const glm::vec3 &color=glm::vec3(1.0f)) |
| Creates a directional light. | |
| static std::shared_ptr< Light > | create_point (const glm::vec3 &position, float range=10.0f, const glm::vec3 &color=glm::vec3(1.0f)) |
| Creates a point light. | |
| static std::shared_ptr< Light > | create_spot (const glm::vec3 &position, const glm::vec3 &direction, float angle=45.0f, const glm::vec3 &color=glm::vec3(1.0f)) |
| Creates a spotlight. | |
Protected Attributes | |
| LightType | m_type |
| The type of the light. | |
| glm::vec3 | m_color {1.0f, 1.0f, 1.0f} |
| The color of the light. | |
| float | m_intensity {1.0f} |
| The intensity of the light. | |
| glm::vec3 | m_direction {0.0f, -1.0f, 0.0f} |
| The direction of the light. | |
| glm::vec3 | m_position {0.0f, 0.0f, 0.0f} |
| The position of the light. | |
| float | m_range {10.0f} |
| The range of the light. | |
| float | m_inner_cone {glm::radians(30.0f)} |
| The inner cone angle of the spotlight in radians. | |
| float | m_outer_cone {glm::radians(45.0f)} |
| The outer cone angle of the spotlight in radians. | |
| bool | m_casts_shadows {false} |
| Flag indicating whether the light casts shadows. | |
Class representing a light source in a 3D scene.
The Light class encapsulates properties and behaviors of a light source, including its type, color, intensity, and position/direction.
| lmgl::scene::Light::Light | ( | LightType | type = LightType::Point | ) |
Constructs a Light object with the specified type.
| type | The type of the light (Directional, Point, Spot). |
|
virtualdefault |
|
inline |
Checks if the light casts shadows.
|
static |
Creates a directional light.
| direction | The direction of the light as a glm::vec3. |
| color | The color of the light as a glm::vec3 (default is white). |
|
static |
Creates a point light.
| position | The position of the light as a glm::vec3. |
| range | The range of the light as a float (default is 10.0f). |
| color | The color of the light as a glm::vec3 (default is white). |
|
static |
Creates a spotlight.
| position | The position of the light as a glm::vec3. |
| direction | The direction of the light as a glm::vec3. |
| range | The range of the light as a float (default is 10.0f). |
| color | The color of the light as a glm::vec3 (default is white). |
|
inline |
Sets the type of the light.
| type | The new LightType for the light. |
|
inline |
Gets the direction of the light.
|
inline |
Gets the inner cone angle of the spotlight.
|
inline |
Gets the intensity of the light.
|
inline |
Gets the outer cone angle of the spotlight.
|
inline |
Gets the position of the light.
|
inline |
Gets the range of the light.
|
inline |
Gets the type of the light.
|
inline |
Sets whether the light casts shadows.
| casts_shadows | True to enable shadow casting, false to disable. |
|
inline |
Sets the color of the light.
| color | The new color for the light as a glm::vec3. |
|
inline |
Sets the direction of the light.
| direction | The new direction for the light as a glm::vec3. |
|
inline |
Sets the inner cone angle of the spotlight.
| inner_cone | The new inner cone angle in radians as a float. |
|
inline |
Sets the intensity of the light.
| intensity | The new intensity for the light as a float. |
|
inline |
Sets the outer cone angle of the spotlight.
| outer_cone | The new outer cone angle in radians as a float. |
|
inline |
Sets the position of the light.
| position | The new position for the light as a glm::vec3. |
|
inline |
Sets the range of the light.
| range | The new range for the light as a float. |