Skip to content

Commit

Permalink
added back text effects (i mean this will break stuff soz)
Browse files Browse the repository at this point in the history
  • Loading branch information
LogyBanana committed Jan 13, 2025
1 parent 0b301b7 commit 4c411c9
Show file tree
Hide file tree
Showing 11 changed files with 1,267 additions and 13 deletions.
15 changes: 15 additions & 0 deletions main/assets/minecraft/shaders/core/rendertype_text.fsh
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
#version 150
#define FSH
#define RENDERTYPE_TEXT

#moj_import <fog.glsl>

// These are inputs and outputs to the shader
// If you are merging with a shader, put any inputs and outputs that they have, but are not here already, in the list below
uniform sampler2D Sampler0;

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

in float vertexDistance;
in vec4 baseColor;
in vec4 lightColor;
in vec4 vertexColor;
in vec2 texCoord0;

out vec4 fragColor;

#moj_import <spheya_packs_impl.glsl>

void main() {
if(applySpheyaPacks()) return;

// Code below here is vanilla rendering,
// If you are merging with another shader, replace the code below here with the code that they have in their main() function

vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
if (color.a < 0.1) {
discard;
Expand Down
19 changes: 19 additions & 0 deletions main/assets/minecraft/shaders/core/rendertype_text.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"vertex": "rendertype_text",
"fragment": "rendertype_text",
"samplers": [
{ "name": "Sampler0" },
{ "name": "Sampler2" }
],
"uniforms": [
{ "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
]
}
32 changes: 19 additions & 13 deletions main/assets/minecraft/shaders/core/rendertype_text.vsh
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
#version 150
#define VSH
#define RENDERTYPE_TEXT

#moj_import <fog.glsl>

// These are inputs and outputs to the shader
// If you are merging with a shader, put any inputs and outputs that they have, but are not here already, in the list below
in vec3 Position;
in vec4 Color;
in vec2 UV0;
in ivec2 UV2;

uniform sampler2D Sampler0;
uniform sampler2D Sampler2;

uniform mat4 ModelViewMat;
uniform mat4 ProjMat;
uniform int FogShape;
uniform float GameTime;
uniform vec2 ScreenSize;

out float vertexDistance;
out vec4 baseColor;
out vec4 lightColor;
out vec4 vertexColor;
out vec2 texCoord0;

#moj_import <spheya_packs_impl.glsl>

void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

baseColor = Color;
lightColor = texelFetch(Sampler2, UV2 / 16, 0);
vertexColor = baseColor * lightColor;
vertexDistance = fog_distance(Position, FogShape);
vertexColor = Color * texelFetch(Sampler2, UV2 / 16, 0);
texCoord0 = UV0;

// Delete sidebar numbers
if (gl_Position.z < 0.001 && gl_Position.z > -0.001 && gl_Position.x >= 0.93 && gl_Position.y >= -0.35 && vertexColor.g == 84.0/255.0 && vertexColor.b == 84.0/255.0 && vertexColor.r == 252.0/255.0) {
gl_Position = ProjMat * ModelViewMat * vec4(ScreenSize + 100.0, 0.0, 0.0); // remove scoreboard numbers
} else if (Color == vec4(78/255., 92/255., 36/255., Color.a)) {
vertexColor = texelFetch(Sampler2, UV2 / 16, 0); // remove color from no shadow marker
} else if (Color == vec4(19/255., 23/255., 9/255., Color.a)) {
vertexColor = vec4(0); // remove shadow
}
}

if(applySpheyaPacks()) return;

// When merging with another shader, you should put the code in their main() function below here
}
33 changes: 33 additions & 0 deletions main/assets/minecraft/shaders/core/rendertype_text_see_through.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#version 150
#define FSH
#define RENDERTYPE_TEXT

// These are inputs and outputs to the shader
// If you are merging with a shader, put any inputs and outputs that they have, but are not here already, in the list below
uniform sampler2D Sampler0;

uniform vec4 ColorModulator;
uniform float GameTime;
uniform vec2 ScreenSize;

in vec4 baseColor;
in vec4 lightColor;
in vec4 vertexColor;
in vec2 texCoord0;

out vec4 fragColor;

#moj_import <spheya_packs_impl.glsl>

void main() {
if(applySpheyaPacks()) return;

// Code below here is vanilla rendering,
// If you are merging with another shader, replace the code below here with the code that they have in their main() function

vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
if (color.a < 0.1) {
discard;
}
fragColor = color;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"vertex": "rendertype_text_see_through",
"fragment": "rendertype_text_see_through",
"samplers": [
{ "name": "Sampler0" }
],
"uniforms": [
{ "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
{ "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
]
}
36 changes: 36 additions & 0 deletions main/assets/minecraft/shaders/core/rendertype_text_see_through.vsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#version 150
#define VSH
#define RENDERTYPE_TEXT

// These are inputs and outputs to the shader
// If you are merging with a shader, put any inputs and outputs that they have, but are not here already, in the list below
in vec3 Position;
in vec4 Color;
in vec2 UV0;

uniform sampler2D Sampler0;

uniform mat4 ModelViewMat;
uniform mat4 ProjMat;
uniform float GameTime;
uniform vec2 ScreenSize;

out vec4 baseColor;
out vec4 lightColor;
out vec4 vertexColor;
out vec2 texCoord0;

#moj_import <spheya_packs_impl.glsl>

void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);

baseColor = Color;
lightColor = vec4(1.0);
vertexColor = baseColor * lightColor;
texCoord0 = UV0;

if(applySpheyaPacks()) return;

// When merging with another shader, you should put the code in their main() function below here
}
1 change: 1 addition & 0 deletions main/assets/minecraft/shaders/include/spheya_packs.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#moj_import <text_effects.glsl>
38 changes: 38 additions & 0 deletions main/assets/minecraft/shaders/include/spheya_packs_impl.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#version 150

#moj_import <spheya_utils.glsl>
#moj_import <spheya_packs.glsl>

bool applySpheyaPacks() {
#ifdef SPHEYA_PACK_0
if(applySpheyaPack0()) return true;
#endif
#ifdef SPHEYA_PACK_1
if(applySpheyaPack1()) return true;
#endif
#ifdef SPHEYA_PACK_2
if(applySpheyaPack2()) return true;
#endif
#ifdef SPHEYA_PACK_3
if(applySpheyaPack3()) return true;
#endif
#ifdef SPHEYA_PACK_4
if(applySpheyaPack4()) return true;
#endif
#ifdef SPHEYA_PACK_5
if(applySpheyaPack5()) return true;
#endif
#ifdef SPHEYA_PACK_6
if(applySpheyaPack6()) return true;
#endif
#ifdef SPHEYA_PACK_7
if(applySpheyaPack7()) return true;
#endif
#ifdef SPHEYA_PACK_8
if(applySpheyaPack8()) return true;
#endif
#ifdef SPHEYA_PACK_9
if(applySpheyaPack9()) return true;
#endif
return false;
}
Loading

0 comments on commit 4c411c9

Please sign in to comment.