2024-12-07 12:29:57 +00:00
|
|
|
#version 150
|
|
|
|
#if defined(RENDERTYPE_TEXT)
|
|
|
|
|
|
|
|
#ifdef VERTEX_SHADER
|
|
|
|
|
|
|
|
struct Transform {
|
|
|
|
vec4 color;
|
|
|
|
vec4 textureColor;
|
|
|
|
vec2 textureUV;
|
|
|
|
vec2 screenSize;
|
|
|
|
vec3 position;
|
|
|
|
vec4 screenOffset;
|
|
|
|
vec4 initScreen;
|
2024-12-30 20:15:21 +00:00
|
|
|
float gameTime;
|
2024-12-07 12:29:57 +00:00
|
|
|
float textDepth;
|
2024-12-30 20:15:21 +00:00
|
|
|
bool isShadow;
|
2024-12-07 12:29:57 +00:00
|
|
|
} transform;
|
|
|
|
|
2024-12-30 20:15:21 +00:00
|
|
|
#moj_import <effect.glsl>
|
|
|
|
|
2024-12-07 12:29:57 +00:00
|
|
|
void hideScoreboardNumbers(vec3 position, vec3 numberColor, int vertex) {
|
|
|
|
if(transform.position.z != position.z || gl_VertexID % vertex > 0)
|
|
|
|
return;
|
|
|
|
if(transform.initScreen.x < position.x || transform.initScreen.y < position.y)
|
|
|
|
return;
|
|
|
|
if(transform.color.r != numberColor.r / 255.0 || transform.color.g != numberColor.g / 255.0 || transform.color.b != numberColor.b / 255.0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
transform.position.x += transform.screenSize.x + 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
void offset(float alpha, vec2 gui, vec2 screen, bool align) {
|
|
|
|
if(transform.textureColor.a != alpha) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(align && mod(round(transform.screenSize.x), 2) != 0) {
|
|
|
|
transform.position.x += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
transform.position.x += gui.x;
|
|
|
|
transform.position.y += gui.y;
|
|
|
|
transform.screenOffset.x += screen.x;
|
|
|
|
transform.screenOffset.y += screen.y;
|
|
|
|
}
|
|
|
|
|
2024-12-30 20:15:21 +00:00
|
|
|
void screenAnchor(vec4 atlas, int marker, vec2 offset, int anchor) {
|
|
|
|
if(atlas != vec4(marker, 255, 0, 1)) {
|
2024-12-07 12:29:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-12-30 20:15:21 +00:00
|
|
|
vec2 screen;
|
|
|
|
switch(anchor) {
|
|
|
|
case 0:
|
|
|
|
screen = vec2(-1, 2);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
screen = vec2(1, 2);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
screen = vec2(0, 2);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
screen = vec2(-1, 1);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
screen = vec2(1, 1);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
transform.position.x += offset.x;
|
|
|
|
transform.position.y += offset.y;
|
2024-12-07 12:29:57 +00:00
|
|
|
transform.screenOffset.x += screen.x;
|
|
|
|
transform.screenOffset.y += screen.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void anchorZ(float alpha, float depth, float target) {
|
|
|
|
if(transform.textureColor.a != alpha) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(transform.textDepth != depth) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
transform.position.z = target;
|
|
|
|
}
|
|
|
|
|
2024-12-07 12:35:56 +00:00
|
|
|
void verticalSlide(vec4 color, float time) {
|
|
|
|
if(transform.textureColor != color) {
|
2024-12-07 12:29:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
transform.position.y += (time * 15) - 10;
|
|
|
|
}
|
2024-12-30 20:15:21 +00:00
|
|
|
|
2024-12-07 12:29:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FRAGMENT_SHADER
|
|
|
|
|
|
|
|
struct Transform {
|
|
|
|
vec4 texColor;
|
|
|
|
vec4 color;
|
|
|
|
vec4 colorMod;
|
|
|
|
vec4 vertexColor;
|
|
|
|
float textDepth;
|
2024-12-30 20:15:21 +00:00
|
|
|
bool isShadow;
|
2024-12-07 12:29:57 +00:00
|
|
|
} transform;
|
|
|
|
|
|
|
|
void disableShadow(float depth) {
|
2024-12-07 12:35:56 +00:00
|
|
|
if(transform.color.a <= 1 / 255.0 && transform.texColor.rgb != vec3(255)) {
|
2024-12-07 12:29:57 +00:00
|
|
|
discard;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(transform.texColor.a < 1.0) {
|
|
|
|
if(transform.textDepth == depth || transform.textDepth == 0) {
|
|
|
|
discard;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(transform.texColor.a == 254.0 / 255.0) {
|
|
|
|
transform.color = vec4(transform.texColor.rgb, 1.0) * transform.vertexColor * transform.colorMod;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|