 uniform vec2 u_resolution;
 uniform mat4 u_view_to_world;
 
-const vec3 LIGHT_DIR = normalize(vec3(1,2,-5));
+vec3 LIGHT_DIR = normalize(vec3(1,2,-5));
 
 // http://mercury.sexy/hg_sdf/
 void pR(inout vec2 p, float a) {

	vec3 p = ro + t * rd;
	vec3 n = sceneNormal(p);

	vec3 diffuse = 0.5 + 0.5*dot(-LIGHT_DIR, n);

	col += diffuse;

	gl_FragColor = vec4(pow(col, vec3(1.0/2.2)), 1.0);
}

}

float sdScene(vec3 p) {
	float t = mod(.5*u_time,1.);
	t = abs(2.*t-1.);
	t = 2.*t-t*t;

	p.z += 2.;
	pR(p.xz, u_time);

	p.xy += .5+.1*t;
	float t0 = max(max(max(abs(p.z)-0.04, -p.y), -p.x), p.x+p.y-1.);
	p.xy -= .2*t;
	p = vec3(-p.x+1., -p.y+1., p.z);
	float t1 = max(max(max(abs(p.z)-0.04, -p.y), -p.x), p.x+p.y-1.);
	return min(t0, t1);
}

