diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-06-14 01:48:24 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-06-14 01:48:24 +0000 |
commit | 9f8055ac23b829babe5ed469251435b64ac82831 (patch) | |
tree | c0bed93983fe2f2189d812d465bfad0941644820 /tests | |
parent | 355ab840bbfe94604c5a86afccf23efacdbe97d7 (diff) | |
download | dimension-9f8055ac23b829babe5ed469251435b64ac82831.tar.xz |
New cube object.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/raytrace.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/raytrace.c b/tests/raytrace.c index 89a0fcd..1fbf837 100644 --- a/tests/raytrace.c +++ b/tests/raytrace.c @@ -25,24 +25,31 @@ int main() { FILE *file; dmnsn_scene *scene; - dmnsn_object *sphere; + dmnsn_object *object; dmnsn_sRGB sRGB; dmnsn_color color; + dmnsn_matrix trans; dmnsn_set_resilience(DMNSN_SEVERITY_LOW); scene = dmnsn_new_scene(); scene->canvas = dmnsn_new_canvas(768, 480); - scene->camera = dmnsn_new_perspective_camera( - dmnsn_matrix_mul( - dmnsn_translation_matrix(dmnsn_vector_construct(0.0, 0.0, -3.0)), - dmnsn_scale_matrix( - dmnsn_vector_construct( - ((double)scene->canvas->x)/scene->canvas->y, 1.0, 1.0 - ) - ) + + trans = dmnsn_scale_matrix( + dmnsn_vector_construct( + ((double)scene->canvas->x)/scene->canvas->y, 1.0, 1.0 ) ); + trans = dmnsn_matrix_mul( + dmnsn_translation_matrix(dmnsn_vector_construct(0.0, 0.0, -4.0)), + trans + ); + trans = dmnsn_matrix_mul( + dmnsn_rotation_matrix(dmnsn_vector_construct(0.0, 1.0, 0.0)), + trans + ); + + scene->camera = dmnsn_new_perspective_camera(trans); sRGB.R = 0.0; sRGB.G = 0.0; @@ -51,8 +58,8 @@ int main() { color.filter = 0.1; scene->background = color; - sphere = dmnsn_new_sphere(); - dmnsn_array_push(scene->objects, &sphere); + object = dmnsn_new_cube(); + dmnsn_array_push(scene->objects, &object); dmnsn_raytrace_scene(scene); |