Struct TLight
Defined in File TLightParameters.h
Struct Documentation
-
struct TLight
A single light source (directional, point, or spot).
Public Functions
-
void writeToStream(mrpt::serialization::CArchive &out) const
-
void readFromStream(mrpt::serialization::CArchive &in)
Public Members
-
TLightType type = TLightType::Directional
-
mrpt::img::TColorf color = {1.0f, 1.0f, 1.0f}
Light color
-
float diffuse = 0.8f
Diffuse intensity [0,1]
-
float specular = 0.95f
Specular intensity [0,1]
-
mrpt::math::TVector3Df direction = {-0.40825f, -0.40825f, -0.81650f}
Direction vector (must be normalized). Used by Directional and Spot.
-
mrpt::math::TPoint3Df position = {0, 0, 0}
Position in world coordinates. Used by Point and Spot.
-
float attenuation_constant = 1.0f
Attenuation factors for Point/Spot: intensity = 1 / (constant + linear*d + quadratic*d²). Ignored for Directional.
-
float attenuation_linear = 0.09f
-
float attenuation_quadratic = 0.032f
-
float spot_inner_cutoff_deg = 12.5f
Spot light inner cutoff angle in degrees (full intensity cone).
-
float spot_outer_cutoff_deg = 17.5f
Spot light outer cutoff angle in degrees (light fades to zero).
Public Static Functions
-
static inline TLight Directional(const mrpt::math::TVector3Df &dir, const mrpt::img::TColorf &color = {1.0f, 1.0f, 1.0f}, float diffuse = 0.8f, float specular = 0.95f)
Factory: creates a directional light.
-
static inline TLight PointLight(const mrpt::math::TPoint3Df &pos, const mrpt::img::TColorf &color = {1.0f, 1.0f, 1.0f}, float diffuse = 0.8f, float specular = 0.95f, float att_constant = 1.0f, float att_linear = 0.09f, float att_quadratic = 0.032f)
Factory: creates a point light.
-
static inline TLight SpotLight(const mrpt::math::TPoint3Df &pos, const mrpt::math::TVector3Df &dir, float innerCutoffDeg = 12.5f, float outerCutoffDeg = 17.5f, const mrpt::img::TColorf &color = {1.0f, 1.0f, 1.0f}, float diffuse = 0.8f, float specular = 0.95f, float att_constant = 1.0f, float att_linear = 0.09f, float att_quadratic = 0.032f)
Factory: creates a spot light.
-
void writeToStream(mrpt::serialization::CArchive &out) const