Skip to main content

CompoundBuilder

Struct CompoundBuilder 

Source
pub struct CompoundBuilder<'a> { /* private fields */ }
Expand description

Builder for Compound.

Borrowed hull and mesh inputs must outlive the builder until build is called because Box3D reads them during compound creation.

Implementations§

Source§

impl<'a> CompoundBuilder<'a>

Source

pub fn new() -> Self

Creates an empty compound builder.

Source

pub fn sphere(self, sphere: Sphere, material: SurfaceMaterial) -> Self

Adds a sphere child, storing any validation error until build.

Source

pub fn with_sphere( self, sphere: Sphere, material: SurfaceMaterial, ) -> Result<Self>

Adds a sphere child and returns validation errors immediately.

Source

pub fn add_sphere( &mut self, sphere: Sphere, material: SurfaceMaterial, ) -> Result<&mut Self>

Adds a sphere child to the builder in place.

Source

pub fn capsule(self, capsule: Capsule, material: SurfaceMaterial) -> Self

Adds a capsule child, storing any validation error until build.

Source

pub fn with_capsule( self, capsule: Capsule, material: SurfaceMaterial, ) -> Result<Self>

Adds a capsule child and returns validation errors immediately.

Source

pub fn add_capsule( &mut self, capsule: Capsule, material: SurfaceMaterial, ) -> Result<&mut Self>

Adds a capsule child to the builder in place.

Source

pub fn hull( self, hull: &'a Hull, transform: impl Into<Transform>, material: SurfaceMaterial, ) -> Self

Adds a hull child, storing any validation error until build.

Source

pub fn with_hull( self, hull: &'a Hull, transform: impl Into<Transform>, material: SurfaceMaterial, ) -> Result<Self>

Adds a hull child and returns validation errors immediately.

Source

pub fn add_hull( &mut self, hull: &'a Hull, transform: impl Into<Transform>, material: SurfaceMaterial, ) -> Result<&mut Self>

Adds a hull child to the builder in place.

Source

pub fn box_hull( self, hull: &'a BoxHull, transform: impl Into<Transform>, material: SurfaceMaterial, ) -> Self

Adds a generated box hull child, storing any validation error until build.

Source

pub fn with_box_hull( self, hull: &'a BoxHull, transform: impl Into<Transform>, material: SurfaceMaterial, ) -> Result<Self>

Adds a generated box hull child and returns validation errors immediately.

Source

pub fn add_box_hull( &mut self, hull: &'a BoxHull, transform: impl Into<Transform>, material: SurfaceMaterial, ) -> Result<&mut Self>

Adds a generated box hull child to the builder in place.

Source

pub fn mesh( self, mesh: &'a MeshData, transform: impl Into<Transform>, scale: impl Into<Vec3>, materials: impl AsRef<[SurfaceMaterial]>, ) -> Self

Adds a mesh child, storing any validation error until build.

Source

pub fn with_mesh( self, mesh: &'a MeshData, transform: impl Into<Transform>, scale: impl Into<Vec3>, materials: impl AsRef<[SurfaceMaterial]>, ) -> Result<Self>

Adds a mesh child and returns validation errors immediately.

Source

pub fn add_mesh( &mut self, mesh: &'a MeshData, transform: impl Into<Transform>, scale: impl Into<Vec3>, materials: impl AsRef<[SurfaceMaterial]>, ) -> Result<&mut Self>

Adds a mesh child to the builder in place.

materials must contain exactly mesh.material_count() entries and no more than MAX_COMPOUND_MESH_MATERIALS entries.

Source

pub fn build(self) -> Result<Compound>

Builds the compound data.

Trait Implementations§

Source§

impl<'a> Debug for CompoundBuilder<'a>

Source§

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

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

impl<'a> Default for CompoundBuilder<'a>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> !Send for CompoundBuilder<'a>

§

impl<'a> !Sync for CompoundBuilder<'a>

§

impl<'a> Freeze for CompoundBuilder<'a>

§

impl<'a> RefUnwindSafe for CompoundBuilder<'a>

§

impl<'a> Unpin for CompoundBuilder<'a>

§

impl<'a> UnsafeUnpin for CompoundBuilder<'a>

§

impl<'a> UnwindSafe for CompoundBuilder<'a>

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.