Scaffold WebGl

This commit is contained in:
schmelczerandras 2020-07-16 17:35:47 +02:00
parent 7c68deef24
commit fb50ade480
19 changed files with 186 additions and 86 deletions

View file

@ -1,23 +1,19 @@
#ifdef GL_ES
precision mediump float;
#endif
#version 300 es
#define INFINITY 1.0 / 0.0
precision mediump float;
#define INFINITY 10000000.0
#define WORLD_SIZE 4
#define N (20)
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
out vec4 fragmentColor;
struct Light {
vec2 center;
float radius;
vec3 color;
float intensity;
};
uniform vec2 resolution;
// uniform vec2 u_mouse;
uniform float time;
struct Circle {
vec2 center;
@ -52,11 +48,6 @@ float circleDistance(in vec2 position, in Circle circle)
return length(position - circle.center) - circle.radius;
}
float circleDistance(in vec2 position, in Light circle)
{
return length(position - circle.center) - circle.radius;
}
float getDistance(in vec2 target) {
float distance = INFINITY;
for (int i = 0; i < WORLD_SIZE; i++) {
@ -93,5 +84,5 @@ void main() {
vec2 position = gl_FragCoord.xy + vec2(0.5);
vec3 color = vec3(1.0) * linearstep(0.0, 1.0, getDistance(position));
gl_FragColor = vec4(color, 1.0);
fragmentColor = vec4(color, 1.0);
}