mirror of
https://git.stillkill.net/MinecraftLeak/MinecraftLegends.git
synced 2026-10-22 05:22:18 +01:00
83 lines
1.8 KiB
Plaintext
83 lines
1.8 KiB
Plaintext
#include "ShaderConstantsGNM.h"
|
|
|
|
struct PS_Input
|
|
{
|
|
float4 position : S_POSITION;
|
|
|
|
#ifndef BYPASS_PIXEL_SHADER
|
|
float4 color : COLOR;
|
|
float2 uv0 : TEXCOORD_0;
|
|
float2 uv1 : TEXCOORD_1;
|
|
#endif
|
|
|
|
#ifdef NEAR_WATER
|
|
float cameraDist : TEXCOORD_2;
|
|
#endif
|
|
|
|
#ifdef FOG
|
|
float4 fogColor : FOG_COLOR;
|
|
#endif
|
|
};
|
|
|
|
float4 main( in PS_Input PSInput ) : S_TARGET_OUTPUT
|
|
{
|
|
#ifdef BYPASS_PIXEL_SHADER
|
|
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
#else
|
|
|
|
#if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE)
|
|
float4 diffuse = TEXTURE_0.Sample(TextureSampler0, PSInput.uv0);
|
|
#else
|
|
float4 diffuse = TEXTURE_0.Sample(TextureSampler0, PSInput.uv0); //TODO support TEXEL_AA
|
|
#endif
|
|
|
|
#ifdef SEASONS_FAR
|
|
diffuse.a = 1.0f;
|
|
PSInput.color.b = 1.0f;
|
|
#endif
|
|
|
|
#ifdef ALPHA_TEST
|
|
//If we know that all the verts in a triangle will have the same alpha, we should cull there first.
|
|
#ifdef ALPHA_TO_COVERAGE
|
|
float alphaThreshold = .05f;
|
|
#else
|
|
float alphaThreshold = .5f;
|
|
#endif
|
|
if(diffuse.a < alphaThreshold)
|
|
discard;
|
|
#endif
|
|
|
|
#if !defined(ALWAYS_LIT)
|
|
diffuse = diffuse * TEXTURE_1.Sample(TextureSampler1, PSInput.uv1);
|
|
#endif
|
|
|
|
#ifndef SEASONS
|
|
|
|
#if !defined(ALPHA_TEST) && !defined(BLEND)
|
|
diffuse.a = PSInput.color.a;
|
|
#elif defined(BLEND)
|
|
diffuse.a *= PSInput.color.a;
|
|
|
|
#ifdef NEAR_WATER
|
|
float alphaFadeOut = saturate(PSInput.cameraDist.x);
|
|
diffuse.a = lerp(diffuse.a, 1.0f, alphaFadeOut);
|
|
#endif
|
|
#endif
|
|
|
|
diffuse.rgb *= PSInput.color.rgb;
|
|
|
|
#else
|
|
float2 uv = PSInput.color.xy;
|
|
diffuse.rgb *= lerp(1.0f, TEXTURE_2.Sample(TextureSampler2, uv).rgb*2.0f, PSInput.color.b);
|
|
diffuse.rgb *= PSInput.color.aaa;
|
|
diffuse.a = 1.0f;
|
|
#endif
|
|
|
|
#ifdef FOG
|
|
diffuse.rgb = lerp( diffuse.rgb, PSInput.fogColor.rgb, PSInput.fogColor.a );
|
|
#endif
|
|
|
|
return diffuse;
|
|
|
|
#endif
|
|
} |