From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03094.html | 2218 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2218 insertions(+) create mode 100644 docs/doxygen/nel/a03094.html (limited to 'docs/doxygen/nel/a03094.html') diff --git a/docs/doxygen/nel/a03094.html b/docs/doxygen/nel/a03094.html new file mode 100644 index 00000000..aaa112a5 --- /dev/null +++ b/docs/doxygen/nel/a03094.html @@ -0,0 +1,2218 @@ + + +NeL: NL3D::CPointLightNamed class Reference + + + +
+

NL3D::CPointLightNamed Class Reference

#include <point_light_named.h> +

+

Inheritance diagram for NL3D::CPointLightNamed: +

+ +NL3D::CPointLight + +

Detailed Description

+A pointLight with a name, and a default color setup. The current setup is the setup in CPointLight. A CPointLightNamed influence can also be interpolated with a CLightInfluenceInterpolator.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 48 of file point_light_named.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

typedef TTransformList::iterator ItTransformList
typedef NLMISC::CSTLBlockList<
+ CTransform * > 
TTransformList
 The list of model this light influence.

enum  TType { PointLight = 0, +SpotLight, +AmbientLight + }

Public Member Functions

 CPointLightNamed ()
 Constructor.

NLMISC::CRGBA getDefaultAmbient () const
 Get the Default ambient color of the light.

NLMISC::CRGBA getDefaultDiffuse () const
 Get the Default diffuse color of the light.

NLMISC::CRGBA getDefaultSpecular () const
 Get the Default specular color of the light.

NLMISC::CRGBA getUnAnimatedDiffuse () const
 get the unanimated diffuse (used for Landscape)

void serial (NLMISC::IStream &f)
 Get the ambient color of the light.

void setDefaultAmbient (NLMISC::CRGBA ambient)
 Set the Default ambient color of the light. Default to Black.

void setDefaultDiffuse (NLMISC::CRGBA diffuse)
 Set the Default diffuse color of the light. Default to White.

void setDefaultSpecular (NLMISC::CRGBA specular)
 Set the Default specular color of the light. Default to White.

void setLightFactor (NLMISC::CRGBA nAnimatedFactor, NLMISC::CRGBA nUnAnimatedFactor)
void setLightFactor (NLMISC::CRGBA nFactor)
Render tools.
ItTransformList appendLightedModel (CTransform *model)
 append a model to the list. called by CLightingManager.

float computeLinearAttenuation (const CVector &pos, float precomputedDist, float modelRadius=0) const
float computeLinearAttenuation (const CVector &pos) const
 Compute a linear attenuation from a point according to attenuation and spot setup. Return [0,1].

void removeLightedModel (ItTransformList it)
 remove a model from the list. called by CTransform.

void resetLightedModels ()
 Dirt all models this light influence.

void setupDriverLight (CLight &light, uint8 factor)
 setup the CLight with current pointLight state. factor is used to modulate the colors.

void setupDriverLightUserAttenuation (CLight &light, uint8 factor)
Render tools.
ItTransformList appendLightedModel (CTransform *model)
 append a model to the list. called by CLightingManager.

float computeLinearAttenuation (const CVector &pos, float precomputedDist, float modelRadius=0) const
float computeLinearAttenuation (const CVector &pos) const
 Compute a linear attenuation from a point according to attenuation and spot setup. Return [0,1].

void removeLightedModel (ItTransformList it)
 remove a model from the list. called by CTransform.

void resetLightedModels ()
 Dirt all models this light influence.

void setupDriverLight (CLight &light, uint8 factor)
 setup the CLight with current pointLight state. factor is used to modulate the colors.

void setupDriverLightUserAttenuation (CLight &light, uint8 factor)
Light setup
NLMISC::CRGBA getAmbient () const
 Get the ambient color of the light.

float getAttenuationBegin () const
 get the begin radius of the attenuation.

float getAttenuationEnd () const
 get the end radius of the attenuation.

NLMISC::CRGBA getDiffuse () const
 Get the diffuse color of the light.

const CVectorgetPosition () const
 Get the position in WorldSpace.

NLMISC::CRGBA getSpecular () const
 Get the specular color of the light.

float getSpotAngleBegin () const
 get the begin radius of the SpotAngles.

float getSpotAngleEnd () const
 get the end radius of the SpotAngles.

const CVectorgetSpotDirection () const
 get the spot Direction

TType getType () const
 Get the ambient color of the light.

void setAmbient (NLMISC::CRGBA ambient)
 Set the ambient color of the light. Default to Black.

void setColor (NLMISC::CRGBA color)
 Set the diffuse and specular color of the light to the same value. don't modify _Ambient.

void setDiffuse (NLMISC::CRGBA diffuse)
 Set the diffuse color of the light. Default to White.

void setPosition (const CVector &v)
 Set the position in WorldSpace.

void setSpecular (NLMISC::CRGBA specular)
 Set the specular color of the light. Default to White.

void setType (TType type)
 set/get the type of the light.

void setupAttenuation (float attenuationBegin, float attenuationEnd)
void setupSpotAngle (float spotAngleBegin, float spotAngleEnd)
void setupSpotDirection (const CVector &dir)

Static Public Member Functions

void purge ()

Data Fields

std::string AnimatedLight
 Animation used by this light.

uint32 LightGroup
 Group of the light.


Private Attributes

NLMISC::CRGBA _DefaultAmbient
NLMISC::CRGBA _DefaultDiffuse
NLMISC::CRGBA _DefaultSpecular
sint _IdInInfluenceList
NLMISC::CRGBA _UnAnimatedDiffuse

Friends

class CLightInfluenceInterpolator
+


Member Typedef Documentation

+

+ + + + +
+ + +
typedef TTransformList::iterator NL3D::CPointLight::ItTransformList [inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 74 of file point_light.h. +

+Referenced by NL3D::CPointLight::appendLightedModel(), and NL3D::CPointLight::removeLightedModel().

+

+ + + + +
+ + +
typedef NLMISC::CSTLBlockList<CTransform*> NL3D::CPointLight::TTransformList [inherited] +
+
+ + + + + +
+   + + +

+The list of model this light influence. +

+ +

+Definition at line 73 of file point_light.h.

+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NL3D::CPointLight::TType [inherited] +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + + + +
PointLight  +
SpotLight  +
AmbientLight  +
+
+ +

+Definition at line 76 of file point_light.h. +

+

00077         {
+00078                 // The light is a point.
+00079                 PointLight= 0, 
+00080 
+00081                 // The light is a spotlight with a cone.
+00082                 SpotLight,
+00083 
+00084                 // The light is an Ambient PointLight in an Ig.
+00085                 AmbientLight
+00086         };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CPointLightNamed::CPointLightNamed  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 35 of file point_light_named.cpp. +

+References _DefaultAmbient, _DefaultDiffuse, _DefaultSpecular, _UnAnimatedDiffuse, NL3D::CPointLight::getAmbient(), NL3D::CPointLight::getDiffuse(), and NL3D::CPointLight::getSpecular(). +

+

00036 {
+00037         // copy setup from current
+00038         _DefaultAmbient= getAmbient();
+00039         _DefaultDiffuse= getDiffuse();
+00040         _DefaultSpecular= getSpecular();
+00041         _UnAnimatedDiffuse= getDiffuse();
+00042 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
CPointLight::ItTransformList NL3D::CPointLight::appendLightedModel CTransform model  )  [inherited]
+
+ + + + + +
+   + + +

+append a model to the list. called by CLightingManager. +

+ +

+Definition at line 409 of file point_light.cpp. +

+References NL3D::CPointLight::_LightedModels, and NL3D::CPointLight::ItTransformList. +

+Referenced by NL3D::CLightingManager::computeModelLightContributions(). +

+

00410 {
+00411         // append the entry in the list
+00412         _LightedModels.push_back(model);
+00413         ItTransformList it= _LightedModels.end();
+00414         it--;
+00415         return it;
+00416 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
float NL3D::CPointLight::computeLinearAttenuation const CVector pos,
float  precomputedDist,
float  modelRadius = 0
const [inherited]
+
+ + + + + +
+   + + +

+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 273 of file point_light.cpp. +

+References NL3D::CPointLight::_AttenuationBegin, NL3D::CPointLight::_AttenuationEnd, NL3D::CPointLight::_CosSpotAngleEnd, NL3D::CPointLight::_OOCosSpotAngleDelta, NL3D::CPointLight::_OODeltaAttenuation, NL3D::CPointLight::_SpotDirection, NLMISC::clamp(), and NLMISC::sqr(). +

+

00274 {
+00275         float   gAtt;
+00276 
+00277         // Attenuation Distance
+00278         if(_AttenuationEnd==0)
+00279                 gAtt= 1;
+00280         else
+00281         {
+00282                 float   distMinusRadius= dist - modelRadius;
+00283                 if(distMinusRadius<_AttenuationBegin)
+00284                         gAtt= 1;
+00285                 else if(distMinusRadius<_AttenuationEnd)
+00286                 {
+00287                         gAtt= (_AttenuationEnd - distMinusRadius) * _OODeltaAttenuation;
+00288                 }
+00289                 else
+00290                         gAtt= 0;
+00291         }
+00292 
+00293         // Spot Attenuation
+00294         if(_Type== SpotLight)
+00295         {
+00296                 float   spotAtt;
+00297 
+00298                 // Compute unnormalized direction
+00299                 CVector dir= pos - _Position;
+00300                 // get cosAngle(dir, SpotDirection):
+00301                 float   cosAngleDirSpot= (dir*_SpotDirection) / dist;
+00302 
+00303                 // Modify with modelRadius. NB: made Only for big models.
+00304                 if(modelRadius>0)
+00305                 {
+00306                         // If the pointLight is in the model, consider no spotAtt
+00307                         if(modelRadius > dist)
+00308                                 spotAtt= 1;
+00309                         else
+00310                         {
+00311                                 // compute the angle of the cone made by the model sphere and the pointLightCenter.
+00312                                 float   cosAngleSphere= modelRadius / sqrtf( sqr(dist) + sqr(modelRadius) ); 
+00313                                 /* If this one is smaller than cosAngleDirSpot, it's mean that the angle of this cone is greater than the 
+00314                                         angleDirSpot, hence a part of the sphere "ps" exist such that _SportDirection*(ps-_Position).normed() == 1
+00315                                         => no spotAttenuation
+00316                                 */
+00317                                 if(cosAngleSphere < cosAngleDirSpot)
+00318                                         spotAtt= 1;
+00319                                 else
+00320                                 {
+00321                                         // Must compute cos( AngleDirSpot-AngleSphere )
+00322                                         float   sinAngleSphere= sqrtf(1 - sqr(cosAngleSphere));
+00323                                         float   sinAngleDirSpot= sqrtf(1 - sqr(cosAngleDirSpot));
+00324                                         float   cosDelta= cosAngleSphere * cosAngleDirSpot + sinAngleSphere * sinAngleDirSpot;
+00325 
+00326                                         // spot attenuation on the exterior of the sphere
+00327                                         spotAtt= (cosDelta - _CosSpotAngleEnd) * _OOCosSpotAngleDelta;
+00328                                 }
+00329                         }
+00330                 }
+00331                 else
+00332                 {
+00333                         // spot attenuation
+00334                         spotAtt= (cosAngleDirSpot - _CosSpotAngleEnd) * _OOCosSpotAngleDelta;
+00335                 }
+00336 
+00337                 // modulate
+00338                 clamp(spotAtt, 0.f, 1.f);
+00339                 gAtt*= spotAtt;
+00340         }
+00341 
+00342         return gAtt;
+00343 }
+
+

+ + + + +
+ + + + + + + + + + +
float NL3D::CPointLight::computeLinearAttenuation const CVector pos  )  const [inherited]
+
+ + + + + +
+   + + +

+Compute a linear attenuation from a point according to attenuation and spot setup. Return [0,1]. +

+ +

+Definition at line 267 of file point_light.cpp. +

+Referenced by NL3D::CLightingManager::computeModelLightContributions(), NL3D::CPatch::generateTileVegetable(), NL3D::CZoneLighter::processZonePointLightRT(), NL3D::CZoneLighter::CPointLightRT::testRaytrace(), NL3D::CInstanceLighter::CPointLightRT::testRaytrace(), and NL3D::CTransform::traverseLight(). +

+

00268 {
+00269         return computeLinearAttenuation(pos, (pos - _Position).norm() );
+00270 }
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CRGBA NL3D::CPointLight::getAmbient  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the ambient color of the light. +

+ +

+Definition at line 129 of file point_light.h. +

+Referenced by NL3D::CLightContribution::computeCurrentAmbient(), NL3D::CLightingManager::computeModelLightContributions(), CPointLightNamed(), NL3D::CPointLightUser::getAmbient(), and NL3D::CSurfaceLightGrid::getStaticLightSetup(). +

+

00129 {return _Ambient;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CPointLight::getAttenuationBegin  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the begin radius of the attenuation. +

+ +

+Definition at line 141 of file point_light.h. +

+References NL3D::CPointLight::_AttenuationBegin. +

+Referenced by NL3D::CZoneLighter::addStaticPointLight(), NL3D::CInstanceLighter::addStaticPointLight(), NL3D::CPatchDLMPointLight::compile(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CPointLightUser::getAttenuationBegin(), and NL3D::CPSLight::step(). +

+

00141 {return _AttenuationBegin;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CPointLight::getAttenuationEnd  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the end radius of the attenuation. +

+ +

+Definition at line 143 of file point_light.h. +

+References NL3D::CPointLight::_AttenuationEnd. +

+Referenced by NL3D::CLightingManager::addDynamicLight(), NL3D::CZoneLighter::addStaticPointLight(), NL3D::CInstanceLighter::addStaticPointLight(), NL3D::CPatchDLMPointLight::compile(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CPointLightUser::getAttenuationEnd(), NL3D::CZoneLighter::CPredPointLightToPoint::operator()(), NL3D::CInstanceLighter::CPredPointLightToPoint::operator()(), and NL3D::CPSLight::step(). +

+

00143 {return _AttenuationEnd;}
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CRGBA NL3D::CPointLightNamed::getDefaultAmbient  )  const [inline]
+
+ + + + + +
+   + + +

+Get the Default ambient color of the light. +

+ +

+Definition at line 71 of file point_light_named.h. +

+References _DefaultAmbient. +

+

00071 {return _DefaultAmbient;}
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CRGBA NL3D::CPointLightNamed::getDefaultDiffuse  )  const [inline]
+
+ + + + + +
+   + + +

+Get the Default diffuse color of the light. +

+ +

+Definition at line 73 of file point_light_named.h. +

+References _DefaultDiffuse. +

+

00073 {return _DefaultDiffuse;}
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CRGBA NL3D::CPointLightNamed::getDefaultSpecular  )  const [inline]
+
+ + + + + +
+   + + +

+Get the Default specular color of the light. +

+ +

+Definition at line 75 of file point_light_named.h. +

+References _DefaultSpecular. +

+

00075 {return _DefaultSpecular;}
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CRGBA NL3D::CPointLight::getDiffuse  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the diffuse color of the light. +

+ +

+Definition at line 131 of file point_light.h. +

+Referenced by NL3D::CPatchDLMPointLight::compile(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CShadowMapManager::computeShadowColors(), NL3D::CShadowMapManager::computeShadowDirection(), CPointLightNamed(), NL3D::CPointLightUser::getDiffuse(), NL3D::CSkeletonModel::renderCLod(), serial(), NL3D::CPSLight::step(), and NL3D::CParticleSystemModel::traverseRender(). +

+

00131 {return _Diffuse;}
+
+

+ + + + +
+ + + + + + + + + +
const CVector& NL3D::CPointLight::getPosition  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the position in WorldSpace. +

+ +

+Definition at line 116 of file point_light.h. +

+Referenced by NL3D::CLightingManager::addDynamicLight(), NL3D::CZoneLighter::addStaticPointLight(), NL3D::CInstanceLighter::addStaticPointLight(), NL3D::CPatchDLMPointLight::compile(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CShadowMapManager::computeShadowDirection(), NL3D::CPatch::generateTileVegetable(), NL3D::CSkeletonModel::renderCLod(), and NL3D::CTransform::traverseLight(). +

+

00116 {return _Position;}
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CRGBA NL3D::CPointLight::getSpecular  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the specular color of the light. +

+ +

+Definition at line 133 of file point_light.h. +

+Referenced by CPointLightNamed(), and NL3D::CPointLightUser::getSpecular(). +

+

00133 {return _Specular;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CPointLight::getSpotAngleBegin  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the begin radius of the SpotAngles. +

+ +

+Definition at line 151 of file point_light.h. +

+References NL3D::CPointLight::_SpotAngleBegin. +

+Referenced by NL3D::CPatchDLMPointLight::compile(), and NL3D::CPointLightUser::getSpotAngleBegin(). +

+

00151 {return _SpotAngleBegin;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CPointLight::getSpotAngleEnd  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the end radius of the SpotAngles. +

+ +

+Definition at line 153 of file point_light.h. +

+References NL3D::CPointLight::_SpotAngleEnd. +

+Referenced by NL3D::CPatchDLMPointLight::compile(), and NL3D::CPointLightUser::getSpotAngleEnd(). +

+

00153 {return _SpotAngleEnd;}
+
+

+ + + + +
+ + + + + + + + + +
const CVector& NL3D::CPointLight::getSpotDirection  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the spot Direction +

+ +

+Definition at line 161 of file point_light.h. +

+References NL3D::CPointLight::_SpotDirection. +

+Referenced by NL3D::CPatchDLMPointLight::compile(), and NL3D::CPointLightModel::traverseLight(). +

+

00161 {return _SpotDirection;}
+
+

+ + + + +
+ + + + + + + + + +
CPointLight::TType NL3D::CPointLight::getType  )  const [inherited]
+
+ + + + + +
+   + + +

+Get the ambient color of the light. +

+ +

+Definition at line 138 of file point_light.cpp. +

+Referenced by NL3D::CPatchDLMPointLight::compile(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CPointLightUser::isSpotlight(), NL3D::CInstanceLighter::processIGPointLightRT(), NL3D::CZoneLighter::CPointLightRT::testRaytrace(), NL3D::CInstanceLighter::CPointLightRT::testRaytrace(), and NL3D::CPointLightModel::traverseLight(). +

+

00139 {
+00140         return _Type;
+00141 }
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CRGBA NL3D::CPointLightNamed::getUnAnimatedDiffuse  )  const [inline]
+
+ + + + + +
+   + + +

+get the unanimated diffuse (used for Landscape) +

+ +

+Definition at line 78 of file point_light_named.h. +

+References _UnAnimatedDiffuse. +

+Referenced by NL3D::CVegetableLightEx::computeCurrentColors(). +

+

00078 {return _UnAnimatedDiffuse;}
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CPointLight::purge  )  [static, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 424 of file point_light.cpp. +

+References NL3D::CPointLight::_LightedModelListMemory, and NLMISC::CBlockMemory< CTransform *, false >::purge(). +

+

00425 {
+00426         _LightedModelListMemory.purge();
+00427 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::removeLightedModel ItTransformList  it  )  [inherited]
+
+ + + + + +
+   + + +

+remove a model from the list. called by CTransform. +

+ +

+Definition at line 418 of file point_light.cpp. +

+References NL3D::CPointLight::_LightedModels, and NL3D::CPointLight::ItTransformList. +

+Referenced by NL3D::CTransform::resetLighting(). +

+

00419 {
+00420         // delete the entry in the list.
+00421         _LightedModels.erase(it);
+00422 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CPointLight::resetLightedModels  )  [inherited]
+
+ + + + + +
+   + + +

+Dirt all models this light influence. +

+ +

+Definition at line 393 of file point_light.cpp. +

+References NL3D::CPointLight::_LightedModels, nlassert, and NL3D::CTransform::resetLighting(). +

+Referenced by NL3D::CPointLightModel::traverseLight(), and NL3D::CPointLight::~CPointLight(). +

+

00394 {
+00395         // For each transform, resetLighting him.
+00396         while(_LightedModels.begin() != _LightedModels.end() )
+00397         {
+00398                 CTransform      *model= *_LightedModels.begin();
+00399                 // reset lighting
+00400                 model->resetLighting();
+00401 
+00402                 // NB: the transform must erase him from this list.
+00403                 nlassert( _LightedModels.begin() == _LightedModels.end() || *_LightedModels.begin() != model );
+00404         }
+00405 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLightNamed::serial NLMISC::IStream f  ) 
+
+ + + + + +
+   + + +

+Get the ambient color of the light. +

+ +

+Reimplemented from NL3D::CPointLight. +

+Definition at line 73 of file point_light_named.cpp. +

+References _DefaultAmbient, _DefaultDiffuse, _DefaultSpecular, _UnAnimatedDiffuse, NL3D::CPointLight::getDiffuse(), NLMISC::IStream::isReading(), NLMISC::IStream::serial(), NLMISC::IStream::serialVersion(), and sint. +

+

00074 {
+00075         sint ver = f.serialVersion(1);
+00076 
+00077         // Serialize parent.
+00078         CPointLight::serial(f);
+00079 
+00080         // Serialize my data
+00081         f.serial(AnimatedLight);
+00082         f.serial(_DefaultAmbient);
+00083         f.serial(_DefaultDiffuse);
+00084         f.serial(_DefaultSpecular);
+00085 
+00086         if (ver>=1)
+00087                 f.serial(LightGroup);
+00088 
+00089         // read: and copy default _UnAnimatedDiffuse
+00090         if(f.isReading())
+00091         {
+00092                 _UnAnimatedDiffuse= getDiffuse();
+00093         }
+00094 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::setAmbient NLMISC::CRGBA  ambient  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Set the ambient color of the light. Default to Black. +

+ +

+Definition at line 120 of file point_light.h. +

+Referenced by NL3D::CPointLightUser::setAmbient(), and setLightFactor(). +

+

00120 {_Ambient=ambient;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::setColor NLMISC::CRGBA  color  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Set the diffuse and specular color of the light to the same value. don't modify _Ambient. +

+ +

+Definition at line 126 of file point_light.h. +

+Referenced by NL3D::CPointLightUser::setColor(), and NL3D::CPSLight::step(). +

+

00126 {_Diffuse= _Specular= color;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLightNamed::setDefaultAmbient NLMISC::CRGBA  ambient  )  [inline]
+
+ + + + + +
+   + + +

+Set the Default ambient color of the light. Default to Black. +

+ +

+Definition at line 64 of file point_light_named.h. +

+References _DefaultAmbient. +

+

00064 {_DefaultAmbient=ambient;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLightNamed::setDefaultDiffuse NLMISC::CRGBA  diffuse  )  [inline]
+
+ + + + + +
+   + + +

+Set the Default diffuse color of the light. Default to White. +

+ +

+Definition at line 66 of file point_light_named.h. +

+References _DefaultDiffuse. +

+

00066 {_DefaultDiffuse=diffuse;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLightNamed::setDefaultSpecular NLMISC::CRGBA  specular  )  [inline]
+
+ + + + + +
+   + + +

+Set the Default specular color of the light. Default to White. +

+ +

+Definition at line 68 of file point_light_named.h. +

+References _DefaultSpecular. +

+

00068 {_DefaultSpecular=specular;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::setDiffuse NLMISC::CRGBA  diffuse  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Set the diffuse color of the light. Default to White. +

+ +

+Definition at line 122 of file point_light.h. +

+Referenced by NL3D::CPointLightUser::setDiffuse(), and setLightFactor(). +

+

00122 {_Diffuse=diffuse;}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPointLightNamed::setLightFactor NLMISC::CRGBA  nAnimatedFactor,
NLMISC::CRGBA  nUnAnimatedFactor
+
+ + + + + +
+   + + +

+modulate the default color setup with nFactor, and set to the current setup. give 2 params the second is the "not animated" factor. used for Landscape. +

+Definition at line 53 of file point_light_named.cpp. +

+References _DefaultAmbient, _DefaultDiffuse, _DefaultSpecular, _UnAnimatedDiffuse, NLMISC::CRGBA::modulateFromColor(), NL3D::CPointLight::setAmbient(), NL3D::CPointLight::setDiffuse(), and NL3D::CPointLight::setSpecular(). +

+

00054 {
+00055         CRGBA   col;
+00056         // setup current ambient.
+00057         col.modulateFromColor(_DefaultAmbient, nAnimatedFactor);
+00058         setAmbient(col);
+00059         // setup current diffuse.
+00060         col.modulateFromColor(_DefaultDiffuse, nAnimatedFactor);
+00061         setDiffuse(col);
+00062         // setup current specular.
+00063         col.modulateFromColor(_DefaultSpecular, nAnimatedFactor);
+00064         setSpecular(col);
+00065 
+00066         // special UnAnimatedDiffuse
+00067         col.modulateFromColor(_DefaultDiffuse, nUnAnimatedFactor);
+00068         _UnAnimatedDiffuse= col;
+00069 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLightNamed::setLightFactor NLMISC::CRGBA  nFactor  ) 
+
+ + + + + +
+   + + +

+modulate the default color setup with nFactor, and set to the current setup. NB: getUnAnimatedDiffuse() == getDiffuse() +

+Definition at line 46 of file point_light_named.cpp. +

+

00047 {
+00048         setLightFactor(nFactor, nFactor);
+00049 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::setPosition const CVector v  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Set the position in WorldSpace. +

+ +

+Definition at line 114 of file point_light.h. +

+References v. +

+Referenced by NL3D::CPointLightModel::traverseLight(). +

+

00114 {_Position= v;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::setSpecular NLMISC::CRGBA  specular  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Set the specular color of the light. Default to White. +

+ +

+Definition at line 124 of file point_light.h. +

+Referenced by setLightFactor(), and NL3D::CPointLightUser::setSpecular(). +

+

00124 {_Specular=specular;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::setType TType  type  )  [inherited]
+
+ + + + + +
+   + + +

+set/get the type of the light. +

+ +

+Definition at line 134 of file point_light.cpp. +

+References type. +

+Referenced by NL3D::CPointLightUser::enableSpotlight(). +

+

00135 {
+00136         _Type= type;
+00137 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPointLight::setupAttenuation float  attenuationBegin,
float  attenuationEnd
[inherited]
+
+ + + + + +
+   + + +

+setup the attenuation of the light. if (0,0) attenuation is disabled. clamp(attenuationBegin,0 , +oo) and calmp(attenuationEnd, attenuationBegin, +oo) +

+Definition at line 144 of file point_light.cpp. +

+References NL3D::CPointLight::_AttenuationBegin, NL3D::CPointLight::_AttenuationEnd, and NL3D::CPointLight::computeAttenuationFactors(). +

+Referenced by NL3D::CPointLightUser::setupAttenuation(), and NL3D::CPSLight::step(). +

+

00145 {
+00146         // set values.
+00147         attenuationBegin= max(attenuationBegin, 0.f);
+00148         attenuationEnd= max(attenuationEnd, attenuationBegin);
+00149         _AttenuationBegin= attenuationBegin;
+00150         _AttenuationEnd= attenuationEnd;
+00151 
+00152         // update factors.
+00153         computeAttenuationFactors();
+00154 
+00155 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPointLight::setupDriverLight CLight light,
uint8  factor
[inherited]
+
+ + + + + +
+   + + +

+setup the CLight with current pointLight state. factor is used to modulate the colors. +

+ +

+Definition at line 346 of file point_light.cpp. +

+References NL3D::CPointLight::_SpotDirection, NL3D::CPointLight::_SpotExponent, NLMISC::CRGBA::modulateFromuiRGBOnly(), NL3D::CLight::setupPointLight(), NL3D::CLight::setupSpotLight(), uint, and uint8. +

+

00347 {
+00348         // expand 0..255 to 0..256, to avoid loss of precision.
+00349         uint    ufactor= factor + (factor>>7);  // add 0 or 1.
+00350 
+00351         // modulate with factor
+00352         CRGBA   ambient, diffuse, specular;
+00353         ambient.modulateFromuiRGBOnly(_Ambient, ufactor);
+00354         diffuse.modulateFromuiRGBOnly(_Diffuse, ufactor);
+00355         specular.modulateFromuiRGBOnly(_Specular, ufactor);
+00356 
+00357         // setup the pointLight
+00358         if(_Type == SpotLight )
+00359         {
+00360                 light.setupSpotLight(ambient, diffuse, specular, _Position, _SpotDirection, 
+00361                         _SpotExponent, float(NLMISC::Pi/2) ,
+00362                         _ConstantAttenuation, _LinearAttenuation, _QuadraticAttenuation);
+00363         }
+00364         // PointLight or AmbientLight
+00365         else
+00366         {
+00367                 light.setupPointLight(ambient, diffuse, specular, _Position, CVector::Null, 
+00368                         _ConstantAttenuation, _LinearAttenuation, _QuadraticAttenuation);
+00369         }
+00370 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPointLight::setupDriverLightUserAttenuation CLight light,
uint8  factor
[inherited]
+
+ + + + + +
+   + + +

+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 374 of file point_light.cpp. +

+References NLMISC::CRGBA::modulateFromuiRGBOnly(), NL3D::CLight::setupPointLight(), uint, and uint8. +

+

00375 {
+00376         // expand 0..255 to 0..256, to avoid loss of precision.
+00377         uint    ufactor= factor + (factor>>7);  // add 0 or 1.
+00378 
+00379         // modulate with factor
+00380         CRGBA   ambient, diffuse, specular;
+00381         ambient.modulateFromuiRGBOnly(_Ambient, ufactor);
+00382         diffuse.modulateFromuiRGBOnly(_Diffuse, ufactor);
+00383         specular.modulateFromuiRGBOnly(_Specular, ufactor);
+00384 
+00385         // setup the pointLight, disabling attenuation. 
+00386         // NB: setup a pointLight even if it is a SpotLight because already attenuated
+00387         light.setupPointLight(ambient, diffuse, specular, _Position, CVector::Null, 
+00388                 1, 0, 0);
+00389 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CPointLight::setupSpotAngle float  spotAngleBegin,
float  spotAngleEnd
[inherited]
+
+ + + + + +
+   + + +

+setup the spot AngleBegin and AngleEnd that define spot attenuation of the light. Usefull only if SpotLight NB: clamp(angleBegin, 0, PI); clamp(angleEnd, angleBegin, PI); Default is PI/4, PI/2 +

+Definition at line 159 of file point_light.cpp. +

+References NL3D::CPointLight::_SpotAngleBegin, NL3D::CPointLight::_SpotAngleEnd, NLMISC::clamp(), NL3D::CPointLight::computeSpotAttenuationFactors(), and NLMISC::Pi. +

+Referenced by NL3D::CPointLightUser::setupSpotAngle(). +

+

00160 {
+00161         clamp(spotAngleBegin, 0.f, float(Pi));
+00162         clamp(spotAngleEnd, spotAngleBegin, float(Pi));
+00163         _SpotAngleBegin= spotAngleBegin;
+00164         _SpotAngleEnd= spotAngleEnd;
+00165 
+00166         // update factors.
+00167         computeSpotAttenuationFactors();
+00168 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CPointLight::setupSpotDirection const CVector dir  )  [inherited]
+
+ + + + + +
+   + + +

+setup the spot Direction. Usefull only if SpotLight. Normalized internally Default is (0, 1, 0) +

+Definition at line 172 of file point_light.cpp. +

+References NL3D::CPointLight::_SpotDirection, and NLMISC::CVector::normalize(). +

+Referenced by NL3D::CPointLightModel::traverseLight(). +

+

00173 {
+00174         _SpotDirection= dir;
+00175         _SpotDirection.normalize();
+00176 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CLightInfluenceInterpolator [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 98 of file point_light_named.h.

+


Field Documentation

+

+ + + + +
+ + +
NLMISC::CRGBA NL3D::CPointLightNamed::_DefaultAmbient [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 102 of file point_light_named.h. +

+Referenced by CPointLightNamed(), getDefaultAmbient(), serial(), setDefaultAmbient(), and setLightFactor().

+

+ + + + +
+ + +
NLMISC::CRGBA NL3D::CPointLightNamed::_DefaultDiffuse [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 103 of file point_light_named.h. +

+Referenced by CPointLightNamed(), getDefaultDiffuse(), serial(), setDefaultDiffuse(), and setLightFactor().

+

+ + + + +
+ + +
NLMISC::CRGBA NL3D::CPointLightNamed::_DefaultSpecular [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 104 of file point_light_named.h. +

+Referenced by CPointLightNamed(), getDefaultSpecular(), serial(), setDefaultSpecular(), and setLightFactor().

+

+ + + + +
+ + +
sint NL3D::CPointLightNamed::_IdInInfluenceList [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 99 of file point_light_named.h. +

+Referenced by NL3D::CLightInfluenceInterpolator::interpolate().

+

+ + + + +
+ + +
NLMISC::CRGBA NL3D::CPointLightNamed::_UnAnimatedDiffuse [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 107 of file point_light_named.h. +

+Referenced by CPointLightNamed(), getUnAnimatedDiffuse(), serial(), and setLightFactor().

+

+ + + + +
+ + +
std::string NL3D::CPointLightNamed::AnimatedLight +
+
+ + + + + +
+   + + +

+Animation used by this light. +

+ +

+Definition at line 52 of file point_light_named.h. +

+Referenced by NL3D::CPointLightNamedSort::operator<().

+

+ + + + +
+ + +
uint32 NL3D::CPointLightNamed::LightGroup +
+
+ + + + + +
+   + + +

+Group of the light. +

+ +

+Definition at line 55 of file point_light_named.h. +

+Referenced by NL3D::CPointLightNamedSort::operator<().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 07:02:30 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1