pub struct MjRendererBuilder<M: Deref<Target = MjModel> + Clone> { /* private fields */ }Expand description
A builder for MjRenderer.
Implementations§
Source§impl<M: Deref<Target = MjModel> + Clone> MjRendererBuilder<M>
impl<M: Deref<Target = MjModel> + Clone> MjRendererBuilder<M>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a builder with default configuration. Defaults are:
widthandheight: use offwidth and offheight of MuJoCo’s visual/global settings from the model,num_visual_internal_geom: 100,num_visual_user_geom: 0,rgb: true,depth: false.
Sourcepub fn width(self, value: u32) -> Self
pub fn width(self, value: u32) -> Self
Set image width.
The width must be less or equal to the offscreen buffer width, which can be configured at the top of the model’s XML like so:
<visual>
<global offwidth="1920" .../>
</visual>Sourcepub fn height(self, value: u32) -> Self
pub fn height(self, value: u32) -> Self
Set image height.
The height must be less or equal to the offscreen buffer height, which can be configured at the top of the model’s XML like so:
<visual>
<global offheight="1080" .../>
</visual>Sourcepub fn num_visual_internal_geom(self, value: u32) -> Self
pub fn num_visual_internal_geom(self, value: u32) -> Self
Set maximum number of additional visual-only internal geoms to allocate for.
Note that the total number of geoms in the internal scene will be
num_visual_internal_geom + num_visual_user_geom.
Sourcepub fn num_visual_user_geom(self, value: u32) -> Self
pub fn num_visual_user_geom(self, value: u32) -> Self
Set maximum number of additional visual-only user geoms (drawn by the user).
Sourcepub fn depth(self, value: bool) -> Self
pub fn depth(self, value: bool) -> Self
Set depth rendering enabled (true) or disabled (false).
Sourcepub fn font_scale(self, value: MjtFontScale) -> Self
pub fn font_scale(self, value: MjtFontScale) -> Self
Set font scale of drawn text (with MjrContext).
Sourcepub fn build(self, model: M) -> Result<MjRenderer<M>, RendererError>
pub fn build(self, model: M) -> Result<MjRenderer<M>, RendererError>
Builds a MjRenderer.
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for MjRendererBuilder<M>
impl<M> RefUnwindSafe for MjRendererBuilder<M>where
M: RefUnwindSafe,
impl<M> Send for MjRendererBuilder<M>where
M: Send,
impl<M> Sync for MjRendererBuilder<M>where
M: Sync,
impl<M> Unpin for MjRendererBuilder<M>where
M: Unpin,
impl<M> UnwindSafe for MjRendererBuilder<M>where
M: UnwindSafe,
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
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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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.