diff options
author | Julian T <julian@jtle.dk> | 2020-03-25 18:53:37 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-03-25 19:27:11 +0100 |
commit | 7a48ecd394f7b3b8f0f6e18606f681ffac3e3a7c (patch) | |
tree | 9645bf9381263cb9acf8b9724d47c834d7e9a473 /scene.c | |
parent | d87ae2cd9871806d18ac4f86b5e12e2c52aadc52 (diff) |
Create new fitting scene to test area lights
Diffstat (limited to 'scene.c')
-rw-r--r-- | scene.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -116,7 +116,7 @@ material_t *add_material(container_t *cont) return m; } -void obj_norm_at(object_t *o, vector_t *dest, vector_t *point) +void obj_norm_at(object_t *o, vector_t *dest, vector_t *point, vector_t *direction) { switch(o->type) { case TYPE_SPHERE: @@ -124,7 +124,8 @@ void obj_norm_at(object_t *o, vector_t *dest, vector_t *point) vector_scale_inv(dest, dest, vector_len(dest)); break; case TYPE_PLANE: - vector_copy(dest, &o->pl.norm); + // Calculate if the point is in front + vector_scale(dest, &o->pl.norm, (vector_dot(direction, &o->pl.norm) > 0) ? -1 : 1); break; } |