three_d::renderer::object

Struct Water

Source
pub struct Water<M: Material> { /* private fields */ }
Expand description

A water geometry with an applied material.

Implementations§

Source§

impl<M: Material> Water<M>

Source

pub fn new( context: &Context, material: M, height: f32, center: Vec2, side_length: f32, vertex_distance: f32, parameters: impl IntoIterator<Item = WaveParameters> + Clone, ) -> Self

Constructs a new Water object with the given material and at the given height.

The center is the center of the visualized water surface, which can be updated using Self::set_center to simualte an infinite water surface. The side_length is the length of one side of the visualized water surface. The vertex_distance is the distance between vertices.

Source

pub fn set_center(&mut self, center: Vec2)

Set the center of the water. To be able to move the water with the camera, thereby simulating infinite water.

Source

pub fn set_height(&mut self, height: f32)

Set the average height of the water.

Source

pub fn set_parameters( &mut self, parameters: impl IntoIterator<Item = WaveParameters> + Clone, )

Set the currently used WaveParameters.

Source

pub fn animate(&mut self, time: f32)

For updating the animation. The time parameter should be some continious time, for example the time since start.

Trait Implementations§

Source§

impl<'a, M: Material> IntoIterator for &'a Water<M>

Source§

type Item = Gm<&'a dyn Geometry, &'a M>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Gm<&'a dyn Geometry, &'a M>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<M> Freeze for Water<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for Water<M>
where M: RefUnwindSafe,

§

impl<M> Send for Water<M>
where M: Send,

§

impl<M> Sync for Water<M>
where M: Sync,

§

impl<M> Unpin for Water<M>
where M: Unpin,

§

impl<M> UnwindSafe for Water<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,