From 9f36c26a7f75a58564f60878c42381b451d7d7ba Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 17 Nov 2009 18:32:39 -0500 Subject: Make finish callback a propper BRDF. --- libdimension/dimension/geometry.h | 8 ++++++++ libdimension/dimension/texture.h | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'libdimension/dimension') diff --git a/libdimension/dimension/geometry.h b/libdimension/dimension/geometry.h index 86a0111..08ac1b3 100644 --- a/libdimension/dimension/geometry.h +++ b/libdimension/dimension/geometry.h @@ -76,6 +76,14 @@ dmnsn_line_construct(dmnsn_vector x0, dmnsn_vector n) /* Vector and matrix arithmetic */ +DMNSN_INLINE dmnsn_vector +dmnsn_vector_negate(dmnsn_vector rhs) +{ + /* 3 negations */ + dmnsn_vector v = { -rhs.x, -rhs.y, -rhs.z }; + return v; +} + DMNSN_INLINE dmnsn_vector dmnsn_vector_add(dmnsn_vector lhs, dmnsn_vector rhs) { diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h index 4d0e2d7..e5a1bfd 100644 --- a/libdimension/dimension/texture.h +++ b/libdimension/dimension/texture.h @@ -58,12 +58,15 @@ typedef struct dmnsn_finish dmnsn_finish; /* Finish callback */ typedef dmnsn_color dmnsn_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); /* dmnsn_finish definition */ struct dmnsn_finish { + /* Ambient contribution factor */ + double ambient; + /* Callbacks */ dmnsn_finish_fn *finish_fn; dmnsn_free_fn *free_fn; -- cgit v1.2.3