Remove unnecesary code for handle OpenGL.

This commit is contained in:
LuisAntonRebollo 2014-11-08 01:21:38 +01:00
parent c354f59b72
commit f101fbe820
5 changed files with 7 additions and 31 deletions

View file

@ -312,14 +312,8 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
{
PROFILE_SCOPE( LightManager_Update4LightConsts_setLights );
// NOTE: We haven't ported the lighting shaders on OSX
// to the optimized HLSL versions.
#if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX )
static AlignedArray<Point3F> lightPositions( 4, sizeof( Point4F ) );
#else
static AlignedArray<Point4F> lightPositions( 3, sizeof( Point4F ) );
static AlignedArray<Point4F> lightSpotDirs( 3, sizeof( Point4F ) );
#endif
static AlignedArray<Point4F> lightColors( 4, sizeof( Point4F ) );
static Point4F lightInvRadiusSq;
static Point4F lightSpotAngle;
@ -329,6 +323,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
// Need to clear the buffers so that we don't leak
// lights from previous passes or have NaNs.
dMemset( lightPositions.getBuffer(), 0, lightPositions.getBufferSize() );
dMemset( lightSpotDirs.getBuffer(), 0, lightSpotDirs.getBufferSize() );
dMemset( lightColors.getBuffer(), 0, lightColors.getBufferSize() );
lightInvRadiusSq = Point4F::Zero;
lightSpotAngle.set( -1.0f, -1.0f, -1.0f, -1.0f );
@ -342,12 +337,6 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
if ( !light )
break;
#if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX )
lightPositions[i] = light->getPosition();
#else
// The light positions and spot directions are
// in SoA order to make optimal use of the GPU.
const Point3F &lightPos = light->getPosition();
@ -366,8 +355,6 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] );
}
#endif
// Prescale the light color by the brightness to
// avoid doing this in the shader.
lightColors[i] = Point4F(light->getColor()) * light->getBrightness();
@ -381,13 +368,11 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
shaderConsts->setSafe( lightDiffuseSC, lightColors );
shaderConsts->setSafe( lightInvRadiusSqSC, lightInvRadiusSq );
#if !defined( TORQUE_OS_MAC ) && !defined( TORQUE_OS_LINUX )
shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs );
shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle );
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
#endif
}
// Setup the ambient lighting from the first