pub struct HoomdBevyPlugin<S> {
pub initial_settings: Settings,
pub simulation: S,
}Expand description
Interface hoomd-rs simulations with the Bevy game engine.
HoomdBevyPlugin is used by all the hoomd-rs examples that create
interactive graphical displays of simulations. Specifically, it implements:
- Camera controls (2D and 3D separately).
- Simulation step and frame pacing, with a limited number of steps per second.
- Pause and advance by single step controls.
- Screenshots.
- A GUI that provides usage instructions, settings, and controls.
The caller must:
- Add the
EguiPlugin. - Provide type that implements
Simulation. - Add a
syncUpdatesystem that populates (and removes) entities for rendering. Seerepresentationfor helper code.
The caller may optionally:
- Add UI to the upper left and/or right corners of the screen.
- Implement custom keyboard and/or GUI controls.
To keep individual example scripts short and understandable, hoomd-bevy should
implement as much common code as possible.
§Examples
See any one of the many hoomd-rs examples that use HoomdBevyPlugin.
Fields§
§initial_settings: SettingsConfiguration to use at application start (may be changed later).
simulation: SThe simulation to advance and display interactively.
Implementations§
Source§impl<Sim> HoomdBevyPlugin<Sim>where
Sim: Resource + Simulation,
impl<Sim> HoomdBevyPlugin<Sim>where
Sim: Resource + Simulation,
Sourcepub const SPS: DiagnosticPath
pub const SPS: DiagnosticPath
Bevy diagnostic that counts the number of steps executed per second.
Sourcepub fn build(self, app: &mut App)
pub fn build(self, app: &mut App)
Build the plugin.
HoomdBevyPlugin does not implement [Plugin] and cannot be used with
add_plugins so that the build method can consume self. This allows
build to take ownership of the simulation field and create the appropriate
Bevy [Resource].
§Panics
- When
EguiPluginis not added before callingbuild.
Auto Trait Implementations§
impl<S> Freeze for HoomdBevyPlugin<S>where
S: Freeze,
impl<S> RefUnwindSafe for HoomdBevyPlugin<S>where
S: RefUnwindSafe,
impl<S> Send for HoomdBevyPlugin<S>where
S: Send,
impl<S> Sync for HoomdBevyPlugin<S>where
S: Sync,
impl<S> Unpin for HoomdBevyPlugin<S>where
S: Unpin,
impl<S> UnwindSafe for HoomdBevyPlugin<S>where
S: UnwindSafe,
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§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>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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