mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-14 04:03:46 +00:00
provide a new levelinfo. fallbackAmbient value for scenes with no global light source
This commit is contained in:
parent
34f2234399
commit
270cf0e054
3 changed files with 22 additions and 7 deletions
|
|
@ -42,6 +42,7 @@
|
|||
Signal<void(const char*,bool)> LightManager::smActivateSignal;
|
||||
LightManager *LightManager::smActiveLM = NULL;
|
||||
|
||||
LinearColorF gFallbackAmbient;
|
||||
|
||||
LightManager::LightManager( const char *name, const char *id )
|
||||
: mName( name ),
|
||||
|
|
@ -162,19 +163,28 @@ LightInfo* LightManager::getDefaultLight()
|
|||
{
|
||||
// The sun is always our default light when
|
||||
// when its registered.
|
||||
if ( mSpecialLights[ LightManager::slSunLightType ] )
|
||||
return mSpecialLights[ LightManager::slSunLightType ];
|
||||
if (mSpecialLights[LightManager::slSunLightType])
|
||||
{
|
||||
mSpecialLights[LightManager::slSunLightType]->setAmbient(gFallbackAmbient);
|
||||
return mSpecialLights[LightManager::slSunLightType];
|
||||
}
|
||||
|
||||
// Else return a dummy special light.
|
||||
if ( !mDefaultLight )
|
||||
if (!mDefaultLight)
|
||||
{
|
||||
mDefaultLight = createLightInfo();
|
||||
}
|
||||
mDefaultLight->setAmbient(gFallbackAmbient);
|
||||
return mDefaultLight;
|
||||
}
|
||||
|
||||
LightInfo* LightManager::getSpecialLight( LightManager::SpecialLightTypesEnum type, bool useDefault )
|
||||
{
|
||||
if ( mSpecialLights[type] )
|
||||
if (mSpecialLights[type])
|
||||
{
|
||||
mSpecialLights[LightManager::slSunLightType]->setAmbient(gFallbackAmbient);
|
||||
return mSpecialLights[type];
|
||||
}
|
||||
|
||||
if ( useDefault )
|
||||
return getDefaultLight();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue