MjRendererBuilder

Struct MjRendererBuilder 

Source
pub struct MjRendererBuilder { /* private fields */ }
Expand description

A builder for MjRenderer.

Implementations§

Source§

impl MjRendererBuilder

Source

pub fn new() -> Self

Create a builder with default configuration. Defaults are:

  • width and height: 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.
Source

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>
Source

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>
Source

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.

Source

pub fn num_visual_user_geom(self, value: u32) -> Self

Set maximum number of additional visual-only user geoms (drawn by the user).

Source

pub fn rgb(self, value: bool) -> Self

Set RGB rendering enabled (true) or disabled (false).

Source

pub fn depth(self, value: bool) -> Self

Set depth rendering enabled (true) or disabled (false).

Source

pub fn font_scale(self, value: MjtFontScale) -> Self

Set font scale of drawn text (with MjrContext).

Source

pub fn camera(self, value: MjvCamera) -> Self

Set camera used for drawing.

Source

pub fn opts(self, value: MjvOption) -> Self

Set visualization options.

Source

pub fn build(self, model: &MjModel) -> Result<MjRenderer<'_>, RendererError>

Builds a MjRenderer.

Trait Implementations§

Source§

impl Debug for MjRendererBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MjRendererBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.