Skip to main content

Crate myth_macros

Crate myth_macros 

Source
Expand description

Procedural macros for the Myth engine material system.

Provides the myth_material attribute macro that transforms a clean, declarative material definition into a production-ready material type with:

  • Concurrent-safe GPU buffer management via [CpuBuffer] and [RwLock]
  • Automatic version tracking for pipeline cache invalidation
  • Generated getter/setter methods with fast-path optimizations
  • Auto-generated uniform struct with std140 padding
  • Full [MaterialTrait] and [RenderableMaterialTrait] implementations

§Example

use myth_macros::myth_material;

#[myth_material(shader = "entry/main/unlit")]
pub struct UnlitMaterial {
    /// Base color.
    #[uniform(default = "Vec4::ONE")]
    pub color: Vec4,

    /// Opacity value.
    #[uniform(default = "1.0")]
    pub opacity: f32,

    /// The color map.
    #[texture]
    pub map: TextureSlot,
}

Attribute Macros§

gpu_struct
Transforms a GPU data struct into a fully aligned, GPU-ready type.
myth_material
Transforms a declarative material struct into a complete engine material type.