aboutsummaryrefslogtreecommitdiff
path: root/game/addons/zylann.hterrain/tools/brush/shaders/raise.gdshader
diff options
context:
space:
mode:
Diffstat (limited to 'game/addons/zylann.hterrain/tools/brush/shaders/raise.gdshader')
-rw-r--r--game/addons/zylann.hterrain/tools/brush/shaders/raise.gdshader22
1 files changed, 22 insertions, 0 deletions
diff --git a/game/addons/zylann.hterrain/tools/brush/shaders/raise.gdshader b/game/addons/zylann.hterrain/tools/brush/shaders/raise.gdshader
new file mode 100644
index 0000000..10ee982
--- /dev/null
+++ b/game/addons/zylann.hterrain/tools/brush/shaders/raise.gdshader
@@ -0,0 +1,22 @@
+shader_type canvas_item;
+render_mode blend_disabled;
+
+#include "res://addons/zylann.hterrain/shaders/include/heightmap.gdshaderinc"
+
+uniform sampler2D u_src_texture;
+uniform vec4 u_src_rect;
+uniform float u_opacity = 1.0;
+uniform float u_factor = 1.0;
+
+vec2 get_src_uv(vec2 screen_uv) {
+ vec2 uv = u_src_rect.xy + screen_uv * u_src_rect.zw;
+ return uv;
+}
+
+void fragment() {
+ float brush_value = u_factor * u_opacity * texture(TEXTURE, UV).r;
+
+ float src_h = sample_heightmap(u_src_texture, get_src_uv(SCREEN_UV));
+ float h = src_h + brush_value;
+ COLOR = encode_height_to_viewport(h);
+}