From a9ce26a1cd786690b4b8f4b54fc7077b3d3569e5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 23 Dec 2009 02:04:32 -0500 Subject: Separate finishes into single-purpose finishes. --- dimension/realize.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'dimension') diff --git a/dimension/realize.c b/dimension/realize.c index f795d0f..6ebcdd1 100644 --- a/dimension/realize.c +++ b/dimension/realize.c @@ -547,12 +547,26 @@ dmnsn_realize_astree(const dmnsn_astree *astree) } /* Default finish */ - scene->default_texture->finish = dmnsn_new_phong_finish(1.0, 0.0, 1.0); + dmnsn_finish *ambient = dmnsn_new_ambient_finish( + dmnsn_color_mul(0.1, dmnsn_white) + ); + dmnsn_finish *diffuse = dmnsn_new_diffuse_finish(0.6); + if (!ambient || !diffuse) { + dmnsn_delete_finish(diffuse); + dmnsn_delete_finish(ambient); + dmnsn_delete_scene(scene); + return NULL; + } + scene->default_texture->finish = dmnsn_new_finish_combination( + ambient, + diffuse + ); if (!scene->default_texture->finish) { + dmnsn_delete_finish(diffuse); + dmnsn_delete_finish(ambient); dmnsn_delete_scene(scene); return NULL; } - scene->default_texture->finish->ambient = 0.1; /* Background color */ scene->background = dmnsn_black; -- cgit v1.2.3