summaryrefslogtreecommitdiffstats
path: root/tests/libdimension
diff options
context:
space:
mode:
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 */