use bevy::ecs::resource::Resource;
use bevy::math::{UVec4, Vec2, Vec4};
use bevy::render::render_resource::ShaderType;
use crate::cascade::{GpuLayout, LOD_COUNT};
pub const WAVE_SLOTS: usize = 40;
#[derive(ShaderType, Clone, Copy, Debug, Default)]
pub struct GpuWave {
pub direction: Vec2,
pub amplitude: f32,
pub wave_number: f32,
pub angular_frequency: f32,
pub phase: f32,
pub chop_amplitude: f32,
}
#[derive(Resource, Default)]
pub struct AnimWavesUniformSlot(
pub Option<bevy::render::render_resource::UniformBuffer<AnimWavesUniform>>,
);
impl std::fmt::Debug for AnimWavesUniformSlot {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("AnimWavesUniformSlot")
.field("uploaded", &self.0.is_some())
.finish()
}
}
#[derive(ShaderType, Clone, Debug)]
pub struct AnimWavesUniform {
pub layout: GpuLayout,
pub waves: [GpuWave; WAVE_SLOTS],
pub ranges: [UVec4; LOD_COUNT],
pub time: Vec4,
pub flow: Vec4,
}