pub struct WaterSurface {Show 14 fields
pub asset_id: AssetId,
pub centre: [f32; 3],
pub extent: [f32; 2],
pub subdivisions: u32,
pub waves: Vec<WaterWave>,
pub deep_colour: [f32; 3],
pub shallow_colour: [f32; 3],
pub depth_falloff_metres: f32,
pub foam_width_metres: f32,
pub foam_intensity: f32,
pub fresnel_power: f32,
pub roughness: f32,
pub refraction_strength: f32,
pub visible: bool,
}Expand description
A translucent animated water surface.
A flat, subdivided horizontal surface whose vertices ripple with summed waves. It refracts and reflects the scene, blends from a shallow to a deep colour with depth, and adds shoreline foam.
The surface is positioned by centre and sized by extent (XZ
half-widths). The mesh itself is flat; all height variation comes from the
animated waves.
WaterSurface {
centre: [0.0, 0.4, 0.0],
extent: [12.0, 8.0],
subdivisions: 96,
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
centre: [f32; 3]World-space position of the surface’s centre.
extent: [f32; 2]Half-width and half-depth of the surface [x, z], in world units.
subdivisions: u32Grid subdivisions across the surface. Higher gives smoother waves. Clamped to [8, 255].
waves: Vec<WaterWave>The waves summed to animate the surface (up to 4). Defaults to a single gentle wave.
deep_colour: [f32; 3]Linear-space RGB colour of deep water.
shallow_colour: [f32; 3]Linear-space RGB colour of shallow water near the shore.
depth_falloff_metres: f32Depth over which the colour blends from shallow to deep, in metres.
foam_width_metres: f32Width of the shoreline foam band, in metres.
foam_intensity: f32Strength of the shoreline foam, in [0, 1].
fresnel_power: f32Sharpness of the grazing-angle reflection. Higher confines reflections to steeper viewing angles.
roughness: f32Surface roughness in [0, 1]. Higher gives blurrier reflections, and pushes a mirrored reflection further off its line with each wave: a near-mirror surface keeps its reflection almost still.
refraction_strength: f32How strongly the surface bends the view of what’s beneath it.
visible: boolWhen false the surface is skipped each frame.
Trait Implementations§
Source§impl Clone for WaterSurface
impl Clone for WaterSurface
Source§fn clone(&self) -> WaterSurface
fn clone(&self) -> WaterSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for WaterSurface
impl Component for WaterSurface
Source§const NAME: &'static str = "WaterSurface"
const NAME: &'static str = "WaterSurface"
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§impl ComponentSlot for WaterSurface
impl ComponentSlot for WaterSurface
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.