aboutsummaryrefslogtreecommitdiff
path: root/web/pw-visualizer/assets/shaders/frag/masked_image.glsl
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-18 07:40:01 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-18 07:40:01 +0200
commit270476e0387201c85aa686254eb2f4a33205b7d1 (patch)
treeeea7f1bead11ff118407813173f69b9b9289a888 /web/pw-visualizer/assets/shaders/frag/masked_image.glsl
parente5cb04208f2287f5ba4f0f70367c0f8190e0082e (diff)
downloadplanetwars.dev-270476e0387201c85aa686254eb2f4a33205b7d1.tar.xz
planetwars.dev-270476e0387201c85aa686254eb2f4a33205b7d1.zip
use texture for rendering planets
Diffstat (limited to 'web/pw-visualizer/assets/shaders/frag/masked_image.glsl')
-rw-r--r--web/pw-visualizer/assets/shaders/frag/masked_image.glsl21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/pw-visualizer/assets/shaders/frag/masked_image.glsl b/web/pw-visualizer/assets/shaders/frag/masked_image.glsl
new file mode 100644
index 0000000..da0c787
--- /dev/null
+++ b/web/pw-visualizer/assets/shaders/frag/masked_image.glsl
@@ -0,0 +1,21 @@
+#ifdef GL_ES
+precision mediump float;
+#endif
+
+// Passed in from the vertex shader.
+varying vec2 v_texCoord;
+
+uniform float u_step_interval;
+uniform float u_time;
+uniform vec3 u_color;
+uniform vec3 u_color_next;
+
+
+// The texture.
+uniform sampler2D u_texture;
+
+void main() {
+ float alpha = texture2D(u_texture, v_texCoord).a;
+ vec3 color = mix(u_color, u_color_next, u_time);
+ gl_FragColor = vec4(color, alpha);
+}