summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-23 13:14:16 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-23 13:14:16 -0500
commitd6cfecdc224e95f1379f918d642074eada40627f (patch)
treea51324383ad8f1cf5d968ba41690d1f7ac7cbad5 /tests
parentb49cf79b57af160ba190fea76d7143cce3428985 (diff)
downloaddimension-d6cfecdc224e95f1379f918d642074eada40627f.tar.xz
Implement pigment maps.
Diffstat (limited to 'tests')
-rw-r--r--tests/dimension/demo.pov9
-rwxr-xr-xtests/dimension/demo.sh22
-rw-r--r--tests/libdimension/render.c13
3 files changed, 36 insertions, 8 deletions
diff --git a/tests/dimension/demo.pov b/tests/dimension/demo.pov
index 8088f45..c65c842 100644
--- a/tests/dimension/demo.pov
+++ b/tests/dimension/demo.pov
@@ -132,7 +132,14 @@ union {
plane {
y, -2
pigment {
- checker color rgb 0, color rgb 1
+ checker
+ pigment {
+ color rgb 1
+ }
+ pigment {
+ checker color rgb 0, color rgb 1
+ scale 1/3
+ }
quick_color rgb <1, 0.5, 0.75>
}
}
diff --git a/tests/dimension/demo.sh b/tests/dimension/demo.sh
index a741268..80d5ade 100755
--- a/tests/dimension/demo.sh
+++ b/tests/dimension/demo.sh
@@ -189,11 +189,23 @@ demo_exp=$(echo -n \
(quick_color
(vector (integer 1) (float 0.5) (float 0.75)
(integer 0) (integer 0)))
- (color-list
- (vector (integer 0) (integer 0) (integer 0)
- (integer 0) (integer 0))
- (vector (integer 1) (integer 1) (integer 1)
- (integer 0) (integer 0))))))))' \
+ (pigment-list
+ (pigment
+ (vector (integer 1) (integer 1) (integer 1)
+ (integer 0) (integer 0))
+ pigment-modifiers)
+ (pigment
+ (pattern checker)
+ (pigment-modifiers
+ (transformation
+ (scale (vector (float 0.333333) (float 0.333333)
+ (float 0.333333) (float 0.333333)
+ (float 0.333333))))
+ (color-list
+ (vector (integer 0) (integer 0) (integer 0)
+ (integer 0) (integer 0))
+ (vector (integer 1) (integer 1) (integer 1)
+ (integer 0) (integer 0)))))))))))' \
| tr '\n' ' ' | sed -r 's/[[:space:]]+/ /g')
if [ "$demo" != "$demo_exp" ]; then
diff --git a/tests/libdimension/render.c b/tests/libdimension/render.c
index 5ba075d..776fc1c 100644
--- a/tests/libdimension/render.c
+++ b/tests/libdimension/render.c
@@ -179,12 +179,21 @@ dmnsn_new_test_scene(void)
dmnsn_object *plane = dmnsn_new_plane(dmnsn_new_vector(0.0, 1.0, 0.0));
plane->trans = dmnsn_translation_matrix(dmnsn_new_vector(0.0, -2.0, 0.0));
plane->texture = dmnsn_new_texture();
- dmnsn_pattern *checker = dmnsn_new_checker_pattern();
+ dmnsn_pattern *checker1 = dmnsn_new_checker_pattern();
+ dmnsn_pattern *checker2 = dmnsn_new_checker_pattern();
dmnsn_map *checker_color_map = dmnsn_new_color_map();
dmnsn_add_map_entry(checker_color_map, 0.0, &dmnsn_black);
dmnsn_add_map_entry(checker_color_map, 1.0, &dmnsn_white);
+ dmnsn_pigment *pigment1 = dmnsn_new_solid_pigment(dmnsn_white);
+ dmnsn_pigment *pigment2
+ = dmnsn_new_color_map_pigment(checker1, checker_color_map);
+ pigment2->trans
+ = dmnsn_scale_matrix(dmnsn_new_vector(1.0/3.0, 1.0/3.0, 1.0/3.0));
+ dmnsn_map *checker_pigment_map = dmnsn_new_pigment_map();
+ dmnsn_add_map_entry(checker_pigment_map, 0.0, &pigment1);
+ dmnsn_add_map_entry(checker_pigment_map, 1.0, &pigment2);
plane->texture->pigment
- = dmnsn_new_color_map_pigment(checker, checker_color_map);
+ = dmnsn_new_pigment_map_pigment(checker2, checker_pigment_map);
plane->texture->pigment->quick_color
= dmnsn_color_from_sRGB((dmnsn_sRGB){ 1.0, 0.5, 0.75 });
dmnsn_array_push(scene->objects, &plane);