Compare commits

..

No commits in common. "367153bbf691c29cb114b54219c8022c2b3e580b" and "6161fdc4608ee45fd92b8fc4ea1a500cc99dabc7" have entirely different histories.

2 changed files with 4 additions and 6 deletions

View file

@ -33,7 +33,6 @@ float remap11(float val) {
return ((val - .5) * 2.); return ((val - .5) * 2.);
} }
// returns a vec3 of the vector transformed by the matrix
vec3 mat3_vec_mul(vec3 m[3], vec3 v) { vec3 mat3_vec_mul(vec3 m[3], vec3 v) {
return v.x * m[0] + v.y * m[1] + v.z * m[2]; return v.x * m[0] + v.y * m[1] + v.z * m[2];
} }
@ -47,8 +46,7 @@ void main() {
const vec3 sphere_pos = vec3(0., 0., 3.); const vec3 sphere_pos = vec3(0., 0., 3.);
const float rad = 1.; const float rad = 1.;
int i = 0; for (int i = 0; i < MAX_ITERATIONS; i++) {
for (; i < MAX_ITERATIONS; i++) {
float distance = sphere_render(ray_pos, rad, sphere_pos); float distance = sphere_render(ray_pos, rad, sphere_pos);
// Check If within tolerances // Check If within tolerances
@ -57,8 +55,8 @@ void main() {
} }
ray_pos += (distance * ray_dir); 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 // Image stuff for later
/* /*

View file

@ -125,8 +125,8 @@ function updateCamera(gl, program) {
// Rotation // Rotation
const rot = gl.getUniformLocation(program, "camera_rot"); const rot = gl.getUniformLocation(program, "camera_rot");
let M1 = calcRotationMatrix([0, -1, 0], mouse_pos[0]); let M1 = calcRotationMatrix([0, 1, 0], mouse_pos[0]);
let M2 = calcRotationMatrix([-1, 0, 0], mouse_pos[1]); let M2 = calcRotationMatrix([1, 0, 0], mouse_pos[1]);
let rot_mat = glMatrix.mat3.create(); let rot_mat = glMatrix.mat3.create();
glMatrix.mat3.mul(rot_mat, M1, M2); glMatrix.mat3.mul(rot_mat, M1, M2);