Struct Instantiable

Source
pub struct Instantiable<R>
where R: Renderable,
{ pub skeleton: Option<Skeleton>, pub vertices: Vec<R::Vertices>, pub textures: Vec<R::Texture>, pub materials: Vec<R::Material>, pub render_recipe: RenderRecipe, pub num_bone_matrices: usize, }
Expand description

An Instantiable is a type that is related to a set of Mesh data, which can be instanced for different drawable::Instance’s

It requires a related set of Mesh data that it does not refer to: in object construction this Mesh data is likely to be the structures containing vertex information and so on resident on a CPU; in rendering the Mesh data is likely to be graphical objects (such as OpenGL VAOs) that may reside (at least in part) on the GPU.

The Instantiable data must be kept available to its related Instance.

The content of the Instantiable includes an array of Skeletons and mesh transformation matrices, with appropriate index values. These index values are into the related set of Mesh data.

Fields§

§skeleton: Option<Skeleton>

Skeleton

§vertices: Vec<R::Vertices>

All the vertices used

§textures: Vec<R::Texture>

All the textures used

§materials: Vec<R::Material>

All the materials used

§render_recipe: RenderRecipe

Render recipe

§num_bone_matrices: usize

Number of bone matrices required for all the bone sets in this structure

Implementations§

Source§

impl<R> Instantiable<R>
where R: Renderable,

Source

pub fn new<M: Material>( skeleton: Option<Skeleton>, vertices: Vec<&Vertices<'_, R>>, textures: Vec<&Texture<'_, R>>, materials: Vec<R::Material>, components: Hierarchy<Component>, ) -> Self

Create a new instantiable drawable - something to which meshes and bone sets will be added, and for which a set of mesh matrices and rest bone positions will be derived.

Such a type can that be ’instance’d with a specific transformation and bone poses, and such instances can then be drawn using shaders.

Source

pub fn instantiate(&self) -> Instance<'_, R>

Create an Instance from this instantiable - must be used with accompanying mesh data in the appropriate form for the client Must still add bone_poses one per bone set

Trait Implementations§

Source§

impl<R> Debug for Instantiable<R>

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.