hephae_render::vertex

Trait Vertex

Source
pub trait Vertex:
    Send
    + Sync
    + NoUninit {
    type PipelineParam: SystemParam;
    type PipelineProp: Send + Sync;
    type PipelineKey: Send + Sync + Clone + Eq + PartialEq + Hash;
    type Command: VertexCommand<Vertex = Self>;
    type BatchParam: SystemParam;
    type BatchProp: Send + Sync;
    type Item: CachedRenderPipelinePhaseItem + SortedPhaseItem;
    type RenderCommand: RenderCommand<Self::Item> + Send + Sync;

    const SHADER: &'static str;
    const LAYOUT: &'static [VertexAttribute];
    const DEPTH_FORMAT: Option<TextureFormat> = _;

    // Required methods
    fn init_pipeline(
        param: SystemParamItem<'_, '_, Self::PipelineParam>,
    ) -> Self::PipelineProp;
    fn specialize_pipeline(
        key: Self::PipelineKey,
        prop: &Self::PipelineProp,
        desc: &mut RenderPipelineDescriptor,
    );
    fn create_item(
        layer: f32,
        entity: (Entity, MainEntity),
        pipeline: CachedRenderPipelineId,
        draw_function: DrawFunctionId,
        command: usize,
    ) -> Self::Item;
    fn create_batch(
        param: &mut SystemParamItem<'_, '_, Self::BatchParam>,
        key: Self::PipelineKey,
    ) -> Self::BatchProp;

    // Provided method
    fn setup(app: &mut App) { ... }
}
Expand description

The heart of Hephae. Instances of Vertex directly represent the elements of the vertex buffer in the GPU.

Required Associated Constants§

Source

const SHADER: &'static str

Path to the shader rendering vertex attributes of this type. Entry points should be vertex(...) and fragment(...).

Source

const LAYOUT: &'static [VertexAttribute]

Vertex attribute layout of this type. Ideally should match the fields implementors declare.

Provided Associated Constants§

Source

const DEPTH_FORMAT: Option<TextureFormat> = _

Format of the depth-stencil pass supplied to the rendering pipeline creation parameters. Defaults to [Some(TextureFormat::Depth32Float)], which is the default for 2D core pipeline depth-stencil format. None means the pipeline will not have a depth-stencil state.

Required Associated Types§

Source

type PipelineParam: SystemParam

System parameter to fetch when initializing HephaePipeline to create a PipelineProp.

Source

type PipelineProp: Send + Sync

The additional property of the common pipeline definition that may used when specializing based on PipelineKey. For example, this may be used to create a BindGroupLayout for texture-sampling.

Source

type PipelineKey: Send + Sync + Clone + Eq + PartialEq + Hash

Key used to specialize the render pipeline. For example, this may be an AssetId<Image> used to reference a GpuImage for texture-sampling.

Source

type Command: VertexCommand<Vertex = Self>

The vertex command that [Drawer<Vertex = Self>] may output. These commands will be sorted according to their Z-layers and then extracted out into the batches.

Source

type BatchParam: SystemParam

System parameter to fetch when creating the batch.

Source

type BatchProp: Send + Sync

Additional property that is embedded into HephaeBatch components for use in RenderCommand. For example, this may be an AssetId<Image> from PipelineKey to attach the associated bind group for texture-sampling.

Source

type Item: CachedRenderPipelinePhaseItem + SortedPhaseItem

The PhaseItem that this vertex works with.

Source

type RenderCommand: RenderCommand<Self::Item> + Send + Sync

Additional GPU render commands to invoke before actually drawing the vertex and index buffers. For example, this may be used to set the texture-sampling bind group provided by BatchProp.

Required Methods§

Source

fn init_pipeline( param: SystemParamItem<'_, '_, Self::PipelineParam>, ) -> Self::PipelineProp

Creates the additional render pipeline property for use in specialization.

Source

fn specialize_pipeline( key: Self::PipelineKey, prop: &Self::PipelineProp, desc: &mut RenderPipelineDescriptor, )

Specializes the render pipeline descriptor based off of the key and prop of the common render pipeline descriptor.

Source

fn create_item( layer: f32, entity: (Entity, MainEntity), pipeline: CachedRenderPipelineId, draw_function: DrawFunctionId, command: usize, ) -> Self::Item

Creates the phase item associated with a VertexCommand based on its layer, render and main entity, rendering pipeline ID, draw function ID, and command index.

Source

fn create_batch( param: &mut SystemParamItem<'_, '_, Self::BatchParam>, key: Self::PipelineKey, ) -> Self::BatchProp

Creates additional batch property for use in rendering.

Provided Methods§

Source

fn setup(app: &mut App)

Further customizes the application. Called in Plugin::finish. For example, this may be used to add systems extracting texture atlas pages and validating bind groups associated with them.

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§