39 lines
985 B
Plaintext
39 lines
985 B
Plaintext
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;
|
|
|
|
// 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 = VERTEX_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;
|
|
pos += vec2(5000.0, 5000.0);
|
|
float angle = point_data.z;
|
|
|
|
|
|
VERTEX = pos/vec2(canvas_size);
|
|
//COLOR = vec4(pos, angle, point_data.z)
|
|
COLOR=vec4(1, 1, 1, 1);
|
|
}
|
|
|
|
void fragment() {
|
|
}
|