Add reflective material
This commit is contained in:
@@ -10,3 +10,17 @@ bool scatter_lambertian(
|
||||
*atten_out = params.lambertian.albedo;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool scatter_reflective(
|
||||
material_params_t params, hit_t hit, rng_t *rng, ray_t *ray,
|
||||
vec3_t *atten_out)
|
||||
{
|
||||
(void)rng;
|
||||
|
||||
const vec3_t dn
|
||||
= vec3_scale(hit.normal, -2 * vec3_dot(hit.normal, ray->dir));
|
||||
ray->orig = hit.point;
|
||||
ray->dir = vec3_unit(vec3_add(ray->dir, dn));
|
||||
*atten_out = params.reflective.tint;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user