slowly descending into madness
This commit is contained in:
38
shaders/point_update_shader.gdshader
Normal file
38
shaders/point_update_shader.gdshader
Normal file
@@ -0,0 +1,38 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D point_texture;
|
||||
uniform sampler2D trail_texture;
|
||||
|
||||
uniform ivec2 point_texture_size;
|
||||
uniform ivec2 canvas_size;
|
||||
uniform float point_speed;
|
||||
|
||||
varying vec4 data;
|
||||
|
||||
// Snippets of code drawn from https://gist.github.com/Bleuje/1e497df4505ca24c39ab3930a95700b3
|
||||
float gn(in vec2 coordinate, in float seed){
|
||||
return fract(tan(distance(coordinate*(seed+0.118446744073709551614), vec2(0.118446744073709551614, 0.314159265358979323846264)))*0.141421356237309504880169);
|
||||
}
|
||||
|
||||
float trail_at_pos(vec2 uv) {
|
||||
return texture(trail_texture, uv).r;
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
int id = INSTANCE_ID;
|
||||
int x = id % point_texture_size.x;
|
||||
int y = id / point_texture_size.x;
|
||||
// This feels dumb
|
||||
vec2 uv = vec2(float(x), float(y));
|
||||
vec4 point_data = texture(point_texture, uv);
|
||||
|
||||
vec2 pos = point_data.xy;
|
||||
float angle = point_data.z;
|
||||
|
||||
//COLOR = vec4(0.2, 0.0, 0.0, 1.0)
|
||||
data=vec4(pos, angle, point_data.z);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
COLOR=data;
|
||||
}
|
||||
Reference in New Issue
Block a user