diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-06-12 02:37:51 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-06-13 00:16:06 -0600 |
commit | 7acd8ea6673b7a90ed4041408ccf1b024b8a007a (patch) | |
tree | d52199dd7c58e0217bfd1a74e7601d739ad333f5 /libdimension/phong.c | |
parent | 066261810c2fca192677c5c1c01c91d6ecec65a0 (diff) | |
download | dimension-7acd8ea6673b7a90ed4041408ccf1b024b8a007a.tar.xz |
Vast libdimension API and internals improvements.
Couldn't really do these while I was trying to be POV-Ray compatible,
'cause they would've broken compatibility.
Diffstat (limited to 'libdimension/phong.c')
-rw-r--r-- | libdimension/phong.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libdimension/phong.c b/libdimension/phong.c index 3fc154f..90bf505 100644 --- a/libdimension/phong.c +++ b/libdimension/phong.c @@ -28,15 +28,15 @@ /** Phong specular highlight callback. */ static dmnsn_color -dmnsn_phong_specular_fn(const dmnsn_finish *finish, +dmnsn_phong_specular_fn(const dmnsn_specular *specular, dmnsn_color light, dmnsn_color color, dmnsn_vector ray, dmnsn_vector normal, dmnsn_vector viewer) { - double *params = finish->ptr; + double *params = specular->ptr; - double specular = params[0]; - double exp = params[1]; + double coeff = params[0]; + double exp = params[1]; dmnsn_vector proj = dmnsn_vector_mul(2*dmnsn_vector_dot(ray, normal), normal); dmnsn_vector reflected = dmnsn_vector_sub(proj, ray); @@ -47,22 +47,22 @@ dmnsn_phong_specular_fn(const dmnsn_finish *finish, } specular_factor = pow(specular_factor, exp); - return dmnsn_color_mul(specular*specular_factor, light); + return dmnsn_color_mul(coeff*specular_factor, light); } /* A phong finish */ -dmnsn_finish * -dmnsn_new_phong_finish(double specular, double exp) +dmnsn_specular * +dmnsn_new_phong(double specular, double exp) { - dmnsn_finish *finish = dmnsn_new_finish(); + dmnsn_specular *phong = dmnsn_new_specular(); double *params = dmnsn_malloc(2*sizeof(double)); params[0] = specular; params[1] = exp; - finish->ptr = params; - finish->specular_fn = dmnsn_phong_specular_fn; - finish->free_fn = dmnsn_free; + phong->specular_fn = dmnsn_phong_specular_fn; + phong->free_fn = dmnsn_free; + phong->ptr = params; - return finish; + return phong; } |