NL3D::CLightContribution Class Reference

#include <light_contribution.h>


Detailed Description

light contribution on a model. Owned by a CTransform computed by lighting manager. result CLight is computed at render.

if FrozenStaticLightSetup, then the SunContribution won't never be recomputed, and the first NumFrozenStaticLight PointLight are considered always valid and their setup won't be recomputed too. It's means also that CTransform::resetLighting() do not affect those NumFrozenStaticLight.

Typically, FrozenStaticLightSetup is setup for models and lights THAT ARE IN SAME IG, and are deleted together. This last point is important because the first NumFrozenStaticLight PointLight pointers are never updated, so delete a light which is in this setup will cause memory failure.

Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 63 of file light_contribution.h.

Public Member Functions

 CLightContribution ()
 Constructor.

CRGBA computeCurrentAmbient (CRGBA sunAmbient) const

Data Fields

uint8 AttFactor [6]
 the Attenuation factor of influence to apply to each point light. Used if the model

uint8 Factor [6]
 the factor of influence to apply to each point light.

CPointLightFrozenAmbientLight
bool FrozenStaticLightSetup
 Tells if there is some frozen static light setup.

NLMISC::CRGBA LocalAmbient
 the Dynamic Local Ambient. If A==0 then full SunAmbient is taken. If A==255, take full LocalAmbient color.

CRGBA MergedPointLight
uint8 NumFrozenStaticLight
CPointLightPointLight [6]
 This is the list of Light which influence us. The first NULL means end_of_list.

uint8 SunContribution
CPointLight::ItTransformList TransformIterator [6]
 An iterator on the list of model in the pointLight which owns our transform.

bool UseMergedPointLight


Constructor & Destructor Documentation

NL3D::CLightContribution::CLightContribution  ) 
 

Constructor.

Definition at line 34 of file light_contribution.cpp.

References FrozenAmbientLight, FrozenStaticLightSetup, and UseMergedPointLight.

00035 {
00036         FrozenStaticLightSetup= false;
00037         // empty the list.
00038         PointLight[0]= NULL;
00039         // default is to take fully light from the sun.
00040         SunContribution= 255;
00041 
00042         FrozenAmbientLight= NULL;
00043 
00044         UseMergedPointLight= false;
00045 }


Member Function Documentation

CRGBA NL3D::CLightContribution::computeCurrentAmbient CRGBA  sunAmbient  )  const [inline]
 

Compute the current ambiant according to the FrozenAmbientLight, or LocalAmbient and provided sunAmbiant NB: The MergerPointLight is not added (since not really an ambiant)

Definition at line 106 of file light_contribution.h.

References NLMISC::CRGBA::A, NLMISC::CRGBA::addRGBOnly(), FrozenAmbientLight, FrozenStaticLightSetup, NL3D::CPointLight::getAmbient(), LocalAmbient, NLMISC::CRGBA::modulateFromuiRGBOnly(), and uint.

Referenced by NL3D::CRenderTrav::changeLightSetup(), and NL3D::CShadowMapManager::computeShadowColors().

00107         {
00108                 CRGBA   finalAmbient;
00109                 if(FrozenStaticLightSetup)
00110                 {
00111                         // Any FrozenAmbientLight provided??
00112                         if(FrozenAmbientLight)
00113                                 // Take his current (maybe animated) ambient
00114                                 finalAmbient= FrozenAmbientLight->getAmbient();
00115                         else
00116                                 // Take the sun ones.
00117                                 finalAmbient= sunAmbient;
00118                 }
00119                 else
00120                 {
00121                         // must interpolate between SunAmbient and localAmbient
00122                         uint    uAmbFactor= LocalAmbient.A;
00123                         // expand 0..255 to 0..256, to avoid loss of precision.
00124                         uAmbFactor+= uAmbFactor>>7;
00125                         // Blend, but LocalAmbient.r/g/b is already multiplied by a.
00126                         finalAmbient.modulateFromuiRGBOnly(sunAmbient, 256 - uAmbFactor);
00127                         finalAmbient.addRGBOnly(finalAmbient, LocalAmbient);
00128                 }
00129                 return finalAmbient;
00130         }


Field Documentation

uint8 NL3D::CLightContribution::AttFactor[ 6 ]
 

the Attenuation factor of influence to apply to each point light. Used if the model

Definition at line 73 of file light_contribution.h.

Referenced by NL3D::CRenderTrav::changeLightSetup(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CShadowMapManager::computeShadowColors(), NL3D::CShadowMapManager::computeShadowDirection(), NL3D::CSkeletonModel::renderCLod(), NL3D::CTransform::traverseLight(), and NL3D::CParticleSystemModel::traverseRender().

uint8 NL3D::CLightContribution::Factor[ 6 ]
 

the factor of influence to apply to each point light.

Definition at line 71 of file light_contribution.h.

Referenced by NL3D::CRenderTrav::changeLightSetup(), NL3D::CLightingManager::computeModelLightContributions(), and NL3D::CTransform::freezeStaticLightSetup().

CPointLight* NL3D::CLightContribution::FrozenAmbientLight
 

if FrozenStaticLightSetup, this is the frozen AmbientLight in ig. can't be stored as RGBA, because the ambient color may change. NULL means take full Sun ambient

Definition at line 93 of file light_contribution.h.

Referenced by CLightContribution(), computeCurrentAmbient(), NL3D::CTransform::freezeStaticLightSetup(), and NL3D::CTransform::unfreezeStaticLightSetup().

bool NL3D::CLightContribution::FrozenStaticLightSetup
 

Tells if there is some frozen static light setup.

Definition at line 79 of file light_contribution.h.

Referenced by CLightContribution(), computeCurrentAmbient(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CTransform::freezeStaticLightSetup(), NL3D::CTransform::resetLighting(), NL3D::CTransform::unfreezeStaticLightSetup(), and NL3D::CTransform::updateWorld().

NLMISC::CRGBA NL3D::CLightContribution::LocalAmbient
 

the Dynamic Local Ambient. If A==0 then full SunAmbient is taken. If A==255, take full LocalAmbient color.

Definition at line 75 of file light_contribution.h.

Referenced by computeCurrentAmbient(), and NL3D::CLightingManager::computeModelLightContributions().

CRGBA NL3D::CLightContribution::MergedPointLight
 

Definition at line 96 of file light_contribution.h.

Referenced by NL3D::CRenderTrav::changeLightSetup(), and NL3D::CLightingManager::computeModelLightContributions().

uint8 NL3D::CLightContribution::NumFrozenStaticLight
 

if FrozenStaticLightSetup, tells the number of point light setup which are static. NB: it is possible that FrozenStaticLightSetup==true, and NumFrozenStaticLight==0. it means that the model is not touched by any static pointLight.

Definition at line 84 of file light_contribution.h.

Referenced by NL3D::CLightingManager::computeModelLightContributions(), NL3D::CTransform::freezeStaticLightSetup(), NL3D::CTransform::resetLighting(), NL3D::CTransform::traverseLight(), and NL3D::CTransform::unfreezeStaticLightSetup().

CPointLight* NL3D::CLightContribution::PointLight[ 6 ]
 

This is the list of Light which influence us. The first NULL means end_of_list.

Definition at line 67 of file light_contribution.h.

Referenced by NL3D::CRenderTrav::changeLightSetup(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CShadowMapManager::computeShadowColors(), NL3D::CShadowMapManager::computeShadowDirection(), NL3D::CTransform::freezeStaticLightSetup(), NL3D::CSkeletonModel::renderCLod(), NL3D::CTransform::resetLighting(), NL3D::CTransform::traverseLight(), NL3D::CParticleSystemModel::traverseRender(), and NL3D::CTransform::unfreezeStaticLightSetup().

uint8 NL3D::CLightContribution::SunContribution
 

Definition at line 86 of file light_contribution.h.

Referenced by NL3D::CRenderTrav::changeLightSetup(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CShadowMapManager::computeShadowColors(), NL3D::CShadowMapManager::computeShadowDirection(), NL3D::CTransform::freezeStaticLightSetup(), NL3D::CSkeletonModel::renderCLod(), and NL3D::CParticleSystemModel::traverseRender().

CPointLight::ItTransformList NL3D::CLightContribution::TransformIterator[ 6 ]
 

An iterator on the list of model in the pointLight which owns our transform.

Definition at line 69 of file light_contribution.h.

Referenced by NL3D::CLightingManager::computeModelLightContributions(), and NL3D::CTransform::resetLighting().

bool NL3D::CLightContribution::UseMergedPointLight
 

Definition at line 88 of file light_contribution.h.

Referenced by NL3D::CRenderTrav::changeLightSetup(), CLightContribution(), NL3D::CLightingManager::computeModelLightContributions(), and NL3D::CTransform::useMergedPointLight().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 06:49:26 2004 for NeL by doxygen 1.3.6