RenderModule

Trait RenderModule 

Source
pub trait RenderModule {
    // Required methods
    fn new() -> Self;
    fn draw(
        &mut self,
        common_info: &RenderFrameInfo,
        object_to_world: Mat4,
        static_data: &[u8],
        dynamic_data: &[u8],
        cache_id: u64,
    );
    fn removed(&mut self, cache_id: u64);
}
Expand description

Render module creation & update trait

Required Methods§

Source

fn new() -> Self

Creation of a new module

This is called once on startup of the module

Source

fn draw( &mut self, common_info: &RenderFrameInfo, object_to_world: Mat4, static_data: &[u8], dynamic_data: &[u8], cache_id: u64, )

Implement the rendering for an entity here.

cache_id is unique per entity, and can be used internally to cache entity-specific data. It is unrelated to the instance_id you can specify in the render API, although you might find it useful to use the cache_id to come up with suitably unique and stable instance_ids.

static_data is the data array you specified when creating the Shape. dynamic_data is empty by default but can be set at any time on the Render component of the Entity.

Source

fn removed(&mut self, cache_id: u64)

Gets called when you can safely delete all cached information related to a specific cache_id.

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.

Implementors§