|
|
@ -4,13 +4,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FOG @shPropertyBool(fog)
|
|
|
|
#define FOG @shPropertyBool(fog)
|
|
|
|
#define MRT @shPropertyNotBool(is_transparent) && @shPropertyBool(mrt_output)
|
|
|
|
#define MRT @shPropertyNotBool(is_transparent) && @shPropertyBool(mrt_output) && @shGlobalSettingBool(mrt_output)
|
|
|
|
#define LIGHTING @shPropertyBool(lighting)
|
|
|
|
#define LIGHTING @shPropertyBool(lighting)
|
|
|
|
|
|
|
|
|
|
|
|
#define SHADOWS LIGHTING && 0
|
|
|
|
#define SHADOWS LIGHTING && 0
|
|
|
|
#define SHADOWS_PSSM LIGHTING
|
|
|
|
#define SHADOWS_PSSM LIGHTING
|
|
|
|
|
|
|
|
|
|
|
|
#define SHADOWS 1 && LIGHTING
|
|
|
|
#define SHADOWS 0 && LIGHTING
|
|
|
|
#define SHADOWS_PSSM 0 && LIGHTING
|
|
|
|
#define SHADOWS_PSSM 0 && LIGHTING
|
|
|
|
|
|
|
|
|
|
|
|
#if FOG || MRT || SHADOWS_PSSM
|
|
|
|
#if FOG || MRT || SHADOWS_PSSM
|
|
|
@ -132,13 +132,13 @@
|
|
|
|
#if SHADOWS
|
|
|
|
#if SHADOWS
|
|
|
|
shInput(float4, lightSpacePos0)
|
|
|
|
shInput(float4, lightSpacePos0)
|
|
|
|
shSampler2D(shadowMap0)
|
|
|
|
shSampler2D(shadowMap0)
|
|
|
|
shUniform(float2 invShadowmapSize0) @shAutoConstant(invShadowmapSize0, inverse_texture_size, 0)
|
|
|
|
shUniform(float2 invShadowmapSize0) @shAutoConstant(invShadowmapSize0, inverse_texture_size, 1)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if SHADOWS_PSSM
|
|
|
|
#if SHADOWS_PSSM
|
|
|
|
@shForeach(3)
|
|
|
|
@shForeach(3)
|
|
|
|
shInput(float4, lightSpacePos@shIterator)
|
|
|
|
shInput(float4, lightSpacePos@shIterator)
|
|
|
|
shSampler2D(shadowMap@shIterator)
|
|
|
|
shSampler2D(shadowMap@shIterator)
|
|
|
|
shUniform(float2 invShadowmapSize@shIterator) @shAutoConstant(invShadowmapSize@shIterator, inverse_texture_size, @shIterator)
|
|
|
|
shUniform(float2 invShadowmapSize@shIterator) @shAutoConstant(invShadowmapSize@shIterator, inverse_texture_size, @shIterator(1))
|
|
|
|
@shEndForeach
|
|
|
|
@shEndForeach
|
|
|
|
shUniform(float4 pssmSplitPoints) @shSharedParameter(pssmSplitPoints)
|
|
|
|
shUniform(float4 pssmSplitPoints) @shSharedParameter(pssmSplitPoints)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -148,7 +148,7 @@
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
SH_START_PROGRAM
|
|
|
|
SH_START_PROGRAM
|
|
|
|
{
|
|
|
|
{
|
|
|
|
shOutputColor(0) = shSample(diffuseMap, UV);
|
|
|
|
shOutputColour(0) = shSample(diffuseMap, UV);
|
|
|
|
|
|
|
|
|
|
|
|
#if LIGHTING
|
|
|
|
#if LIGHTING
|
|
|
|
float3 normal = normalize(normalPassthrough);
|
|
|
|
float3 normal = normalize(normalPassthrough);
|
|
|
@ -194,24 +194,24 @@
|
|
|
|
ambient *= colorPassthrough.xyz;
|
|
|
|
ambient *= colorPassthrough.xyz;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
shOutputColor(0).xyz *= (ambient + diffuse + materialEmissive.xyz);
|
|
|
|
shOutputColour(0).xyz *= (ambient + diffuse + materialEmissive.xyz);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_VERTEXCOLOR && !LIGHTING
|
|
|
|
#if HAS_VERTEXCOLOR && !LIGHTING
|
|
|
|
shOutputColor(0).xyz *= colorPassthrough.xyz;
|
|
|
|
shOutputColour(0).xyz *= colorPassthrough.xyz;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if FOG
|
|
|
|
#if FOG
|
|
|
|
float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w);
|
|
|
|
float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w);
|
|
|
|
shOutputColor(0).xyz = shLerp (shOutputColor(0).xyz, fogColor, fogValue);
|
|
|
|
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, fogColor, fogValue);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// prevent negative color output (for example with negative lights)
|
|
|
|
// prevent negative color output (for example with negative lights)
|
|
|
|
shOutputColor(0).xyz = max(shOutputColor(0).xyz, float3(0,0,0));
|
|
|
|
shOutputColour(0).xyz = max(shOutputColour(0).xyz, float3(0,0,0));
|
|
|
|
|
|
|
|
|
|
|
|
#if MRT
|
|
|
|
#if MRT
|
|
|
|
shOutputColor(1) = float4(depthPassthrough / far,1,1,1);
|
|
|
|
shOutputColour(1) = float4(depthPassthrough / far,1,1,1);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|