Files
mortal-maze-the-game/world/backgrounds/painted_hall.gdshader
T

24 lines
717 B
Plaintext

shader_type canvas_item;
render_mode unshaded;
uniform vec2 panel_size = vec2(1280.0, 720.0);
uniform vec2 camera_local = vec2(640.0, 360.0);
uniform vec2 parallax_ratio = vec2(0.24, 0.18);
uniform vec2 composition_offset = vec2(0.0, 160.0);
uniform float art_scale = 1.0;
varying vec4 vertex_tint;
void vertex() {
vertex_tint = COLOR;
}
void fragment() {
vec2 art_size = vec2(textureSize(TEXTURE, 0)) * art_scale;
vec2 p = UV * panel_size + camera_local * (parallax_ratio - vec2(1.0)) + composition_offset;
vec2 uv = p / art_size;
float mirrored = mod(floor(uv.x), 2.0);
uv.x = mix(fract(uv.x), 1.0 - fract(uv.x), mirrored);
uv.y = clamp(uv.y, 0.001, 0.999);
COLOR = texture(TEXTURE, uv) * vertex_tint;
}