Merge remote branch 'scrawl/shadersystem'

This commit is contained in:
Marc Zinnschlag 2012-08-11 15:06:04 +02:00
commit 5e33d49970
2 changed files with 10 additions and 7 deletions

View file

@ -116,8 +116,9 @@
shInput(float3, normalPassthrough)
shInput(float3, objSpacePositionPassthrough)
shUniform(float4, lightAmbient) @shAutoConstant(lightAmbient, ambient_light_colour)
//shUniform(float, passIteration) @shAutoConstant(passIteration, pass_iteration_number)
#if !HAS_VERTEXCOLOR
shUniform(float4, materialAmbient) @shAutoConstant(materialAmbient, surface_ambient_colour)
#endif
shUniform(float4, materialDiffuse) @shAutoConstant(materialDiffuse, surface_diffuse_colour)
shUniform(float4, materialEmissive) @shAutoConstant(materialEmissive, surface_emissive_colour)
@shForeach(@shGlobalSettingString(num_lights))
@ -178,8 +179,13 @@
float3 lightDir;
float3 diffuse = float3(0,0,0);
float d;
#if HAS_VERTEXCOLOR
// ambient vertex colour tracking, FFP behaviour
float3 ambient = colourPassthrough.xyz * lightAmbient.xyz;
#else
float3 ambient = materialAmbient.xyz * lightAmbient.xyz;
#endif
// shadows only for the first (directional) light
#if SHADOWS
@ -237,10 +243,6 @@
#endif
@shEndForeach
#if HAS_VERTEXCOLOR
ambient *= colourPassthrough.xyz;
#endif
shOutputColour(0).xyz *= (ambient + diffuse + materialEmissive.xyz);
#endif
@ -293,6 +295,7 @@
#if MRT
shOutputColour(1) = float4(depthPassthrough / far,1,1,1);
#endif
}
#endif

View file

@ -1,5 +1,5 @@
#define FIXED_BIAS 0.005
#define FIXED_BIAS 0.0003
float depthShadowPCF (shTexture2D shadowMap, float4 shadowMapPos, float2 offset)
{