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<WaterSurface, CnResult>
fn from_baked(bytes: &[u8]) -> Result<WaterSurface, 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.Source§fn slot(s: &ComponentStorage) -> &Column<WaterSurface>
fn slot(s: &ComponentStorage) -> &Column<WaterSurface>
Source§fn slot_mut(s: &mut ComponentStorage) -> &mut Column<WaterSurface>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<WaterSurface>
Source§impl Debug for WaterSurface
impl Debug for WaterSurface
Source§impl Default for WaterSurface
impl Default for WaterSurface
Source§fn default() -> WaterSurface
fn default() -> WaterSurface
Source§impl<'de> Deserialize<'de> for WaterSurfacewhere
WaterSurface: Default,
impl<'de> Deserialize<'de> for WaterSurfacewhere
WaterSurface: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<WaterSurface, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<WaterSurface, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<WaterSurface> for ComponentAsset
impl From<WaterSurface> for ComponentAsset
Source§fn from(c: WaterSurface) -> ComponentAsset
fn from(c: WaterSurface) -> ComponentAsset
impl RuntimeComponent for WaterSurface
Source§impl Serialize for WaterSurface
impl Serialize for WaterSurface
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for WaterSurface
impl RefUnwindSafe for WaterSurface
impl Send for WaterSurface
impl Sync for WaterSurface
impl Unpin for WaterSurface
impl UnsafeUnpin for WaterSurface
impl UnwindSafe for WaterSurface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().