Trait mod3d_base::Renderable
source · pub trait Renderable: Sized {
type Buffer: BufferClient;
type Accessor: AccessorClient;
type Texture: TextureClient;
type Material: MaterialClient;
type Vertices: VerticesClient;
// Required methods
fn init_buffer_data_client(
&mut self,
client: &mut Self::Buffer,
buffer_data: &BufferData<'_, Self>,
);
fn init_buffer_view_client(
&mut self,
client: &mut Self::Accessor,
buffer_view: &BufferAccessor<'_, Self>,
attr: VertexAttr,
);
fn create_vertices_client(
&mut self,
vertices: &Vertices<'_, Self>,
) -> Self::Vertices;
fn create_texture_client(
&mut self,
texture: &Texture<'_, Self>,
) -> Self::Texture;
fn create_material_client<M>(
&mut self,
object: &Object<'_, M, Self>,
material: &M,
) -> Self::Material
where M: Material;
fn init_material_client<M: Material>(
&mut self,
client: &mut Self::Material,
material: &M,
);
}Expand description
The Renderable trait must be implemented by a type that is a client of the 3D model system. It provides associated types for a renderable context (this might be a particular shader program within a OpenGL context, for example), and then its own structures that are used to hold BufferData, textures, materials, and sets of renderable Vertices.
Required Associated Types§
sourcetype Buffer: BufferClient
type Buffer: BufferClient
The renderer’s type that reflects a BufferData
sourcetype Accessor: AccessorClient
type Accessor: AccessorClient
The renderer’s type that reflects a BufferAccessor
sourcetype Texture: TextureClient
type Texture: TextureClient
The renderer’s type that represents a texture; this is supplied to material creation, and hence is less a product of the renderer and more an input to the 3D model library
sourcetype Material: MaterialClient
type Material: MaterialClient
The renderer’s type that reflects a Material; this is expected to be an extraction of the aspects of a material that the renderer pipelines can apply.
sourcetype Vertices: VerticesClient
type Vertices: VerticesClient
The renderer’s type that reflects a BufferAccessor of indices and the associated BufferAccessors of attributes supported by a particular pipeline within the renderer
Required Methods§
sourcefn init_buffer_data_client(
&mut self,
client: &mut Self::Buffer,
buffer_data: &BufferData<'_, Self>,
)
fn init_buffer_data_client( &mut self, client: &mut Self::Buffer, buffer_data: &BufferData<'_, Self>, )
Initialize a buffer data client - it will have been created using default()
sourcefn init_buffer_view_client(
&mut self,
client: &mut Self::Accessor,
buffer_view: &BufferAccessor<'_, Self>,
attr: VertexAttr,
)
fn init_buffer_view_client( &mut self, client: &mut Self::Accessor, buffer_view: &BufferAccessor<'_, Self>, attr: VertexAttr, )
Initialize a buffer view client
sourcefn create_vertices_client(
&mut self,
vertices: &Vertices<'_, Self>,
) -> Self::Vertices
fn create_vertices_client( &mut self, vertices: &Vertices<'_, Self>, ) -> Self::Vertices
Create a client
sourcefn create_texture_client(
&mut self,
texture: &Texture<'_, Self>,
) -> Self::Texture
fn create_texture_client( &mut self, texture: &Texture<'_, Self>, ) -> Self::Texture
Create a client
sourcefn create_material_client<M>(
&mut self,
object: &Object<'_, M, Self>,
material: &M,
) -> Self::Materialwhere
M: Material,
fn create_material_client<M>(
&mut self,
object: &Object<'_, M, Self>,
material: &M,
) -> Self::Materialwhere
M: Material,
Create a client
sourcefn init_material_client<M: Material>(
&mut self,
client: &mut Self::Material,
material: &M,
)
fn init_material_client<M: Material>( &mut self, client: &mut Self::Material, material: &M, )
Create a client for a reason - reason 0 is reserved Can we lose this?