Trait keeshond_datapack::DataPreparer[][src]

pub trait DataPreparer<T: DataObject + 'static, U> {
    fn prepare(&mut self, data: &mut T, id: DataId) -> U;
fn unprepare(&mut self, prepared: &mut U, id: DataId); fn reprepare(&mut self, data: &mut T, prepared: &mut U, id: DataId) { ... } }
Expand description

Used with PreparedStore, this allows the definition of behavior when initializing resources with a backend. See PreparedStore for more information.

Required methods

fn prepare(&mut self, data: &mut T, id: DataId) -> U[src]

Called when data has been loaded but not “prepared” yet. You can use this, for example, to load textures onto the GPU.

fn unprepare(&mut self, prepared: &mut U, id: DataId)[src]

Called when data has been unloaded recently and should be cleared in the backend. For example, use this to unload textures from GPU memory.

Provided methods

fn reprepare(&mut self, data: &mut T, prepared: &mut U, id: DataId)[src]

Called when data is already loaded but needs to be “reprepared”. You can use this, for example, to update existing textures on the GPU.

Implementors