Trait bevy::render::render_asset::RenderAsset
source · pub trait RenderAsset: Asset + Clone {
type PreparedAsset: Send + Sync + 'static;
type Param: SystemParam;
// Required methods
fn asset_usage(&self) -> RenderAssetUsages;
fn prepare_asset(
self,
param: &mut <Self::Param as SystemParam>::Item<'_, '_>
) -> Result<Self::PreparedAsset, PrepareAssetError<Self>>;
}
Expand description
Describes how an asset gets extracted and prepared for rendering.
In the ExtractSchedule
step the asset is transferred
from the “main world” into the “render world”.
After that in the RenderSet::PrepareAssets
step the extracted asset
is transformed into its GPU-representation of type RenderAsset::PreparedAsset
.
Required Associated Types§
sourcetype PreparedAsset: Send + Sync + 'static
type PreparedAsset: Send + Sync + 'static
The GPU-representation of the asset.
sourcetype Param: SystemParam
type Param: SystemParam
Specifies all ECS data required by RenderAsset::prepare_asset
.
For convenience use the lifetimeless
SystemParam
.
Required Methods§
sourcefn asset_usage(&self) -> RenderAssetUsages
fn asset_usage(&self) -> RenderAssetUsages
Whether or not to unload the asset after extracting it to the render world.
sourcefn prepare_asset(
self,
param: &mut <Self::Param as SystemParam>::Item<'_, '_>
) -> Result<Self::PreparedAsset, PrepareAssetError<Self>>
fn prepare_asset( self, param: &mut <Self::Param as SystemParam>::Item<'_, '_> ) -> Result<Self::PreparedAsset, PrepareAssetError<Self>>
Prepares the asset for the GPU by transforming it into a RenderAsset::PreparedAsset
.
ECS data may be accessed via param
.
Object Safety§
This trait is not object safe.