mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 09:53:52 +00:00
47 lines
872 B
Text
47 lines
872 B
Text
|
#include "core.h"
|
||
|
|
||
|
#define MRT @shGlobalSettingBool(mrt_output)
|
||
|
|
||
|
#ifdef SH_VERTEX_SHADER
|
||
|
|
||
|
SH_BEGIN_PROGRAM
|
||
|
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
|
||
|
|
||
|
shInput(float2, uv0)
|
||
|
shOutput(float2, UV)
|
||
|
shOutput(float, fade)
|
||
|
|
||
|
SH_START_PROGRAM
|
||
|
{
|
||
|
shOutputPosition = shMatrixMult(wvp, shInputPosition);
|
||
|
UV = uv0;
|
||
|
|
||
|
fade = (shInputPosition.z > 50) ? 1 : 0;
|
||
|
}
|
||
|
|
||
|
#else
|
||
|
|
||
|
SH_BEGIN_PROGRAM
|
||
|
#if MRT
|
||
|
shDeclareMrtOutput(1)
|
||
|
#endif
|
||
|
|
||
|
shInput(float2, UV)
|
||
|
shInput(float, fade)
|
||
|
|
||
|
shSampler2D(diffuseMap)
|
||
|
shUniform(float, nightFade) @shSharedParameter(nightFade)
|
||
|
|
||
|
|
||
|
SH_START_PROGRAM
|
||
|
{
|
||
|
shOutputColour(0) = shSample(diffuseMap, UV) * float4(1,1,1, nightFade * fade);
|
||
|
|
||
|
|
||
|
#if MRT
|
||
|
shOutputColour(1) = float4(1,1,1,1);
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
#endif
|