Trait ark_module::render::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);
// 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§
sourcefn draw(
&mut self,
common_info: &RenderFrameInfo,
object_to_world: Mat4,
static_data: &[u8],
dynamic_data: &[u8],
cache_id: u64
)
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.
Provided Methods§
sourcefn pre_frame(
&mut self,
_common_info: &RenderFrameInfo,
_draw_info: &[RenderDrawInfo]
)
fn pre_frame( &mut self, _common_info: &RenderFrameInfo, _draw_info: &[RenderDrawInfo] )
Gets called before draw or removed is called for all the instances.
sourcefn post_frame(
&mut self,
_common_info: &RenderFrameInfo,
_draw_info: &[RenderDrawInfo]
)
fn post_frame( &mut self, _common_info: &RenderFrameInfo, _draw_info: &[RenderDrawInfo] )
Gets called after draw or removed is called for all the instances.