mirror of
https://git.stillkill.net/MinecraftLeak/MinecraftLegends.git
synced 2026-10-22 05:22:18 +01:00
Initial commit
This commit is contained in:
commit
86efc669e9
5013 files changed
+237743
No files matched your search
+154
@@ -0,0 +1,154 @@
|
||||
// __multiversion__
|
||||
// This signals the loading code to prepend either #version 100 or #version 300 es as apropriate.
|
||||
|
||||
// To use centroid sampling we need to have version 300 es shaders, which requires changing:
|
||||
// attribute to in
|
||||
// varying to out when in vertex shaders or in when in fragment shaders
|
||||
// defining an out vec4 FragColor and replacing uses of gl_FragColor with FragColor
|
||||
// texture2D to texture
|
||||
#if __VERSION__ >= 300
|
||||
// version 300 code
|
||||
#define varying in
|
||||
#define texture2D texture
|
||||
out vec4 FragColor;
|
||||
#define gl_FragColor FragColor
|
||||
|
||||
#ifdef MSAA_FRAMEBUFFER_ENABLED
|
||||
#define _centroid centroid
|
||||
#else
|
||||
#define _centroid
|
||||
#endif
|
||||
|
||||
#ifndef NO_TEXTURE
|
||||
_centroid in vec2 uv;
|
||||
#endif
|
||||
#else
|
||||
// version 100 code
|
||||
#ifndef NO_TEXTURE
|
||||
#if defined(TEXEL_AA) && defined(TEXEL_AA_FEATURE)
|
||||
varying highp vec2 uv;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "shaders/util.h"
|
||||
|
||||
uniform sampler2D TEXTURE_0;
|
||||
uniform sampler2D TEXTURE_1;
|
||||
|
||||
#ifdef USE_MULTITEXTURE
|
||||
uniform sampler2D TEXTURE_2;
|
||||
#endif
|
||||
|
||||
varying vec4 light;
|
||||
varying vec4 fogColor;
|
||||
|
||||
#ifdef USE_OVERLAY
|
||||
varying vec4 overlayColor;
|
||||
#endif
|
||||
|
||||
#ifdef TINTED_ALPHA_TEST
|
||||
varying float alphaTestMultiplier;
|
||||
#endif
|
||||
|
||||
#if defined(USE_COLOR_MASK) || defined(ITEM_IN_HAND) || defined(COLOR_SECOND_TEXTURE)
|
||||
varying vec4 changeColor;
|
||||
#endif
|
||||
|
||||
#ifdef GLINT
|
||||
varying vec2 layer1UV;
|
||||
varying vec2 layer2UV;
|
||||
varying vec4 tileLightColor;
|
||||
varying vec4 glintColor;
|
||||
#endif
|
||||
|
||||
vec4 glintBlend(vec4 dest, vec4 source) {
|
||||
// glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE, GL_ONE, GL_ZERO)
|
||||
return vec4(source.rgb * source.rgb, source.a) + vec4(dest.rgb, 0.0);
|
||||
}
|
||||
|
||||
#ifdef USE_EMISSIVE
|
||||
#define NEEDS_DISCARD(C) (C.a == 0.0)
|
||||
#else
|
||||
#ifndef USE_COLOR_MASK
|
||||
#define NEEDS_DISCARD(C) (C.a < 0.5)
|
||||
#else
|
||||
#define NEEDS_DISCARD(C) (C.a == 0.0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = vec4(1.0);
|
||||
|
||||
#ifndef NO_TEXTURE
|
||||
#if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE)
|
||||
color = texture2D( TEXTURE_0, uv );
|
||||
#else
|
||||
color = texture2D_AA(TEXTURE_0, uv);
|
||||
#endif // !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE)
|
||||
|
||||
#ifdef ALPHA_TEST
|
||||
if(NEEDS_DISCARD(color))
|
||||
discard;
|
||||
#endif // ALPHA_TEST
|
||||
|
||||
#ifdef TINTED_ALPHA_TEST
|
||||
vec4 testColor = color;
|
||||
testColor.a *= alphaTestMultiplier;
|
||||
if(NEEDS_DISCARD(testColor))
|
||||
discard;
|
||||
#endif // TINTED_ALPHA_TEST
|
||||
#endif // NO_TEXTURE
|
||||
|
||||
#ifdef USE_COLOR_MASK
|
||||
color.rgb = mix(color.rgb, color.rgb*changeColor.rgb, color.a);
|
||||
color.a *= changeColor.a;
|
||||
#endif
|
||||
|
||||
#ifdef ITEM_IN_HAND
|
||||
color.rgb = mix(color.rgb, color.rgb*changeColor.rgb, light.a);
|
||||
#endif
|
||||
|
||||
#ifdef USE_MULTITEXTURE
|
||||
vec4 tex1 = texture2D( TEXTURE_1, uv );
|
||||
vec4 tex2 = texture2D( TEXTURE_2, uv );
|
||||
color.rgb = mix(color.rgb, tex1.rgb, tex1.a);
|
||||
#ifdef COLOR_SECOND_TEXTURE
|
||||
if (tex2.a > 0.0) {
|
||||
color.rgb = tex2.rgb + (tex2.rgb * changeColor.rgb - tex2.rgb)*tex2.a;//lerp(tex2.rgb, tex2 * changeColor.rgb, tex2.a)
|
||||
}
|
||||
#else
|
||||
color.rgb = mix(color.rgb, tex2.rgb, tex2.a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_OVERLAY
|
||||
//use either the diffuse or the OVERLAY_COLOR
|
||||
color.rgb = mix(color, overlayColor, overlayColor.a).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef USE_EMISSIVE
|
||||
//make glowy stuff
|
||||
color *= mix(vec4(1.0), light, color.a );
|
||||
#else
|
||||
color *= light;
|
||||
#endif
|
||||
|
||||
//apply fog
|
||||
color.rgb = mix( color.rgb, fogColor.rgb, fogColor.a );
|
||||
|
||||
#ifdef GLINT
|
||||
// Applies color mask to glint texture instead and blends with original color
|
||||
vec4 layer1 = texture2D(TEXTURE_1, fract(layer1UV)).rgbr * glintColor;
|
||||
vec4 layer2 = texture2D(TEXTURE_1, fract(layer2UV)).rgbr * glintColor;
|
||||
vec4 glint = (layer1 + layer2) * tileLightColor;
|
||||
|
||||
color = glintBlend(color, glint);
|
||||
#endif
|
||||
|
||||
//WARNING do not refactor this
|
||||
gl_FragColor = color;
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
#include "ShaderConstants.fxh"
|
||||
#include "Util.fxh"
|
||||
|
||||
struct PS_Input {
|
||||
float4 position : SV_Position;
|
||||
|
||||
float4 light : LIGHT;
|
||||
float4 fogColor : FOG_COLOR;
|
||||
|
||||
#ifdef GLINT
|
||||
// there is some alignment issue on the Windows Phone 1320 that causes the position
|
||||
// to get corrupted if this is two floats and last in the struct memory wise
|
||||
float4 layerUV : GLINT_UVS;
|
||||
#endif
|
||||
|
||||
#ifdef USE_OVERLAY
|
||||
float4 overlayColor : OVERLAY_COLOR;
|
||||
#endif
|
||||
|
||||
#ifdef TINTED_ALPHA_TEST
|
||||
float4 alphaTestMultiplier : ALPHA_MULTIPLIER;
|
||||
#endif
|
||||
|
||||
float2 uv : TEXCOORD_0_FB_MSAA;
|
||||
|
||||
};
|
||||
|
||||
struct PS_Output
|
||||
{
|
||||
float4 color : SV_Target;
|
||||
};
|
||||
|
||||
#ifdef USE_EMISSIVE
|
||||
#define NEEDS_DISCARD(C) (C.a == 0.0)
|
||||
#else
|
||||
#ifndef USE_COLOR_MASK
|
||||
#define NEEDS_DISCARD(C) (C.a < 0.5)
|
||||
#else
|
||||
#define NEEDS_DISCARD(C) (C.a == 0.0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float4 glintBlend(float4 dest, float4 source) {
|
||||
// glBlendFuncSeparate(GL_SRC_COLOR, GL_ONE, GL_ONE, GL_ZERO)
|
||||
return float4(source.rgb * source.rgb, source.a) + float4(dest.rgb, 0.0);
|
||||
}
|
||||
|
||||
void main( in PS_Input PSInput, out PS_Output PSOutput )
|
||||
{
|
||||
float4 color = float4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
#if( !defined(NO_TEXTURE) || !defined(COLOR_BASED) || defined(USE_COLOR_BLEND) )
|
||||
|
||||
#if !defined(TEXEL_AA) || !defined(TEXEL_AA_FEATURE) || (VERSION < 0xa000 /*D3D_FEATURE_LEVEL_10_0*/)
|
||||
color = TEXTURE_0.Sample( TextureSampler0, PSInput.uv );
|
||||
#else
|
||||
color = texture2D_AA(TEXTURE_0, TextureSampler0, PSInput.uv);
|
||||
#endif
|
||||
|
||||
#ifdef ALPHA_TEST
|
||||
if( NEEDS_DISCARD( color ) )
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TINTED_ALPHA_TEST
|
||||
float4 testColor = color;
|
||||
testColor.a = testColor.a * PSInput.alphaTestMultiplier.r;
|
||||
if( NEEDS_DISCARD( testColor ) )
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_COLOR_MASK
|
||||
color.rgb = lerp( color, color * CHANGE_COLOR, color.a ).rgb;
|
||||
color.a *= CHANGE_COLOR.a;
|
||||
#endif
|
||||
|
||||
#ifdef ITEM_IN_HAND
|
||||
color.rgb = lerp(color, color * CHANGE_COLOR, PSInput.light.a).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef USE_MULTITEXTURE
|
||||
float4 tex1 = TEXTURE_1.Sample(TextureSampler1, PSInput.uv);
|
||||
float4 tex2 = TEXTURE_2.Sample(TextureSampler2, PSInput.uv);
|
||||
color.rgb = lerp(color.rgb, tex1, tex1.a);
|
||||
#ifdef COLOR_SECOND_TEXTURE
|
||||
if (tex2.a > 0.0f) {
|
||||
color.rgb = lerp(tex2.rgb, tex2 * CHANGE_COLOR, tex2.a);
|
||||
}
|
||||
#else
|
||||
color.rgb = lerp(color.rgb, tex2, tex2.a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_OVERLAY
|
||||
//use either the diffuse or the OVERLAY_COLOR
|
||||
color.rgb = lerp( color, PSInput.overlayColor, PSInput.overlayColor.a ).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef USE_EMISSIVE
|
||||
//make glowy stuff
|
||||
color *= lerp( float( 1.0 ).xxxx, PSInput.light, color.a );
|
||||
#else
|
||||
color *= PSInput.light;
|
||||
#endif
|
||||
|
||||
//apply fog
|
||||
color.rgb = lerp( color.rgb, PSInput.fogColor.rgb, PSInput.fogColor.a );
|
||||
|
||||
#ifdef GLINT
|
||||
// Applies color mask to glint texture instead and blends with original color
|
||||
float4 layer1 = TEXTURE_1.Sample(TextureSampler1, frac(PSInput.layerUV.xy)).rgbr * GLINT_COLOR;
|
||||
float4 layer2 = TEXTURE_1.Sample(TextureSampler1, frac(PSInput.layerUV.zw)).rgbr * GLINT_COLOR;
|
||||
float4 glint = (layer1 + layer2) * TILE_LIGHT_COLOR;
|
||||
color = glintBlend(color, glint);
|
||||
#endif
|
||||
|
||||
//WARNING do not refactor this
|
||||
PSOutput.color = color;
|
||||
|
||||
#ifdef VR_MODE
|
||||
// On Rift, the transition from 0 brightness to the lowest 8 bit value is abrupt, so clamp to
|
||||
// the lowest 8 bit value.
|
||||
PSOutput.color = max(PSOutput.color, 1 / 255.0f);
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user