aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/Model/scrolling.gdshader
diff options
context:
space:
mode:
Diffstat (limited to 'game/src/Game/Model/scrolling.gdshader')
-rw-r--r--game/src/Game/Model/scrolling.gdshader19
1 files changed, 19 insertions, 0 deletions
diff --git a/game/src/Game/Model/scrolling.gdshader b/game/src/Game/Model/scrolling.gdshader
new file mode 100644
index 0000000..c90ee19
--- /dev/null
+++ b/game/src/Game/Model/scrolling.gdshader
@@ -0,0 +1,19 @@
+shader_type spatial;
+
+// depth_prepass_alpha is to ensure opaque scrolling textures
+// (e.g. tank tracks) are rendered correctly
+render_mode cull_disabled, depth_prepass_alpha;
+
+uniform sampler2D scroll_texture_diffuse[32] : source_color, filter_linear_mipmap, repeat_enable;
+uniform float scroll_factor[32];
+
+instance uniform uint scroll_tex_index_diffuse;
+instance uniform float scroll_speed;
+
+void fragment() {
+ vec2 uv_scrolled = UV;
+ uv_scrolled.y += TIME * scroll_speed * scroll_factor[scroll_tex_index_diffuse];
+
+ ALBEDO = texture(scroll_texture_diffuse[scroll_tex_index_diffuse], uv_scrolled).rgb;
+ ALPHA = texture(scroll_texture_diffuse[scroll_tex_index_diffuse], UV).a;
+}