struct mrpt::viz::TLight
Overview
A single light source (directional, point, or spot).
#include <mrpt/viz/TLightParameters.h> struct TLight { // fields TLightType type = TLightType::Directional; mrpt::img::TColorf color = {1.0f, 1.0f, 1.0f}; float diffuse = 0.8f; float specular = 0.95f; mrpt::math::TVector3Df direction = {-0.40825f, -0.40825f, -0.81650f}; mrpt::math::TPoint3Df position = {0, 0, 0}; float attenuation_constant = 1.0f; float attenuation_linear = 0.09f; float attenuation_quadratic = 0.032f; float spot_inner_cutoff_deg = 12.5f; float spot_outer_cutoff_deg = 17.5f; // methods static 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 ); static 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 ); static 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 ); void writeToStream(mrpt::serialization::CArchive& out) const; void readFromStream(mrpt::serialization::CArchive& in); };
Fields
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 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).
Methods
static 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 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 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.