use crate::common::{generate, generate_trimesh_around_origin, unref}; use na::Isometry3; use ncollide3d::bounding_volume::{BoundingSphere, AABB}; use ncollide3d::query::{Ray, RayCast}; use ncollide3d::shape::{ Ball, Capsule, Cone, ConvexHull, Cuboid, Cylinder, Segment, TriMesh, Triangle, }; use rand::SeedableRng; use rand_isaac::IsaacRng; use test::Bencher; #[path = "../common/macros.rs"] #[macro_use] mod macros; // FIXME: will the randomness of `solid` and `max_toi` affect too much the benchmark? bench_method!( bench_ray_against_ball, toi_with_ray, b: Ball, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_cuboid, toi_with_ray, c: Cuboid, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_capsule, toi_with_ray, c: Capsule, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_cone, toi_with_ray, c: Cone, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_cylinder, toi_with_ray, c: Cylinder, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_aabb, toi_with_ray, a: AABB, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_bounding_sphere, toi_with_ray, b: BoundingSphere, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_ball_with_normal_uv, toi_and_normal_and_uv_with_ray, b: Ball, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_cuboid_with_normal_uv, toi_and_normal_and_uv_with_ray, c: Cuboid, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_capsule_with_normal_uv, toi_and_normal_and_uv_with_ray, c: Capsule, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_cone_with_normal_uv, toi_and_normal_and_uv_with_ray, c: Cone, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_cylinder_with_normal_uv, toi_and_normal_and_uv_with_ray, c: Cylinder, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_segment_with_normal_uv, toi_and_normal_and_uv_with_ray, c: Segment, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_triangle_with_normal_uv, toi_and_normal_and_uv_with_ray, c: Triangle, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method!( bench_ray_against_convex_with_normal_uv, toi_and_normal_and_uv_with_ray, c: ConvexHull, pos: Isometry3, ray: Ray, max_toi: f32, solid: bool ); bench_method_gen!( bench_ray_against_trimesh_with_normal_uv, toi_and_normal_and_uv_with_ray, m: TriMesh = generate_trimesh_around_origin, pos: Isometry3 = generate, ray: Ray = generate, max_toi: f32 = generate, solid: bool = generate );