Skip to main content

MeshBuild

Struct MeshBuild 

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

A mesh being prepared for Scene::add_mesh_built outside any scene: its BVH, and its vertex normals when asked for (MeshBuild::set_normals), are built in steps (MeshBuild::step), so that a caller can yield between them (the Worker engine adds large meshes this way). Nothing of it is in a scene until it is added.

Implementations§

Source§

impl MeshBuild

Source

pub fn new(mesh: Mesh, options: MeshOptions) -> Result<MeshBuild>

Starts preparing mesh for Scene::add_mesh with options.

§Errors

SceneError::InvalidInput for an invalid placement; a BVH option or memory error.

Source

pub fn set_normals(&mut self, on: bool)

Turns the mesh’s vertex normals on or off (off by default), as Scene::set_normals would right after the add: with them on, the steps compute them too, once the BVH is built, and the mesh is added with them on. Turning them off drops what was computed.

Source

pub fn step(&mut self, budget: usize) -> Result<bool>

Builds about budget more units of the BVH (see BvhBuild::step), then of the normals when they are on (a unit: 4 triangles or 16 vertices). Returns whether everything is built.

§Errors

A memory error; the build is unusable after it.

Source

pub fn is_done(&self) -> bool

Whether the BVH, and the normals when they are on, are built.

Source

pub fn normals(&self) -> Option<&[[f32; 3]]>

The vertex normals, once built with them on; None before or when they are off.

Source

pub fn mesh(&self) -> &Mesh

The mesh being prepared.

Trait Implementations§

Source§

impl Debug for MeshBuild

Source§

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

Formats the value using the given formatter. 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.