diff options
Diffstat (limited to 'tests/libdimension/tests.c')
-rw-r--r-- | tests/libdimension/tests.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/tests/libdimension/tests.c b/tests/libdimension/tests.c index 393a1d6..3e97238 100644 --- a/tests/libdimension/tests.c +++ b/tests/libdimension/tests.c @@ -20,96 +20,6 @@ #include "tests.h" #include <stdlib.h> -dmnsn_scene * -dmnsn_new_default_scene() -{ - /* Allocate a new scene */ - dmnsn_scene *scene = dmnsn_new_scene(); - - /* Default finish */ - scene->default_texture->finish = dmnsn_new_ambient_finish( - dmnsn_color_mul(0.1, dmnsn_white) - ); - scene->default_texture->finish = dmnsn_new_finish_combination( - dmnsn_new_diffuse_finish(0.6), - scene->default_texture->finish - ); - scene->default_texture->finish = dmnsn_new_finish_combination( - dmnsn_new_phong_finish(0.2, 40.0), - scene->default_texture->finish - ); - - /* Background color */ - scene->background = dmnsn_color_mul(0.1, dmnsn_blue); - scene->background.filter = 0.1; - - /* Allocate a canvas */ - scene->canvas = dmnsn_new_canvas(768, 480); - - /* Set up the transformation matrix for the perspective camera */ - dmnsn_matrix trans = dmnsn_scale_matrix( - dmnsn_new_vector( - ((double)scene->canvas->x)/scene->canvas->y, 1.0, 1.0 - ) - ); - trans = dmnsn_matrix_mul( - dmnsn_translation_matrix(dmnsn_new_vector(0.0, 0.0, -4.0)), - trans - ); - trans = dmnsn_matrix_mul( - dmnsn_rotation_matrix(dmnsn_new_vector(0.0, dmnsn_radians(53.0), 0.0)), - trans - ); - - /* Create a perspective camera */ - scene->camera = dmnsn_new_perspective_camera(); - dmnsn_set_perspective_camera_trans(scene->camera, trans); - - /* Now make our objects */ - - dmnsn_object *sphere = dmnsn_new_sphere(); - sphere->texture = dmnsn_new_texture(); - sphere->texture->pigment = dmnsn_new_solid_pigment(dmnsn_yellow); - sphere->trans = dmnsn_scale_matrix(dmnsn_new_vector(1.25, 1.25, 1.25)); - - dmnsn_object *cube = dmnsn_new_cube(); - cube->texture = dmnsn_new_texture(); - - dmnsn_color cube_color = dmnsn_magenta; - cube_color.filter = 0.25; - cube_color.trans = 0.5; - cube->texture->pigment = dmnsn_new_solid_pigment(cube_color); - - dmnsn_color reflect = dmnsn_color_mul(0.5, dmnsn_white); - cube->texture->finish = dmnsn_new_reflective_finish(reflect, reflect, 1.0); - - cube->interior = dmnsn_new_interior(); - cube->interior->ior = 1.1; - - cube->trans = dmnsn_rotation_matrix( - dmnsn_new_vector(dmnsn_radians(45.0), 0.0, 0.0) - ); - - dmnsn_object *csg = dmnsn_new_csg_difference(cube, sphere); - dmnsn_array_push(scene->objects, &csg); - - 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(); - plane->texture->pigment = dmnsn_new_solid_pigment(dmnsn_white); - dmnsn_array_push(scene->objects, &plane); - - /* Now make a light */ - - dmnsn_light *light = dmnsn_new_point_light( - dmnsn_new_vector(-15.0, 20.0, 10.0), - dmnsn_cyan - ); - dmnsn_array_push(scene->lights, &light); - - return scene; -} - /* XIfEvent callback */ static Bool WaitForNotify(Display *d, XEvent *e, char *arg) |