summaryrefslogtreecommitdiffstats
path: root/tests/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-12-23 02:04:32 -0500
committerTavian Barnes <tavianator@gmail.com>2009-12-23 02:04:32 -0500
commita9ce26a1cd786690b4b8f4b54fc7077b3d3569e5 (patch)
tree1d6e3676224699d828180a15edbca8a3ed39d75a /tests/libdimension
parentff44d1b89812c1c7ef86c848937f17a59c64a66e (diff)
downloaddimension-a9ce26a1cd786690b4b8f4b54fc7077b3d3569e5.tar.xz
Separate finishes into single-purpose finishes.
Diffstat (limited to 'tests/libdimension')
-rw-r--r--tests/libdimension/tests.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/tests/libdimension/tests.c b/tests/libdimension/tests.c
index f632aa1..bc98cd5 100644
--- a/tests/libdimension/tests.c
+++ b/tests/libdimension/tests.c
@@ -29,18 +29,42 @@ dmnsn_new_default_scene()
}
/* Default finish */
-
- scene->default_texture->finish = dmnsn_new_phong_finish(1.0, 0.5, 50.0);
+ dmnsn_finish *ambient = dmnsn_new_ambient_finish(
+ dmnsn_color_mul(0.1, dmnsn_white)
+ );
+ dmnsn_finish *diffuse = dmnsn_new_diffuse_finish(0.6);
+ dmnsn_finish *phong = dmnsn_new_phong_finish(0.2, 40.0);
+ if (!ambient || !diffuse || !phong) {
+ dmnsn_delete_finish(diffuse);
+ dmnsn_delete_finish(ambient);
+ dmnsn_delete_finish(phong);
+ dmnsn_delete_scene(scene);
+ return NULL;
+ }
+ dmnsn_finish *comb1 = dmnsn_new_finish_combination(
+ ambient,
+ diffuse
+ );
+ if (!comb1) {
+ dmnsn_delete_finish(diffuse);
+ dmnsn_delete_finish(ambient);
+ dmnsn_delete_finish(phong);
+ dmnsn_delete_scene(scene);
+ return NULL;
+ }
+ scene->default_texture->finish = dmnsn_new_finish_combination(
+ phong,
+ comb1
+ );
if (!scene->default_texture->finish) {
+ dmnsn_delete_finish(comb1);
+ dmnsn_delete_finish(phong);
dmnsn_delete_scene(scene);
return NULL;
}
- scene->default_texture->finish->ambient = 0.1;
-
/* Background color */
- dmnsn_sRGB sRGB = { .R = 0.0, .G = 0.0, .B = 0.1 };
- scene->background = dmnsn_color_from_sRGB(sRGB);
+ scene->background = dmnsn_color_mul(0.1, dmnsn_blue);
scene->background.filter = 0.1;
/* Allocate a canvas */