![]() |
Copperfield Engine 0.1
C++ Game Engine
|
Component used to simulate different types of lights. More...
#include <default_components.hpp>
Public Member Functions | |
| void | calculateAttenuation () |
| After modifying max_distance_, this function should be called to update the rest of the parameters related to kPoint attenuation. | |
| LightCmp (const LightType type, const coma::Vec3 &color, const float intensity) | |
| Creates a LightCmp of the specified LightType. More... | |
| LightCmp (const coma::Vec3 &color, const float intensity, const float max_distance) | |
| Creates a kPoint. More... | |
| LightCmp (const coma::Vec3 &color, const float intensity, const float cutoff_angle, float falloff_start) | |
| Creates a kSpot. More... | |
Public Attributes | |
| LightType | type_ = LightType::kPoint |
| Define the light type. | |
| coma::Vec3 | light_color_ = coma::Vec3(1.0f, 1.0f, 1.0f) |
| Define the color of the light. | |
| float | intensity_ = 1.0f |
| Define the power of the light. | |
| float | max_distance_ = 13.0f |
| Distance at which the light intensity will become 0 due to attenuation. | |
| float | constant_value_ = 1.0f |
| Can be handled with max_distance_. | |
| float | linear_value_ = 0.01f |
| Can be handled with max_distance_. | |
| float | quadratic_value_ = 0.01f |
| Can be handled with max_distance_. | |
| float | cutoff_angle_ = 50.0f |
| Radius of the spot light. | |
| float | falloff_start_ = 0.8f |
| Percentage of the cutoff_angle_ at which the light starts to attenuate. | |
| bool | show_shadows_ = true |
| Define if the light shows shadows. | |
Component used to simulate different types of lights.
Some of the member variables may not be used depending on the chosen LightType.
|
inline |
Creates a LightCmp of the specified LightType.
| type | type_ |
| color | light_color_ |
| intensity | intensity_ |
Using this constructor will probably require you to set the desired parameters of the chosen LightType afterward.
|
inline |
Creates a kPoint.
| color | light_color_ |
| intensity | intensity_ |
| max_distance | max_distance_ |
|
inline |
Creates a kSpot.
| color | light_color_ |
| intensity | intensity_ |
| cutoff_angle | cutoff_angle_ |
| falloff_start | falloff_start_ |