use bevy::{prelude::*, render::render_resource::ShaderType};
#[derive(Clone, Component, Debug, ShaderType)]
pub struct ClippingPlaneRange {
pub min_sdist: f32,
pub max_sdist: f32,
}
impl Default for ClippingPlaneRange {
fn default() -> Self {
Self {
min_sdist: 0.0,
max_sdist: f32::INFINITY,
}
}
}
#[derive(Bundle, Default)]
pub struct ClippingPlaneBundle {
pub range: ClippingPlaneRange,
#[bundle]
pub transform: TransformBundle,
}
#[derive(Clone, Component, Debug, Default, ShaderType)]
pub(crate) struct GpuClippingPlaneRange {
pub origin: Vec3,
pub unit_normal: Vec3,
pub min_sdist: f32,
pub max_sdist: f32,
}
#[derive(Debug, Default, ShaderType)]
pub(crate) struct GpuClippingPlaneRanges {
pub ranges: [GpuClippingPlaneRange; MAX_CLIPPING_PLANES],
pub num_ranges: u32,
}
pub const MAX_CLIPPING_PLANES: usize = 16;