Update c_cpp_aliases
This commit is contained in:
parent
0323fa2a8f
commit
fbe4513a14
@ -1 +1 @@
|
|||||||
Subproject commit f95f3aa499910286876c1f2cdceea8146ebcf7b1
|
Subproject commit 9f2e22e6cfd3e90b155110f1914f46494a3b0e7c
|
@ -7,22 +7,22 @@
|
|||||||
#define SPECULAR_EPSILON 0.001f
|
#define SPECULAR_EPSILON 0.001f
|
||||||
#define REFLECTIVE_EPSILON 0.1f
|
#define REFLECTIVE_EPSILON 0.1f
|
||||||
|
|
||||||
INTERNAL intersection_t find_closest_intersection(vec3f_t origin,
|
internal intersection_t find_closest_intersection(vec3f_t origin,
|
||||||
vec3f_t direction, f32 t_min,
|
vec3f_t direction, f32 t_min,
|
||||||
f32 t_max,
|
f32 t_max,
|
||||||
const scene_t *scene);
|
const scene_t *scene);
|
||||||
INTERNAL solutions_t ray_intersects_sphere(vec3f_t origin, vec3f_t direction,
|
internal solutions_t ray_intersects_sphere(vec3f_t origin, vec3f_t direction,
|
||||||
sphere_t sphere);
|
sphere_t sphere);
|
||||||
INTERNAL f32 compute_lighting(vec3f_t position, vec3f_t surface_normal,
|
internal f32 compute_lighting(vec3f_t position, vec3f_t surface_normal,
|
||||||
vec3f_t view_vector, f32 specular_exponent,
|
vec3f_t view_vector, f32 specular_exponent,
|
||||||
const scene_t *scene);
|
const scene_t *scene);
|
||||||
INTERNAL f32 light_diffuse(f32 light_intensity, vec3f_t light_direction,
|
internal f32 light_diffuse(f32 light_intensity, vec3f_t light_direction,
|
||||||
vec3f_t surface_normal);
|
vec3f_t surface_normal);
|
||||||
INTERNAL f32 light_specular(f32 light_intensity, vec3f_t light_direction,
|
internal f32 light_specular(f32 light_intensity, vec3f_t light_direction,
|
||||||
vec3f_t surface_normal, vec3f_t view_vector,
|
vec3f_t surface_normal, vec3f_t view_vector,
|
||||||
f32 specular_exponent);
|
f32 specular_exponent);
|
||||||
INTERNAL vec3f_t reflect_ray(vec3f_t light_direction, vec3f_t surface_normal);
|
internal vec3f_t reflect_ray(vec3f_t light_direction, vec3f_t surface_normal);
|
||||||
INTERNAL f32 cos_angle_between_vectors(vec3f_t v1, vec3f_t v2);
|
internal f32 cos_angle_between_vectors(vec3f_t v1, vec3f_t v2);
|
||||||
|
|
||||||
colour_t trace_ray(vec3f_t origin, vec3f_t direction, f32 t_min, f32 t_max,
|
colour_t trace_ray(vec3f_t origin, vec3f_t direction, f32 t_min, f32 t_max,
|
||||||
const scene_t *scene, colour_t default_colour,
|
const scene_t *scene, colour_t default_colour,
|
||||||
@ -67,12 +67,12 @@ colour_t trace_ray(vec3f_t origin, vec3f_t direction, f32 t_min, f32 t_max,
|
|||||||
return colour_add_colour(local_colour, reflected_colour);
|
return colour_add_colour(local_colour, reflected_colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL intersection_t find_closest_intersection(vec3f_t origin,
|
internal intersection_t find_closest_intersection(vec3f_t origin,
|
||||||
vec3f_t direction, f32 t_min,
|
vec3f_t direction, f32 t_min,
|
||||||
f32 t_max,
|
f32 t_max,
|
||||||
const scene_t *scene) {
|
const scene_t *scene) {
|
||||||
f32 closest_t = INFINITY;
|
f32 closest_t = INFINITY;
|
||||||
sphere_t *closest_sphere = NULL;
|
const sphere_t *closest_sphere = NULL;
|
||||||
|
|
||||||
for (u32 i = 0; i < scene->spheres_count; ++i) {
|
for (u32 i = 0; i < scene->spheres_count; ++i) {
|
||||||
solutions_t solutions =
|
solutions_t solutions =
|
||||||
@ -94,7 +94,7 @@ INTERNAL intersection_t find_closest_intersection(vec3f_t origin,
|
|||||||
return (intersection_t){closest_t, closest_sphere};
|
return (intersection_t){closest_t, closest_sphere};
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL solutions_t ray_intersects_sphere(vec3f_t origin, vec3f_t direction,
|
internal solutions_t ray_intersects_sphere(vec3f_t origin, vec3f_t direction,
|
||||||
sphere_t sphere) {
|
sphere_t sphere) {
|
||||||
f32 r = sphere.radius;
|
f32 r = sphere.radius;
|
||||||
vec3f_t CO = vec_sub(vec3f_t, origin, sphere.centre);
|
vec3f_t CO = vec_sub(vec3f_t, origin, sphere.centre);
|
||||||
@ -114,7 +114,7 @@ INTERNAL solutions_t ray_intersects_sphere(vec3f_t origin, vec3f_t direction,
|
|||||||
return (solutions_t){t1, t2};
|
return (solutions_t){t1, t2};
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL f32 compute_lighting(vec3f_t position, vec3f_t surface_normal,
|
internal f32 compute_lighting(vec3f_t position, vec3f_t surface_normal,
|
||||||
vec3f_t view_vector, f32 specular_exponent,
|
vec3f_t view_vector, f32 specular_exponent,
|
||||||
const scene_t *scene) {
|
const scene_t *scene) {
|
||||||
f32 I = 0.0f;
|
f32 I = 0.0f;
|
||||||
@ -160,13 +160,13 @@ INTERNAL f32 compute_lighting(vec3f_t position, vec3f_t surface_normal,
|
|||||||
return I;
|
return I;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL f32 light_diffuse(f32 light_intensity, vec3f_t light_direction,
|
internal f32 light_diffuse(f32 light_intensity, vec3f_t light_direction,
|
||||||
vec3f_t surface_normal) {
|
vec3f_t surface_normal) {
|
||||||
return light_intensity *
|
return light_intensity *
|
||||||
cos_angle_between_vectors(light_direction, surface_normal);
|
cos_angle_between_vectors(light_direction, surface_normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL f32 light_specular(f32 light_intensity, vec3f_t light_direction,
|
internal f32 light_specular(f32 light_intensity, vec3f_t light_direction,
|
||||||
vec3f_t surface_normal, vec3f_t view_vector,
|
vec3f_t surface_normal, vec3f_t view_vector,
|
||||||
f32 specular_exponent) {
|
f32 specular_exponent) {
|
||||||
vec3f_t R = reflect_ray(light_direction, surface_normal);
|
vec3f_t R = reflect_ray(light_direction, surface_normal);
|
||||||
@ -175,7 +175,7 @@ INTERNAL f32 light_specular(f32 light_intensity, vec3f_t light_direction,
|
|||||||
powf(cos_angle_between_vectors(R, view_vector), specular_exponent);
|
powf(cos_angle_between_vectors(R, view_vector), specular_exponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL vec3f_t reflect_ray(vec3f_t light_direction, vec3f_t surface_normal) {
|
internal vec3f_t reflect_ray(vec3f_t light_direction, vec3f_t surface_normal) {
|
||||||
vec3f_t _2N = vec_mul_num(vec3f_t, surface_normal, 2.0f);
|
vec3f_t _2N = vec_mul_num(vec3f_t, surface_normal, 2.0f);
|
||||||
f32 dot_product = vec_dot(vec3f_t, light_direction, surface_normal);
|
f32 dot_product = vec_dot(vec3f_t, light_direction, surface_normal);
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ INTERNAL vec3f_t reflect_ray(vec3f_t light_direction, vec3f_t surface_normal) {
|
|||||||
return vec_sub(vec3f_t, _2N_mul_dot, light_direction);
|
return vec_sub(vec3f_t, _2N_mul_dot, light_direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL f32 cos_angle_between_vectors(vec3f_t v1, vec3f_t v2) {
|
internal f32 cos_angle_between_vectors(vec3f_t v1, vec3f_t v2) {
|
||||||
f32 dot_product = vec_dot(vec3f_t, v1, v2);
|
f32 dot_product = vec_dot(vec3f_t, v1, v2);
|
||||||
|
|
||||||
if (dot_product < 0.0f) {
|
if (dot_product < 0.0f) {
|
||||||
|
Loading…
Reference in New Issue
Block a user