mirage-engine 0.2.0

Mirage, an immediate-mode 3D engine for simple games on desktop and the browser
Documentation
//! What proves that a game's set holds a type, what proves that its input
//! set seats an action, and the marker every set trait is sealed by.

/// Proves that a set holds `T`, and turns a `T` into it.
///
/// Written by [`meshes!`](crate::meshes),
/// [`surface_styles!`](crate::surface_styles) and
/// [`post_effects!`](crate::post_effects) for every type they name. Every
/// call that takes a value of a game's own set is bound by it:
/// [`draw`](crate::FrameContext::draw), both `prepare` calls,
/// [`Instance::surface_style`](crate::mesh::Instance::surface_style),
/// [`set_surface_style`](crate::FrameContext::set_surface_style) and
/// [`set_post_effect`](crate::FrameContext::set_post_effect). A game spells
/// one bound per type, in its own code that draws, or sets a style or
/// effect, for any [`Game`](crate::Game).
///
/// ```
/// use mirage_engine::prelude::*;
///
/// fn draw_cube<G: Game>(ctx: &mut FrameContext<'_, G>, at: Vec3)
/// where
///     G::Meshes: Holds<Cube>,
/// {
///     ctx.draw(Cube.at(at));
/// }
/// ```
pub trait Holds<T>: From<T> {}

/// Proves that one of an [`InputActions`](crate::InputActions) set's three
/// kinds seats `A`.
///
/// Written by the engine for every input set, so a game writes it for none
/// of its own. The input queries,
/// [`rebind`](crate::FrameContext::rebind) and
/// [`bindings`](crate::FrameContext::bindings) are bound by it. `B` is the
/// kind's binding type; it keeps the three kinds apart, since nothing
/// proves a set's three kinds are three different types.
pub trait Seats<A, B> {}

/// [`Meshes`](crate::Meshes), [`ShaderValues`](crate::ShaderValues),
/// [`SurfaceStyles`](crate::SurfaceStyles) and
/// [`PostEffects`](crate::PostEffects) are sealed by this, which the set
/// macros write for every set they write and
/// [`ShaderValues`](macro@crate::ShaderValues) for every value struct, so
/// nothing outside the engine implements a set trait.
#[doc(hidden)]
pub trait Sealed {}