Skip to content

Commit

Permalink
selected color
Browse files Browse the repository at this point in the history
  • Loading branch information
noxhy committed Oct 11, 2024
1 parent fa4cffb commit 7aa30a5
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 4 deletions.
23 changes: 22 additions & 1 deletion assets/minecraft/shaders/core/rendertype_text.fsh
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
#version 150

#moj_import <fog.glsl>
#moj_import <colours.glsl>
#moj_import <util.glsl>

#define PI 3.14159265


uniform sampler2D Sampler0;

uniform vec4 ColorModulator;
uniform float FogStart;
uniform float GameTime;
uniform float FogEnd;
uniform vec4 FogColor;

in float vertexDistance;
in vec4 vertexColor;
in vec2 texCoord0;
in vec4 Color;

out vec4 fragColor;

float GameTimeSeconds = GameTime * 1200;

void main() {

vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
if (color.a < 0.1) {

if (color.a < 0.1)
{
discard;
}

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

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

fragColor = vec4( 1., 0., 0., 1. );

}

}
17 changes: 14 additions & 3 deletions assets/minecraft/shaders/core/rendertype_text.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ void main()
if( isEither( Color, CROSSHAIR ) )
{

vec2 center = getCenter( Sampler2, id );
center.y /= ScreenSize.y / gui_scale * 1.;

gl_Position.y += ( gui_scale * 33 ) / ScreenSize.y;

if ( isColor( Color, CROSSHAIR ) ) vertexColor.rgb = vec3( 1., 1., 1. );
Expand Down Expand Up @@ -242,4 +239,18 @@ void main()

}

if ( isEither( Color, SELECTED ) )
{

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 ) ) );
}


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

}

}
1 change: 1 addition & 0 deletions assets/minecraft/shaders/include/colours.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define SCOPE vec3( 51., 51., 51. ) // #333333

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

bool isColor(vec4 originColor, vec3 color) {
return (originColor*255.).xyz == color;
Expand Down
Binary file modified assets/minecraft/textures/gui/crosshairs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/minecraft/textures/item/guns/phantom/phantom.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7aa30a5

Please sign in to comment.