1use crate::{Vec2, impl_approx, impl_bytemuck, impl_casts};
2use serde::{Deserialize, Serialize};
3
4pub type RayHitF = RayHit<f32>;
5
6#[repr(C)]
11#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
12pub struct RayHit<T> {
13 pub normal: Vec2<T>,
14 pub distance: T,
15}
16
17impl<T> RayHit<T> {
18 #[inline]
20 pub const fn new(normal: Vec2<T>, distance: T) -> Self {
21 Self { normal, distance }
22 }
23}
24
25impl_bytemuck!(RayHit);
26
27impl_approx!(
28 NAME = RayHit
29 FIELDS = (normal, distance)
30);
31
32impl_casts!(
33 NAME = RayHit
34 FIELDS = (normal, distance)
35);