parry3d/query/ray/simd_ray.rs
1use crate::math::Vector;
2use crate::query::Ray;
3
4/// A structure representing 4 rays in an SIMD SoA fashion.
5///
6/// Note: When SIMD is not enabled, this is equivalent to a single Ray.
7#[derive(Debug, Copy, Clone)]
8pub struct SimdRay {
9 /// The origin of the rays represented as a single SIMD point.
10 pub origin: Vector,
11 /// The direction of the rays represented as a single SIMD vector.
12 pub dir: Vector,
13}
14
15impl SimdRay {
16 /// Creates a new SIMD ray with all its lanes filled with the same ray.
17 pub fn splat(ray: Ray) -> Self {
18 Self {
19 origin: ray.origin,
20 dir: ray.dir,
21 }
22 }
23}