Struct Object

Source
pub struct Object<'object, M, R>
where R: Renderable, M: Material + 'object,
{ pub skeleton: Option<Skeleton>, pub vertices: Vec<&'object Vertices<'object, R>>, pub textures: Vec<&'object Texture<'object, R>>, pub materials: Vec<&'object M>, pub components: Hierarchy<Component>, }
Expand description

A hierarchy of ObjectNode’s

This can be flattened in to an Instantiable

Fields§

§skeleton: Option<Skeleton>

Skeleton

§vertices: Vec<&'object Vertices<'object, R>>

All the vertices used

§textures: Vec<&'object Texture<'object, R>>

All the vertices used

§materials: Vec<&'object M>

All the materials used

§components: Hierarchy<Component>

The meshes etc that make up the object

Implementations§

Source§

impl<'object, M, R> Object<'object, M, R>
where M: Material + 'object, R: Renderable,

Source

pub fn new() -> Self

Create a new Object with no components

Source

pub fn vertices(&self, n: ShortIndex) -> &Vertices<'object, R>

Borrow one of the vertices

Source

pub fn texture(&self, n: ShortIndex) -> &Texture<'object, R>

Borrow one of the textures

Source

pub fn material(&self, n: ShortIndex) -> &M

Borrow a materiaal from the object

Source

pub fn add_vertices( &mut self, vertices: &'object Vertices<'object, R>, ) -> ShortIndex

Add vertices to the object

Source

pub fn add_texture( &mut self, texture: &'object Texture<'object, R>, ) -> ShortIndex

Add texture to the object

Source

pub fn add_material(&mut self, material: &'object M) -> ShortIndex

Add a material to the object

Source

pub fn add_component( &mut self, parent: Option<usize>, transformation: Option<Transformation>, mesh: Mesh, ) -> usize

Add a component to the hierarchy

Source

pub fn relate(&mut self, parent: usize, child: usize)

Add a relation between two components

Source

pub fn analyze(&mut self)

Analyze the object once it has been completely created

This must be performed before clients are created, render recipes are generated, or the object is deconnstructed into an Instantiable.

Source

pub fn into_instantiable(self, renderer: &mut R) -> Instantiable<R>

Deconstruct the object into an Instantiable for the renderable. This should be invoked after analysis and clients have been created.

This permits (for exampl in OpenGL) the CPU-side buffers in the object to be dropped, but the GPU-side objects (created by create_client) can be maintained. The Instantiable contains only instances of the types for the Renderable.

Trait Implementations§

Source§

impl<'object, M, R> Default for Object<'object, M, R>
where M: Material + 'object, R: Renderable,

Source§

fn default() -> Self

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

impl<'object, M, R> Display for Object<'object, M, R>
where R: Renderable, M: Material + 'object,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'object, M, R> Freeze for Object<'object, M, R>

§

impl<'object, M, R> !RefUnwindSafe for Object<'object, M, R>

§

impl<'object, M, R> !Send for Object<'object, M, R>

§

impl<'object, M, R> !Sync for Object<'object, M, R>

§

impl<'object, M, R> Unpin for Object<'object, M, R>

§

impl<'object, M, R> !UnwindSafe for Object<'object, M, R>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.