|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CPointLight Class ReferenceDescription of a light.
More...
#include <point_light.h>
Inheritance diagram for NL3D::CPointLight:
List of all members.
Public Types |
typedef NLMISC::CSTLBlockList<
CTransform * > | TTransformList |
| The list of model this light influence. More...
|
typedef TTransformList::iterator | ItTransformList |
enum | TType { PointLight = 0,
SpotLight,
AmbientLight
} |
Public Methods |
| CPointLight () |
| Constructor Default type is PointLight. More...
|
| ~CPointLight () |
| call resetLightModels. More...
|
|
void | setType (TType type) |
| set/get the type of the light. More...
|
TType | getType () const |
void | setPosition (const CVector &v) |
| Set the position in WorldSpace. More...
|
const CVector & | getPosition () const |
| Get the position in WorldSpace. More...
|
void | setAmbient (NLMISC::CRGBA ambient) |
| Set the ambient color of the light. Default to Black. More...
|
void | setDiffuse (NLMISC::CRGBA diffuse) |
| Set the diffuse color of the light. Default to White. More...
|
void | setSpecular (NLMISC::CRGBA specular) |
| Set the specular color of the light. Default to White. More...
|
void | setColor (NLMISC::CRGBA color) |
| Set the diffuse and specular color of the light to the same value. don't modify _Ambient. More...
|
NLMISC::CRGBA | getAmbient () const |
| Get the ambient color of the light. More...
|
NLMISC::CRGBA | getDiffuse () const |
| Get the diffuse color of the light. More...
|
NLMISC::CRGBA | getSpecular () const |
| Get the specular color of the light. More...
|
void | setupAttenuation (float attenuationBegin, float attenuationEnd) |
| setup the attenuation of the light. More...
|
float | getAttenuationBegin () const |
| get the begin radius of the attenuation. More...
|
float | getAttenuationEnd () const |
| get the end radius of the attenuation. More...
|
void | setupSpotAngle (float spotAngleBegin, float spotAngleEnd) |
| setup the spot AngleBegin and AngleEnd that define spot attenuation of the light. More...
|
float | getSpotAngleBegin () const |
| get the begin radius of the SpotAngles. More...
|
float | getSpotAngleEnd () const |
| get the end radius of the SpotAngles. More...
|
void | setupSpotDirection (const CVector &dir) |
| setup the spot Direction. More...
|
const CVector & | getSpotDirection () const |
| get the spot Direction. More...
|
void | serial (NLMISC::IStream &f) |
|
float | computeLinearAttenuation (const CVector &pos) const |
| Compute a linear attenuation from a point according to attenuation and spot setup. Return [0,1]. More...
|
float | computeLinearAttenuation (const CVector &pos, float precomputedDist, float modelRadius=0) const |
| Compute a linear attenuation from a point and precomputed distance according to attenuation and spot setup. More...
|
void | setupDriverLight (CLight &light, uint8 factor) |
| setup the CLight with current pointLight state. factor is used to modulate the colors. More...
|
void | setupDriverLightUserAttenuation (CLight &light, uint8 factor) |
| setup the CLight with current pointLight state. More...
|
void | resetLightedModels () |
| Dirt all models this light influence. More...
|
ItTransformList | appendLightedModel (CTransform *model) |
| append a model to the list. called by CLightingManager. More...
|
void | removeLightedModel (ItTransformList it) |
| remove a model from the list. called by CTransform. More...
|
Private Methods |
void | computeAttenuationFactors () |
void | computeSpotAttenuationFactors () |
Private Attributes |
TType | _Type |
CVector | _Position |
NLMISC::CRGBA | _Ambient |
NLMISC::CRGBA | _Diffuse |
NLMISC::CRGBA | _Specular |
float | _AttenuationBegin |
float | _AttenuationEnd |
float | _OODeltaAttenuation |
float | _ConstantAttenuation |
float | _LinearAttenuation |
float | _QuadraticAttenuation |
CVector | _SpotDirection |
float | _SpotAngleBegin |
float | _SpotAngleEnd |
float | _CosSpotAngleEnd |
float | _OOCosSpotAngleDelta |
float | _SpotExponent |
TTransformList | _LightedModels |
Static Private Attributes |
NLMISC::CBlockMemory< CTransform *,
false > | _LightedModelListMemory |
Detailed Description
Description of a light.
Owned by an IG, or a CPointLightModel. With the special sunLight, this is the only light which can interact with CTransform models in the standard lighting system.
Only Positionnal with or without attenuation are supported. no directionnal. This restriction is for faster rendering, especially if VertexProgram is used. New: Spot are managed but VertexProgrammed meshes won't use localAttenuation. Special Ambiant are provided too but they are considered like PointLight for dynamic light. They are used in a special way for static light in Igs.
-
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2001
-
See also:
-
CLightingManager
Definition at line 69 of file point_light.h.
Member Typedef Documentation
typedef TTransformList::iterator NL3D::CPointLight::ItTransformList
|
|
|
The list of model this light influence.
Definition at line 73 of file point_light.h. |
Member Enumeration Documentation
enum NL3D::CPointLight::TType
|
|
|
-
Enumeration values:
-
PointLight |
|
SpotLight |
|
AmbientLight |
|
Definition at line 76 of file point_light.h. |
Constructor & Destructor Documentation
NL3D::CPointLight::CPointLight |
( |
|
) |
|
|
|
Constructor Default type is PointLight.
Default ambient is Black, Diffuse and Specular are white. Position is CVector::Null. Attenuation is 10-30.
Definition at line 46 of file point_light.cpp.
References _Ambient, _AttenuationBegin, _AttenuationEnd, _ConstantAttenuation, _CosSpotAngleEnd, _Diffuse, _LinearAttenuation, _OOCosSpotAngleDelta, _Position, _QuadraticAttenuation, _Specular, _SpotAngleBegin, _SpotAngleEnd, _SpotDirection, _SpotExponent, computeAttenuationFactors, and computeSpotAttenuationFactors. |
NL3D::CPointLight::~CPointLight |
( |
|
) |
|
|
Member Function Documentation
void NL3D::CPointLight::computeAttenuationFactors |
( |
|
) |
[private] |
|
float NL3D::CPointLight::computeLinearAttenuation |
( |
const CVector & |
pos, |
|
|
float |
precomputedDist, |
|
|
float |
modelRadius = 0 |
|
) |
const |
|
|
Compute a linear attenuation from a point and precomputed distance according to attenuation and spot setup.
Return [0,1] -
Parameters:
-
modelRadius |
if !0, suppose the point is a sphere, and compute the approximate Max attenuation from every point on this sphere |
Definition at line 238 of file point_light.cpp.
References _AttenuationBegin, _AttenuationEnd, _CosSpotAngleEnd, _OOCosSpotAngleDelta, _OODeltaAttenuation, _Position, _SpotDirection, _Type, NLMISC::clamp, SpotLight, and NLMISC::sqr. |
float NL3D::CPointLight::computeLinearAttenuation |
( |
const CVector & |
pos |
) |
const |
|
|
Compute a linear attenuation from a point according to attenuation and spot setup. Return [0,1].
Definition at line 232 of file point_light.cpp.
References _Position. |
void NL3D::CPointLight::computeSpotAttenuationFactors |
( |
|
) |
[private] |
|
float NL3D::CPointLight::getAttenuationBegin |
( |
|
) |
const [inline] |
|
float NL3D::CPointLight::getAttenuationEnd |
( |
|
) |
const [inline] |
|
const CVector& NL3D::CPointLight::getPosition |
( |
|
) |
const [inline] |
|
float NL3D::CPointLight::getSpotAngleBegin |
( |
|
) |
const [inline] |
|
float NL3D::CPointLight::getSpotAngleEnd |
( |
|
) |
const [inline] |
|
const CVector& NL3D::CPointLight::getSpotDirection |
( |
|
) |
const [inline] |
|
void NL3D::CPointLight::resetLightedModels |
( |
|
) |
|
|
|
Reimplemented in NL3D::CPointLightNamed.
Definition at line 195 of file point_light.cpp.
References _Ambient, _AttenuationBegin, _AttenuationEnd, _Diffuse, _Position, _Specular, _SpotAngleBegin, _SpotAngleEnd, _SpotDirection, _Type, computeAttenuationFactors, computeSpotAttenuationFactors, NLMISC::IStream::isReading, PointLight, NLMISC::IStream::serial, NLMISC::IStream::serialEnum, and NLMISC::IStream::serialVersion. |
void NL3D::CPointLight::setAmbient |
( |
NLMISC::CRGBA |
ambient |
) |
[inline] |
|
void NL3D::CPointLight::setColor |
( |
NLMISC::CRGBA |
color |
) |
[inline] |
|
|
Set the diffuse and specular color of the light to the same value. don't modify _Ambient.
Definition at line 122 of file point_light.h.
References _Diffuse, and _Specular. |
void NL3D::CPointLight::setDiffuse |
( |
NLMISC::CRGBA |
diffuse |
) |
[inline] |
|
void NL3D::CPointLight::setPosition |
( |
const CVector & |
v |
) |
[inline] |
|
void NL3D::CPointLight::setSpecular |
( |
NLMISC::CRGBA |
specular |
) |
[inline] |
|
void NL3D::CPointLight::setType |
( |
TType |
type |
) |
|
|
void NL3D::CPointLight::setupAttenuation |
( |
float |
attenuationBegin, |
|
|
float |
attenuationEnd |
|
) |
|
|
void NL3D::CPointLight::setupDriverLight |
( |
CLight & |
light, |
|
|
uint8 |
factor |
|
) |
|
|
|
setup the CLight with current pointLight state. factor is used to modulate the colors.
Definition at line 311 of file point_light.cpp.
References _Ambient, _ConstantAttenuation, _Diffuse, _LinearAttenuation, _Position, _QuadraticAttenuation, _Specular, _SpotDirection, _SpotExponent, _Type, and SpotLight. |
void NL3D::CPointLight::setupDriverLightUserAttenuation |
( |
CLight & |
light, |
|
|
uint8 |
factor |
|
) |
|
|
|
setup the CLight with current pointLight state.
Don't use driver Attenuation and use software one setuped with an additional userAttenuation -
Parameters:
-
factor |
is used to modulate the colors. Should also integrate light attenuation. |
Definition at line 339 of file point_light.cpp.
References _Ambient, _Diffuse, _Position, and _Specular. |
void NL3D::CPointLight::setupSpotAngle |
( |
float |
spotAngleBegin, |
|
|
float |
spotAngleEnd |
|
) |
|
|
void NL3D::CPointLight::setupSpotDirection |
( |
const CVector & |
dir |
) |
|
|
|
setup the spot Direction.
Usefull only if SpotLight. Normalized internally Default is (0, 1, 0)
Definition at line 137 of file point_light.cpp.
References _SpotDirection. |
Member Data Documentation
float NL3D::CPointLight::_AttenuationBegin [private]
|
|
float NL3D::CPointLight::_AttenuationEnd [private]
|
|
float NL3D::CPointLight::_ConstantAttenuation [private]
|
|
float NL3D::CPointLight::_CosSpotAngleEnd [private]
|
|
float NL3D::CPointLight::_LinearAttenuation [private]
|
|
float NL3D::CPointLight::_OOCosSpotAngleDelta [private]
|
|
float NL3D::CPointLight::_OODeltaAttenuation [private]
|
|
CVector NL3D::CPointLight::_Position [private]
|
|
float NL3D::CPointLight::_QuadraticAttenuation [private]
|
|
float NL3D::CPointLight::_SpotAngleBegin [private]
|
|
float NL3D::CPointLight::_SpotAngleEnd [private]
|
|
CVector NL3D::CPointLight::_SpotDirection [private]
|
|
float NL3D::CPointLight::_SpotExponent [private]
|
|
TType NL3D::CPointLight::_Type [private]
|
|
The documentation for this class was generated from the following files:
|
|