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