diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-01-09 20:38:51 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-01-09 20:38:51 -0500 |
commit | 6787a9219748575cd63aaadd483f49a4fd83b543 (patch) | |
tree | 24291f7948ce2e7712260d6b76e48b68c086987e /libdimension/dimension | |
parent | e541fdb578ee9755c78d4f835edf0fa6bf8aea92 (diff) | |
download | dimension-6787a9219748575cd63aaadd483f49a4fd83b543.tar.xz |
Implement reflection.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r-- | libdimension/dimension/color.h | 1 | ||||
-rw-r--r-- | libdimension/dimension/finishes.h | 4 | ||||
-rw-r--r-- | libdimension/dimension/scene.h | 1 | ||||
-rw-r--r-- | libdimension/dimension/texture.h | 10 |
4 files changed, 13 insertions, 3 deletions
diff --git a/libdimension/dimension/color.h b/libdimension/dimension/color.h index cd44712..67fa032 100644 --- a/libdimension/dimension/color.h +++ b/libdimension/dimension/color.h @@ -83,6 +83,7 @@ dmnsn_sRGB dmnsn_sRGB_from_color(dmnsn_color color); /* Perceptual color manipulation */ dmnsn_color dmnsn_color_add(dmnsn_color color1, dmnsn_color color2); +dmnsn_color dmnsn_color_sub(dmnsn_color color1, dmnsn_color color2); dmnsn_color dmnsn_color_mul(double n, dmnsn_color color); dmnsn_color dmnsn_color_filter(dmnsn_color color, dmnsn_color filter); dmnsn_color dmnsn_color_illuminate(dmnsn_color light, dmnsn_color color); diff --git a/libdimension/dimension/finishes.h b/libdimension/dimension/finishes.h index b836e51..399ff84 100644 --- a/libdimension/dimension/finishes.h +++ b/libdimension/dimension/finishes.h @@ -34,4 +34,8 @@ dmnsn_finish *dmnsn_new_diffuse_finish(double diffuse); /* A phong specular highlight */ dmnsn_finish *dmnsn_new_phong_finish(double specular, double exp); +/* Specular reflection */ +dmnsn_finish *dmnsn_new_reflective_finish(dmnsn_color min, dmnsn_color max, + double falloff); + #endif /* DIMENSION_FINISHES_H */ diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h index d873a6d..2064792 100644 --- a/libdimension/dimension/scene.h +++ b/libdimension/dimension/scene.h @@ -31,6 +31,7 @@ typedef enum { DMNSN_RENDER_LIGHTS = 1 << 1, DMNSN_RENDER_FINISH = 1 << 2, DMNSN_RENDER_TRANSLUCENCY = 1 << 3, + DMNSN_RENDER_REFLECTION = 1 << 4, DMNSN_RENDER_FULL = ~DMNSN_RENDER_NONE } dmnsn_quality; diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h index c5f4b3f..4b14918 100644 --- a/libdimension/dimension/texture.h +++ b/libdimension/dimension/texture.h @@ -63,13 +63,17 @@ typedef dmnsn_color dmnsn_finish_fn(const dmnsn_finish *finish, dmnsn_vector viewer); typedef dmnsn_color dmnsn_ambient_fn(const dmnsn_finish *finish, dmnsn_color pigment); +typedef dmnsn_color dmnsn_reflection_fn(const dmnsn_finish *finish, + dmnsn_color reflect, dmnsn_color color, + dmnsn_vector ray, dmnsn_vector normal); /* dmnsn_finish definition */ struct dmnsn_finish { /* Callbacks */ - dmnsn_finish_fn *finish_fn; - dmnsn_ambient_fn *ambient_fn; - dmnsn_free_fn *free_fn; + dmnsn_finish_fn *finish_fn; + dmnsn_ambient_fn *ambient_fn; + dmnsn_reflection_fn *reflection_fn; + dmnsn_free_fn *free_fn; /* Generic pointer */ void *ptr; |