55 float &aOutDistance )
const = 0;
75 m_att_constant = 0.9f;
76 m_att_linear = 0.0005f;
86 float &aOutDistance )
const override 88 const SFVEC3F vectorLight = m_position - aHitPoint;
90 aOutDistance = glm::length( vectorLight );
91 aOutVectorToLight = vectorLight / aOutDistance;
93 const float att = 1.0f / ( m_att_constant +
94 m_att_linear * aOutDistance +
95 m_att_exp * aOutDistance * aOutDistance );
98 aOutLightColor =
SFVEC3F( 0.0f, 0.0f, 0.0f );
100 aOutLightColor = m_color * att;
120 m_inv_direction = glm::normalize( -aDir );
136 float &aOutDistance )
const override 140 aOutVectorToLight = m_inv_direction;
141 aOutDistance = std::numeric_limits<float>::infinity();
142 aOutLightColor = m_color;
167 if( !m_lights.empty() )
169 for( LIST_LIGHT::iterator ii = m_lights.begin();
170 ii != m_lights.end();
189 m_lights.push_back( aLight );
Directional light - a light based only on a direction vector.
const LIST_LIGHT & GetList() const
GetList - get light list of this container.
void GetLightParameters(const SFVEC3F &aHitPoint, SFVEC3F &aOutVectorToLight, SFVEC3F &aOutLightColor, float &aOutDistance) const override
GetLightParameters - Get parameters from this light.
CPOINTLIGHT(const SFVEC3F &aPos, const SFVEC3F &aColor)
void GetLightParameters(const SFVEC3F &aHitPoint, SFVEC3F &aOutVectorToLight, SFVEC3F &aOutLightColor, float &aOutDistance) const override
GetLightParameters - Get parameters from this light.
SFVEC3F m_inv_direction
oposite direction of the light
void Add(CLIGHT *aLight)
Add - Add a light to the container.
Point light based on: http://ogldev.atspace.co.uk/www/tutorial20/tutorial20.html. ...
CDIRECTIONALLIGHT(const SFVEC3F &aDir, const SFVEC3F &aColor)
A base light class to derive to implement other light classes.
A light contariner. It will add lights and remove it in the end.
bool GetCastShadows() const
void SetDirection(const SFVEC3F &aDir)
SetDirection - Set directional light orientation.
void SetCastShadows(bool aCastShadow)
virtual void GetLightParameters(const SFVEC3F &aHitPoint, SFVEC3F &aOutVectorToLight, SFVEC3F &aOutLightColor, float &aOutDistance) const =0
GetLightParameters - Get parameters from this light.
std::list< CLIGHT * > LIST_LIGHT
void Clear()
Clear - Remove all lights from the container.
SFVEC3F m_color
light color
LIST_LIGHT m_lights
list of lights