RenderAsset

Trait RenderAsset 

Source
pub trait RenderAsset:
    Send
    + Sync
    + 'static
    + Sized {
    type SourceAsset: Asset + Clone;
    type Params: SystemParam;

    // Required method
    fn prepare(
        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§

Source

type SourceAsset: Asset + Clone

Source

type Params: SystemParam

Required Methods§

Source

fn prepare( 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.

Provided Methods§

Source

fn label(&self) -> &str

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl RenderAsset for GpuBuffer

Source§

impl RenderAsset for GpuMesh

Source§

type SourceAsset = Mesh

Source§

type Params = (Res<'static, RenderInstance>, ResMut<'static, SsboMeshDescriptor>, Res<'static, RenderAssets<GpuRenderData<SsboMesh>>>, Res<'static, RenderAssets<GpuBuffer>>)

Source§

impl RenderAsset for GpuTexture

Source§

impl<R: RenderData + Clone + Asset> RenderAsset for GpuRenderData<R>

Source§

type SourceAsset = RenderDataHolder<R>

Source§

type Params = Res<'static, AssetServer>

Source§

impl<T> RenderAsset for GpuRenderBinding<T>
where T: RenderBinding + TypePath + Sync + Send + Clone + Asset,

Source§

type SourceAsset = T

Source§

type Params = (<T as RenderBinding>::Params, Res<'static, RenderInstance>, Res<'static, RenderAssets<GpuBuffer>>, Res<'static, RenderAssets<GpuTexture>>)