diff --git a/raymarcher.glsl b/raymarcher.glsl index 1b5953b..c9aa4f6 100644 --- a/raymarcher.glsl +++ b/raymarcher.glsl @@ -33,6 +33,7 @@ float remap11(float val) { return ((val - .5) * 2.); } +// returns a vec3 of the vector transformed by the matrix vec3 mat3_vec_mul(vec3 m[3], vec3 v) { return v.x * m[0] + v.y * m[1] + v.z * m[2]; } @@ -46,7 +47,8 @@ void main() { const vec3 sphere_pos = vec3(0., 0., 3.); const float rad = 1.; - for (int i = 0; i < MAX_ITERATIONS; i++) { + int i = 0; + for (; i < MAX_ITERATIONS; i++) { float distance = sphere_render(ray_pos, rad, sphere_pos); // Check If within tolerances @@ -55,8 +57,8 @@ void main() { } ray_pos += (distance * ray_dir); - color = vec4(mix(color1, color2, float(i) / float(MAX_ITERATIONS)), 1.); } + color = vec4(mix(color1, color2, float(i) / float(MAX_ITERATIONS)), 1.); // Image stuff for later /*