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

    // Provided methods
    fn pre_frame(
        &mut self,
        _common_info: &RenderFrameInfo,
        _draw_info: &[RenderDrawInfo]
    ) { ... }
    fn post_frame(
        &mut self,
        _common_info: &RenderFrameInfo,
        _draw_info: &[RenderDrawInfo]
    ) { ... }
}
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.

Provided Methods§

source

fn pre_frame( &mut self, _common_info: &RenderFrameInfo, _draw_info: &[RenderDrawInfo] )

Gets called before draw or removed is called for all the instances.

source

fn post_frame( &mut self, _common_info: &RenderFrameInfo, _draw_info: &[RenderDrawInfo] )

Gets called after draw or removed is called for all the instances.

Implementors§