forked from team-sg/hero-mark-2
ska dimension
This commit is contained in:
parent
7ed967908b
commit
2d00fe8c43
2 changed files with 40 additions and 6 deletions
27
shaders/ska_plane.gdshader
Normal file
27
shaders/ska_plane.gdshader
Normal file
|
@ -0,0 +1,27 @@
|
|||
shader_type canvas_item;
|
||||
render_mode skip_vertex_transform;
|
||||
|
||||
uniform vec4 color_1 : hint_color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
uniform vec4 color_2 : hint_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
uniform vec2 checker_size = vec2(8.0, 8.0);
|
||||
uniform vec2 cycle_speed = vec2(0.0, 0.0);
|
||||
uniform vec2 pan_speed = vec2(0.0, 0.0);
|
||||
uniform mat4 uv_transform = mat4(1.0);
|
||||
|
||||
float checker(vec2 uv) {
|
||||
vec2 div_uv = floor((uv) / checker_size);
|
||||
float fmodResult = mod(div_uv.x + div_uv.y, 2.0);
|
||||
return max(sign(fmodResult), 0.0);
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
UV = VERTEX;
|
||||
VERTEX = (WORLD_MATRIX * (EXTRA_MATRIX * vec4(VERTEX, 0.0, 1.0))).xy;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = UV - pan_speed * TIME;
|
||||
uv = (uv_transform * vec4(uv, 0.0, 1.0)).xy;
|
||||
uv -= cycle_speed * TIME;
|
||||
COLOR = mix(color_1, color_2, checker(uv));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue