pub struct ShapeCommands<'w, 's> { /* private fields */ }Expand description
A system param that allows ergonomic spawning of shape entities.
The ShapeConfig used is initially extracted from the BaseShapeConfig resource.
Subsequent calls to reset() will reset the config back to whatever is currently stored within the BaseShapeConfig resource.
Shapes will be spawned with commands during the next instance of [apply_deferred]
Implementations§
Source§impl<'w, 's> ShapeCommands<'w, 's>
impl<'w, 's> ShapeCommands<'w, 's>
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Set the painter’s ShapeConfig to the current value of the BaseShapeConfig resource.
Methods from Deref<Target = ShapeConfig>§
Sourcepub fn translate(&mut self, dir: Vec3)
pub fn translate(&mut self, dir: Vec3)
Helper method to modify the configs transform taking into account rotation and scale.
Sourcepub fn set_translation(&mut self, translation: Vec3)
pub fn set_translation(&mut self, translation: Vec3)
Helper method to set the configs transform.
Sourcepub fn rotate(&mut self, quat: Quat)
pub fn rotate(&mut self, quat: Quat)
Helper method to rotate the configs transform by a given Quat.
Sourcepub fn set_rotation(&mut self, rotation: Quat)
pub fn set_rotation(&mut self, rotation: Quat)
Helper method to set the configs rotation.
Sourcepub fn rotate_x(&mut self, angle: f32)
pub fn rotate_x(&mut self, angle: f32)
Helper method to rotate the configs transform around the x axis.
Sourcepub fn rotate_y(&mut self, angle: f32)
pub fn rotate_y(&mut self, angle: f32)
Helper method to rotate the configs transform around the y axis.
Sourcepub fn rotate_z(&mut self, angle: f32)
pub fn rotate_z(&mut self, angle: f32)
Helper method to rotate the configs transform around the z axis.
Sourcepub fn set_canvas(&mut self, canvas: Entity)
pub fn set_canvas(&mut self, canvas: Entity)
Helper method to change shape render target to a canvas.
Also sets pipeline to Shape2d.
Sourcepub fn without_transform(&self) -> Self
pub fn without_transform(&self) -> Self
Helper method to clone the config without it’s transform, useful when parenting.
pub fn set_color(&mut self, color: impl Into<Color>)
Trait Implementations§
Source§impl<'w, 's> Deref for ShapeCommands<'w, 's>
impl<'w, 's> Deref for ShapeCommands<'w, 's>
Source§impl<'w, 's> DerefMut for ShapeCommands<'w, 's>
impl<'w, 's> DerefMut for ShapeCommands<'w, 's>
Source§impl<'w, 's> ShapeSpawner<'w> for ShapeCommands<'w, 's>
impl<'w, 's> ShapeSpawner<'w> for ShapeCommands<'w, 's>
Source§fn spawn_shape(&mut self, bundle: impl Bundle) -> ShapeEntityCommands<'_, '_>
fn spawn_shape(&mut self, bundle: impl Bundle) -> ShapeEntityCommands<'_, '_>
ShapeBundle does not include RenderLayers as there is no support for optional components
so instead it is inserted in this function conditionally depending on the ShapeConfig in self
Prefer the function for the shape you want over ShapeSpawner::spawn_shape, e.g. commands.rect(...)fn config(&self) -> &ShapeConfig
fn set_config(&mut self, config: ShapeConfig)
Source§impl SystemParam for ShapeCommands<'_, '_>
impl SystemParam for ShapeCommands<'_, '_>
Source§type Item<'w, 's> = ShapeCommands<'w, 's>
type Item<'w, 's> = ShapeCommands<'w, 's>
Self, instantiated with new lifetimes. Read moreSource§fn init_access(
state: &Self::State,
system_meta: &mut SystemMeta,
component_access_set: &mut FilteredAccessSet,
world: &mut World,
)
fn init_access( state: &Self::State, system_meta: &mut SystemMeta, component_access_set: &mut FilteredAccessSet, world: &mut World, )
World access used by this SystemParamSource§fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
SystemParam’s state.
This is used to apply Commands during ApplyDeferred.Source§fn queue(
state: &mut Self::State,
system_meta: &SystemMeta,
world: DeferredWorld<'_>,
)
fn queue( state: &mut Self::State, system_meta: &SystemMeta, world: DeferredWorld<'_>, )
ApplyDeferred.Source§unsafe fn validate_param<'w, 's>(
state: &'s mut Self::State,
_system_meta: &SystemMeta,
_world: UnsafeWorldCell<'w>,
) -> Result<(), SystemParamValidationError>
unsafe fn validate_param<'w, 's>( state: &'s mut Self::State, _system_meta: &SystemMeta, _world: UnsafeWorldCell<'w>, ) -> Result<(), SystemParamValidationError>
Source§unsafe fn get_param<'w, 's>(
state: &'s mut Self::State,
system_meta: &SystemMeta,
world: UnsafeWorldCell<'w>,
change_tick: Tick,
) -> Self::Item<'w, 's>
unsafe fn get_param<'w, 's>( state: &'s mut Self::State, system_meta: &SystemMeta, world: UnsafeWorldCell<'w>, change_tick: Tick, ) -> Self::Item<'w, 's>
SystemParamFunction. Read moreimpl<'w, 's> ReadOnlySystemParam for ShapeCommands<'w, 's>where
&'s mut ShapeConfig: ReadOnlySystemParam,
Commands<'w, 's>: ReadOnlySystemParam,
Res<'w, BaseShapeConfig>: ReadOnlySystemParam,
Auto Trait Implementations§
impl<'w, 's> Freeze for ShapeCommands<'w, 's>
impl<'w, 's> !RefUnwindSafe for ShapeCommands<'w, 's>
impl<'w, 's> Send for ShapeCommands<'w, 's>
impl<'w, 's> Sync for ShapeCommands<'w, 's>
impl<'w, 's> Unpin for ShapeCommands<'w, 's>
impl<'w, 's> !UnwindSafe for ShapeCommands<'w, 's>
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
Source§impl<'w, T> DiscSpawner<'w> for Twhere
T: ShapeSpawner<'w>,
impl<'w, T> DiscSpawner<'w> for Twhere
T: ShapeSpawner<'w>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 more