myth_macros 0.2.0

Procedural macros for the Myth engine material system.
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 69.66 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 479.67 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • panxinmiao/myth
    192 9 5
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • panxinmiao

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,
}