[−][src]Struct crystal_engine::ModelHandle
A handle to the model that was loaded. This can be used to move the model around in the world.
When this handle is dropped, the model will disappear from the world on the next tick.
When this handle is cloned, a second model will appear in the world. Both models can be controlled independently.
Implementations
impl ModelHandle
[src]
pub fn position(&self) -> Vector3<f32>
[src]
Get the current position of the handle. This is short for self.read(|d| d.position)
pub fn rotation(&self) -> Euler<Rad<f32>>
[src]
Get the current rotation of the handle. This is short for self.read(|d| d.rotation)
pub fn scale(&self) -> f32
[src]
Get the current scale of the handle. This is short for self.read(|d| d.scale)
pub fn read<T>(&self, cb: impl FnOnce(&ModelData) -> T) -> T
[src]
Read the data of the model. Optionally returning a value.
let handle: ModelHandle = game_state.new_triangle_model().build().unwrap(); let scale = handle.read(|d| d.scale);
pub fn modify<T>(&self, cb: impl FnOnce(&mut ModelData) -> T) -> T
[src]
Update the model model. Optionally returning a value.
let handle: ModelHandle = game_state.new_triangle_model().build().unwrap(); handle.modify(|d| d.scale = 0.0 );
Trait Implementations
impl Clone for ModelHandle
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for ModelHandle
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ModelHandle
impl Send for ModelHandle
impl !Sync for ModelHandle
impl Unpin for ModelHandle
impl !UnwindSafe for ModelHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Content for T
[src]
fn ref_from_ptr(ptr: *mut c_void, size: usize) -> Option<*mut T>
[src]
fn is_size_suitable(size: usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SafeBorrow<T> for T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,