Trait bevy::render::render_asset::RenderAsset
pub trait RenderAsset: Asset {
type ExtractedAsset: 'static + Send + Sync;
type PreparedAsset: 'static + Send + Sync;
type Param: SystemParam;
fn extract_asset(&self) -> Self::ExtractedAsset;
fn prepare_asset(
extracted_asset: Self::ExtractedAsset,
param: &mut <<Self::Param as SystemParam>::Fetch as SystemParamFetch<'_, '_>>::Item
) -> Result<Self::PreparedAsset, PrepareAssetError<Self::ExtractedAsset>>;
}
Expand description
Describes how an asset gets extracted and prepared for rendering.
In the RenderStage::Extract
step the asset is transferred
from the “app world” into the “render world”.
Therefore it is converted into a RenderAsset::ExtractedAsset
, which may be the same type
as the render asset itself.
After that in the RenderStage::Prepare
step the extracted asset
is transformed into its GPU-representation of type RenderAsset::PreparedAsset
.
Required Associated Types§
type ExtractedAsset: 'static + Send + Sync
type ExtractedAsset: 'static + Send + Sync
The representation of the asset in the “render world”.
type PreparedAsset: 'static + Send + Sync
type PreparedAsset: 'static + Send + Sync
The GPU-representation of the asset.
type Param: SystemParam
type Param: SystemParam
Specifies all ECS data required by RenderAsset::prepare_asset
.
For convenience use the lifetimeless
SystemParam
.
Required Methods§
fn extract_asset(&self) -> Self::ExtractedAsset
fn extract_asset(&self) -> Self::ExtractedAsset
Converts the asset into a RenderAsset::ExtractedAsset
.
fn prepare_asset(
extracted_asset: Self::ExtractedAsset,
param: &mut <<Self::Param as SystemParam>::Fetch as SystemParamFetch<'_, '_>>::Item
) -> Result<Self::PreparedAsset, PrepareAssetError<Self::ExtractedAsset>>
fn prepare_asset(
extracted_asset: Self::ExtractedAsset,
param: &mut <<Self::Param as SystemParam>::Fetch as SystemParamFetch<'_, '_>>::Item
) -> Result<Self::PreparedAsset, PrepareAssetError<Self::ExtractedAsset>>
Prepares the extracted asset
for the GPU by transforming it into
a RenderAsset::PreparedAsset
. Therefore ECS data may be accessed via the param
.