Skip to content

Commit

Permalink
UHHH
Browse files Browse the repository at this point in the history
  • Loading branch information
noxhy committed Oct 11, 2024
1 parent 7aa30a5 commit 507a494
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
31 changes: 29 additions & 2 deletions assets/minecraft/shaders/core/rendertype_text.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ in float vertexDistance;
in vec4 vertexColor;
in vec2 texCoord0;
in vec4 Color;
in boolean is_shadow;

out vec4 fragColor;

Expand All @@ -35,10 +36,36 @@ void main() {

fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);

if ( isEither( color * 4., SELECTED ) )
if ( is_shadow )
{

fragColor = vec4( 1., 0., 0., 1. );
float outlineThickness = 20.;
vec4 outlineColor = vec4( 1., 0., 0., 1. );

fragColor = outlineColor;
return;

for ( float x = -outlineThickness; x <= outlineThickness; x++)
{

for ( float y = -outlineThickness; y <= outlineThickness; y++ )
{

// Calculate the neighbor coordinates
vec2 offset = vec2(x, y) / textureSize( Sampler0, 0 ); // Normalize by texture size
vec4 neighborColor = texture( Sampler0, texCoord0 + offset ) * vertexColor * ColorModulator;

// If any neighbor pixel is part of the text, apply the outline color
if (neighborColor.a > 0.0)
{
fragColor = outlineColor; // Set to outline color
break; // Exit loop if outline is found
}

}

if (fragColor.a > 0.0) break; // Exit outer loop if outline is already found
}

}

Expand Down
23 changes: 21 additions & 2 deletions assets/minecraft/shaders/core/rendertype_text.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ uniform vec2 ScreenSize;
out float vertexDistance;
out vec4 vertexColor;
out vec2 texCoord0;
out boolean is_shadow;

float GameTimeSeconds = GameTime * 1200;

Expand Down Expand Up @@ -245,11 +246,29 @@ void main()
if ( isColor( Color, SELECTED ) )
{

vertexColor.rgb = hsv2rgb( vec3( 0.7, 0.44, ( 0.9 + ( sin( ( ( GameTimeSeconds + ( gl_Position.x / ScreenSize.x ) * -5 ) / 2.5 ) * 12.5 ) ) * 0.1 ) ) );
vertexColor.rgb = hsv2rgb( vec3( 0.33, 0.44, ( 0.9 + ( sin( ( ( GameTimeSeconds + ( gl_Position.x / ScreenSize.x ) * -5 ) / 2.5 ) * 12.5 ) ) * 0.1 ) ) );
}

}

if ( isEither( Color, GOLDEN ) )
{

if ( isColor( Color, GOLDEN ) )
{

vertexColor.rgb = hsv2rgb( vec3( ( 0.11 + ( sin( ( ( GameTimeSeconds + ( gl_Position.x / ScreenSize.x ) * -160. ) / 2.5 ) * 12.5 ) ) * 0.02 ) , ( 0.9 + ( cos( ( ( GameTimeSeconds + gl_Position.x * 0.2 ) / 5 ) ) ) * 0.1 ), 1. ) );
is_shadow = false;
}


if ( isShadow( Color, GOLDEN ) )
{

getShadow( hsv2rgb( vec3( ( 0.11 + ( sin( ( ( GameTimeSeconds + ( gl_Position.x / ScreenSize.x ) * -25 ) / 2.5 ) * 12.5 ) ) * 0.02 ) , 0.57, 1. ) ) );
is_shadow = true;

gl_Position.y += ( gui_scale * ( ( sin( ( GameTimeSeconds + gl_Position.x * 28. ) * 5. ) * 2. ) ) ) / ScreenSize.y;
}

}

Expand Down
1 change: 1 addition & 0 deletions assets/minecraft/shaders/include/colours.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#define SKYBOX vec3(76., 64., 22.) // #4C4016
#define SELECTED vec3( 76., 64., 23. ) // #4C4017
#define GOLDEN vec3( 76., 64., 24. ) // #4C4018

bool isColor(vec4 originColor, vec3 color) {
return (originColor*255.).xyz == color;
Expand Down

0 comments on commit 507a494

Please sign in to comment.