pub trait RenderAsset:
Send
+ Sync
+ 'static
+ Sized {
type SourceAsset: Asset + Clone;
type Params: SystemParam;
// Required method
fn prepare(
id: AssetId<Self::SourceAsset>,
asset: Self::SourceAsset,
params: &mut SystemParamItem<'_, '_, Self::Params>,
) -> Result<Self, PrepareAssetError<Self::SourceAsset>>;
// Provided method
fn label(&self) -> &str { ... }
}Expand description
Trait that describes a GPU asset extracted from a CPU asset that implements the [bevy::prelude::Asset] trait. The GPU asset is prepared from the CPU asset using the render-world system params, and can fail with a retry or fatal error.
Required Associated Types§
type SourceAsset: Asset + Clone
type Params: SystemParam
Required Methods§
Sourcefn prepare(
id: AssetId<Self::SourceAsset>,
asset: Self::SourceAsset,
params: &mut SystemParamItem<'_, '_, Self::Params>,
) -> Result<Self, PrepareAssetError<Self::SourceAsset>>
fn prepare( id: AssetId<Self::SourceAsset>, asset: Self::SourceAsset, params: &mut SystemParamItem<'_, '_, Self::Params>, ) -> Result<Self, PrepareAssetError<Self::SourceAsset>>
Prepare the GPU asset from the CPU source [bevy::prelude::Asset] using the render-world system params.
id is the stable ID of the source asset, allowing implementations to recognize a re-prepare of a
previously seen asset (e.g. to reuse a GPU allocation in place instead of making a new one).
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".