|
|
|
@ -3,8 +3,11 @@
|
|
|
|
|
#define FOG @shGlobalSettingBool(fog)
|
|
|
|
|
#define MRT @shGlobalSettingBool(mrt_output)
|
|
|
|
|
|
|
|
|
|
#define COLOUR_MAP @shPropertyBool(colour_map)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@shAllocatePassthrough(1, depth)
|
|
|
|
|
@shAllocatePassthrough(2, UV)
|
|
|
|
|
|
|
|
|
|
#ifdef SH_VERTEX_SHADER
|
|
|
|
|
|
|
|
|
@ -26,6 +29,7 @@
|
|
|
|
|
shOutputPosition = shMatrixMult(viewProjMatrix, worldPos);
|
|
|
|
|
|
|
|
|
|
@shPassthroughAssign(depth, shOutputPosition.z);
|
|
|
|
|
@shPassthroughAssign(UV, uv0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -34,11 +38,20 @@
|
|
|
|
|
SH_BEGIN_PROGRAM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if COLOUR_MAP
|
|
|
|
|
shSampler2D(colourMap)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if FOG
|
|
|
|
|
shUniform(float3, fogColor) @shAutoConstant(fogColor, fog_colour)
|
|
|
|
|
shUniform(float4, fogParams) @shAutoConstant(fogParams, fog_params)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
@shPassthroughFragmentInputs
|
|
|
|
|
|
|
|
|
|
#if MRT
|
|
|
|
|
shDeclareMrtOutput(1)
|
|
|
|
|
shUniform(float, far) @shAutoConstant(far, far_clip_distance)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -47,12 +60,22 @@
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
float depth = @shPassthroughReceive(depth);
|
|
|
|
|
float2 UV = @shPassthroughReceive(UV);
|
|
|
|
|
|
|
|
|
|
shOutputColour(0) = float4(1,0,0,1);
|
|
|
|
|
|
|
|
|
|
#if COLOUR_MAP
|
|
|
|
|
shOutputColour(0).rgb *= shSample(colourMap, UV).rgb;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if FOG
|
|
|
|
|
float fogValue = shSaturate((depth - fogParams.y) * fogParams.w);
|
|
|
|
|
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, fogColor, fogValue);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if MRT
|
|
|
|
|
//shOutputColour(1) = float4(1,1,1,1);
|
|
|
|
|
shOutputColour(1) = float4(depth / far,1,1,1);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|