scenix_raycaster/intersection.rs
1use scenix_core::{MaterialId, MeshId, NodeId};
2use scenix_math::{Vec2, Vec3};
3
4/// A world-space ray intersection against a scene mesh node.
5#[derive(Clone, Copy, Debug, PartialEq)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7pub struct Intersection {
8 /// Scene node hit by the ray.
9 pub node_id: NodeId,
10 /// Mesh resource attached to the hit node.
11 pub mesh_id: MeshId,
12 /// Material resource attached to the hit node.
13 pub material_id: MaterialId,
14 /// Parametric distance along the ray.
15 pub distance: f32,
16 /// World-space hit point.
17 pub point: Vec3,
18 /// World-space surface normal.
19 pub normal: Vec3,
20 /// Interpolated primary UV coordinates, or zero when unavailable.
21 pub uv: Vec2,
22}