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,
impl<'object, M, R> Object<'object, M, R>where
M: Material + 'object,
R: Renderable,
Sourcepub fn vertices(&self, n: ShortIndex) -> &Vertices<'object, R>
pub fn vertices(&self, n: ShortIndex) -> &Vertices<'object, R>
Borrow one of the vertices
Sourcepub fn texture(&self, n: ShortIndex) -> &Texture<'object, R>
pub fn texture(&self, n: ShortIndex) -> &Texture<'object, R>
Borrow one of the textures
Sourcepub fn material(&self, n: ShortIndex) -> &M
pub fn material(&self, n: ShortIndex) -> &M
Borrow a materiaal from the object
Sourcepub fn add_vertices(
&mut self,
vertices: &'object Vertices<'object, R>,
) -> ShortIndex
pub fn add_vertices( &mut self, vertices: &'object Vertices<'object, R>, ) -> ShortIndex
Add vertices to the object
Sourcepub fn add_texture(
&mut self,
texture: &'object Texture<'object, R>,
) -> ShortIndex
pub fn add_texture( &mut self, texture: &'object Texture<'object, R>, ) -> ShortIndex
Add texture to the object
Sourcepub fn add_material(&mut self, material: &'object M) -> ShortIndex
pub fn add_material(&mut self, material: &'object M) -> ShortIndex
Add a material to the object
Sourcepub fn add_component(
&mut self,
parent: Option<usize>,
transformation: Option<Transformation>,
mesh: Mesh,
) -> usize
pub fn add_component( &mut self, parent: Option<usize>, transformation: Option<Transformation>, mesh: Mesh, ) -> usize
Add a component to the hierarchy
Sourcepub fn analyze(&mut self)
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.
Sourcepub fn into_instantiable(self, renderer: &mut R) -> Instantiable<R>
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.