diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-11-17 18:32:39 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-11-17 18:32:39 -0500 |
commit | 9f36c26a7f75a58564f60878c42381b451d7d7ba (patch) | |
tree | ec070dd2d2f7078bf3aebba4dade28d69043b375 /libdimension/finishes.c | |
parent | 54e1ad43c7629d85f88cefbecdfe3e60e8c42294 (diff) | |
download | dimension-9f36c26a7f75a58564f60878c42381b451d7d7ba.tar.xz |
Make finish callback a propper BRDF.
Diffstat (limited to 'libdimension/finishes.c')
-rw-r--r-- | libdimension/finishes.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libdimension/finishes.c b/libdimension/finishes.c index befe6c6..d70cfb7 100644 --- a/libdimension/finishes.c +++ b/libdimension/finishes.c @@ -21,12 +21,15 @@ #include "dimension.h" #include <stdlib.h> /* For malloc */ -static dmnsn_color +dmnsn_color dmnsn_diffuse_finish_fn(const dmnsn_finish *finish, - dmnsn_color color, dmnsn_vector x0, - dmnsn_vector normal, dmnsn_vector reflected) + dmnsn_color light, dmnsn_color color, + dmnsn_vector ray, dmnsn_vector normal, + dmnsn_vector viewer) { - return dmnsn_color_mul(dmnsn_vector_dot(normal, reflected), color); + double diffuse = dmnsn_vector_dot(ray, normal); + dmnsn_color illum = dmnsn_color_illuminate(light, color); + return dmnsn_color_mul(diffuse, illum); } /* A diffuse finish */ |