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,
impl<R> Instantiable<R>where
R: Renderable,
Sourcepub fn new<M: Material>(
skeleton: Option<Skeleton>,
vertices: Vec<&Vertices<'_, R>>,
textures: Vec<&Texture<'_, R>>,
materials: Vec<R::Material>,
components: Hierarchy<Component>,
) -> Self
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.
Sourcepub fn instantiate(&self) -> Instance<'_, R>
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