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§

source

type Buffer: BufferClient

The renderer’s type that reflects a BufferData

source

type Accessor: AccessorClient

The renderer’s type that reflects a BufferAccessor

source

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

source

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.

source

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§

source

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()

source

fn init_buffer_view_client( &mut self, client: &mut Self::Accessor, buffer_view: &BufferAccessor<'_, Self>, attr: VertexAttr, )

Initialize a buffer view client

source

fn create_vertices_client( &mut self, vertices: &Vertices<'_, Self>, ) -> Self::Vertices

Create a client

source

fn create_texture_client( &mut self, texture: &Texture<'_, Self>, ) -> Self::Texture

Create a client

source

fn create_material_client<M>( &mut self, object: &Object<'_, M, Self>, material: &M, ) -> Self::Material
where M: Material,

Create a client

source

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?

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Renderable for Id

§

type Buffer = Buffer

§

type Accessor = Buffer

§

type Texture = Id

§

type Material = Id

§

type Vertices = Id