pub trait Renderable: Sized {
type Buffer: BufferClient;
type DataAccessor: AccessorClient;
type IndexAccessor: AccessorClient;
type Descriptor: DescriptorClient;
type Texture: TextureClient;
type Material: MaterialClient;
type Vertices: VerticesClient;
// Required methods
fn init_buffer_desc_client(
&mut self,
client: &mut Self::Descriptor,
buffer_desc: &BufferDescriptor<'_, Self>,
);
fn init_buffer_data_client(
&mut self,
client: &mut Self::Buffer,
buffer_data: &BufferData<'_, Self>,
);
fn init_index_accessor_client(
&mut self,
client: &mut Self::IndexAccessor,
buffer_view: &BufferIndexAccessor<'_, Self>,
);
fn init_buffer_view_client(
&mut self,
client: &mut Self::DataAccessor,
buffer_view: &BufferDataAccessor<'_, 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 DataAccessor: AccessorClient
type DataAccessor: AccessorClient
The renderer’s type that reflects a BufferDataAccessor
Sourcetype IndexAccessor: AccessorClient
type IndexAccessor: AccessorClient
The renderer’s type that reflects a BufferIndexAccessor
Sourcetype Descriptor: DescriptorClient
type Descriptor: DescriptorClient
The renderer’s type that reflects a BufferDescriptor
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 [BufferAccessor]s of attributes supported by a particular pipeline within the renderer
Required Methods§
Sourcefn init_buffer_desc_client(
&mut self,
client: &mut Self::Descriptor,
buffer_desc: &BufferDescriptor<'_, Self>,
)
fn init_buffer_desc_client( &mut self, client: &mut Self::Descriptor, buffer_desc: &BufferDescriptor<'_, Self>, )
Initialize a buffer descriptor client - it will have been created using default()
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_index_accessor_client(
&mut self,
client: &mut Self::IndexAccessor,
buffer_view: &BufferIndexAccessor<'_, Self>,
)
fn init_index_accessor_client( &mut self, client: &mut Self::IndexAccessor, buffer_view: &BufferIndexAccessor<'_, Self>, )
Initialize the client of an index accessor of a buffer data
Sourcefn init_buffer_view_client(
&mut self,
client: &mut Self::DataAccessor,
buffer_view: &BufferDataAccessor<'_, Self>,
attr: VertexAttr,
)
fn init_buffer_view_client( &mut self, client: &mut Self::DataAccessor, buffer_view: &BufferDataAccessor<'_, Self>, attr: VertexAttr, )
Initialize the client of a data accessor of a buffer data
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?
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.