#include <light_contribution.h>
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.
Nevrax France
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. | |
CPointLight * | FrozenAmbientLight |
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 |
CPointLight * | PointLight [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.
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 } |
|
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 } |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
Definition at line 96 of file light_contribution.h. Referenced by NL3D::CRenderTrav::changeLightSetup(), and NL3D::CLightingManager::computeModelLightContributions(). |
|
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(). |
|
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(). |
|
|
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(). |
|
Definition at line 88 of file light_contribution.h. Referenced by NL3D::CRenderTrav::changeLightSetup(), CLightContribution(), NL3D::CLightingManager::computeModelLightContributions(), and NL3D::CTransform::useMergedPointLight(). |