# if GLIB_CHECK_VERSION (2, 38, 0) g_test_skip ("Disabled when using GCC vectors"); # else if (g_test_verbose ()) g_test_message ("Disabled when using GCC vectors"); # endif #else graphene_matrix_t m; graphene_frustum_t f; graphene_point3d_t p; graphene_matrix_init_frustum (&m, -1.f, 1.f, -1.f, 1.f, 1.f, 100.f); graphene_frustum_init_from_matrix (&f, &m); g_assert_false (graphene_frustum_contains_point (&f, graphene_point3d_init (&p, 0.f, 0.f, 0.f))); g_assert_true (graphene_frustum_contains_point (&f, graphene_point3d_init (&p, 0.f, 0.f, -50.f))); g_assert_true (graphene_frustum_contains_point (&f, graphene_point3d_init (&p, 0.f, 0.f, -1.001f))); g_assert_true (graphene_frustum_contains_point (&f, graphene_point3d_init (&p, -1.f, -1.f, -1.001f))); g_assert_false (graphene_frustum_contains_point (&f, graphene_point3d_init (&p, -1.1f, -1.1f, -1.001f))); g_assert_true (graphene_frustum_contains_point (&f, graphene_point3d_init (&p, 1.f, 1.f, -1.001f))); g_assert_false (graphene_frustum_contains_point (&f, graphene_point3d_init (&p, 1.1f, 1.1f, -1.001f))); #endif } GRAPHENE_TEST_UNIT_END GRAPHENE_TEST_SUITE ( GRAPHENE_TEST_UNIT ("/frustum/init", frustum_init) GRAPHENE_TEST_UNIT ("/frustum/ortho/contains-point", frustum_ortho_contains_point) GRAPHENE_TEST_UNIT ("/frustum/matrix/contains-point", frustum_matrix_contains_point) )
GRAPHENE_TEST_UNIT_END GRAPHENE_TEST_UNIT_BEGIN (euler_quaternion_roundtrip) { graphene_euler_t values[3]; unsigned int i; graphene_euler_init_with_order (&values[0], 0.f, 0.f, 0.f, GRAPHENE_EULER_ORDER_XYZ); graphene_euler_init_with_order (&values[1], 1.f, 0.f, 0.f, GRAPHENE_EULER_ORDER_XYZ); graphene_euler_init_with_order (&values[2], 0.f, 1.f, 0.f, GRAPHENE_EULER_ORDER_ZYX); for (i = 0; i < G_N_ELEMENTS (values); i++) { graphene_quaternion_t q, check; graphene_euler_t e; graphene_quaternion_init_from_euler (&q, &values[i]); graphene_euler_init_from_quaternion (&e, &q, graphene_euler_get_order (&values[i])); graphene_quaternion_init_from_euler (&check, &e); g_assert_true (graphene_quaternion_equal (&q, &check)); } } GRAPHENE_TEST_UNIT_END GRAPHENE_TEST_SUITE ( GRAPHENE_TEST_UNIT ("/euler/init", euler_init) GRAPHENE_TEST_UNIT ("/euler/quaternion-roundtrip", euler_quaternion_roundtrip) )
GRAPHENE_TEST_UNIT_END GRAPHENE_TEST_UNIT_BEGIN (ray_matrix_transform) { graphene_ray_t r, res; graphene_matrix_t m; if (g_test_verbose ()) g_test_message ("Identity matrix..."); graphene_ray_init (&r, &one3, graphene_vec3_z_axis ()); graphene_matrix_init_identity (&m); graphene_matrix_transform_ray (&m, &r, &res); g_assert_true (graphene_ray_equal (&r, &res)); if (g_test_verbose ()) g_test_message ("Rotation matrix: rotateZ(90deg)"); graphene_ray_init (&r, &zero3, graphene_vec3_z_axis ()); graphene_matrix_init_rotate (&m, 90, graphene_vec3_z_axis ()); graphene_matrix_transform_ray (&m, &r, &res); g_assert_true (graphene_ray_equal (&r, &res)); } GRAPHENE_TEST_UNIT_END GRAPHENE_TEST_SUITE ( GRAPHENE_TEST_UNIT ("/ray/init", ray_init) GRAPHENE_TEST_UNIT ("/ray/get-position-at", ray_get_position_at) GRAPHENE_TEST_UNIT ("/ray/get-distance-to-point", ray_get_distance_to_point) GRAPHENE_TEST_UNIT ("/ray/closest-point-to-point", ray_closest_point_to_point) GRAPHENE_TEST_UNIT ("/ray/matrix-transform", ray_matrix_transform) )