Improve readability
This commit is contained in:
parent
4914f8eb71
commit
6d8f332500
@ -237,13 +237,14 @@ intersection_t find_closest_intersection(vec3f_t origin, vec3f_t direction,
|
||||
f32 calculate_lighting_for_intersection(vec3f_t origin, vec3f_t direction,
|
||||
intersection_t intersection,
|
||||
const scene_t *scene) {
|
||||
vec3f_t position = vec_add(
|
||||
vec3f_t, origin, vec_mul_num(vec3f_t, direction, intersection.closest_t));
|
||||
vec3f_t _direction = vec_mul_num(vec3f_t, direction, intersection.closest_t);
|
||||
vec3f_t position = vec_add(vec3f_t, origin, _direction);
|
||||
|
||||
vec3f_t surface_normal =
|
||||
vec_sub(vec3f_t, position, intersection.closest_sphere->centre);
|
||||
surface_normal = vec_div_num(vec3f_t, surface_normal,
|
||||
vec_magnitude(vec3f_t, surface_normal));
|
||||
|
||||
f32 normal_magnitude = vec_magnitude(vec3f_t, surface_normal);
|
||||
surface_normal = vec_div_num(vec3f_t, surface_normal, normal_magnitude);
|
||||
|
||||
vec3f_t view_vector = vec_mul_num(vec3f_t, direction, -1.0f);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user