Skip to main content

Crate myth

Crate myth 

Source
Expand description

§Myth - A High-Performance, WGPU-Based Rendering Engine for Rust.

Myth-Engine is a modern 3D rendering engine built with Rust and wgpu. It provides a flexible, high-performance foundation for real-time graphics applications.

§Quick Start

use myth::prelude::*;
struct MyApp;
impl AppHandler for MyApp {
   fn init(engine: &mut Engine, _: &dyn Window) -> Self {
       // 0. Create a Scene
       let scene = engine.scene_manager.create_active();

       // 1. Create a cube mesh with a checkerboard texture
       let tex_handle = engine.assets.checkerboard(512, 64);
       let mesh_handle = scene.spawn_box(
           1.0, 1.0, 1.0,
           PhongMaterial::new(Vec4::new(1.0, 0.76, 0.33, 1.0)).with_map(tex_handle),
           &engine.assets,
       );
       // 2. Setup Camera
       let cam_node_id = scene.add_camera(Camera::new_perspective(45.0, 1280.0 / 720.0, 0.1));
       scene.node(&cam_node_id).set_position(0.0, 0.0, 5.0).look_at(Vec3::ZERO);
       scene.active_camera = Some(cam_node_id);
       // 3. Add Light
       scene.add_light(Light::new_directional(Vec3::ONE, 5.0));

       // 4. Setup update callback to rotate the cube
       scene.on_update(move |scene, _input, _dt| {
           if let Some(node) = scene.get_node_mut(mesh_handle) {
               let rot_y = Quat::from_rotation_y(0.02);
               let rot_x = Quat::from_rotation_x(0.01);
               node.transform.rotation = node.transform.rotation * rot_y * rot_x;
           }
       });
       Self {}
   }
}
fn main() -> myth::Result<()> {
    App::new().with_title("Myth-Engine Demo").run::<MyApp>()
}

§Feature Flags

FeatureDefaultDescription
winityesWindow management via winit
gltfyesglTF 2.0 model loading
httpyesHTTP asset loading
gltf-meshoptnoMeshopt decompression for glTF
debug_viewnoRender graph debug view targets
rdg_inspectornoRender graph inspector

Re-exports§

pub use myth_scene as scene;
pub use myth_resources as resources;
pub use myth_animation as animation;
pub use myth_assets as assets;
pub use myth_render as renderer;
pub use myth_app as app;

Modules§

engine
Engine core without windowing (always available even without winit).
errors
Error types and Result alias.
interner
Global String Interner
math
prelude
render
utils

Structs§

AnimationAction
AnimationClip
A named collection of animation tracks with a computed duration.
AnimationEvent
A single animation event defined at a specific time within a clip.
AnimationMixer
Manages playback and blending of multiple animation actions.
AnimationSystem
Animation system.
App
Application builder for configuring and launching the engine.
AssetServer
Central asset manager for the engine.
Attribute
Attribute holds CPU-side data (Option<Arc<Vec<u8>>>) and metadata.
BackgroundSettings
Background rendering configuration (mode + automatic uniform version control).
Binder
Resolves animation clip track targets to logical bone indices via a Rig.
Camera
ClipBinding
Precomputed mapping from an crate::clip::AnimationClip to a Rig.
Engine
The core engine instance that orchestrates all rendering subsystems.
FiredEvent
A fired event, carrying contextual information about when and where it originated.
FrameComposer
Frame Composer
FrameState
Per-frame timing and state information.
FxaaSettings
FXAA post-processing configuration.
Geometry
GeometryHandle
Handle to a geometry asset in the AssetStorage.
Image
CPU-side image data.
ImageHandle
Handle to a raw image data asset in the [AssetStorage].
Light
Material
MaterialHandle
Handle to a material asset.
Mesh
Node
A minimal scene node containing only essential hot data.
NodeHandle
Strongly-typed handle for scene nodes.
OrbitControls
Mouse-based orbit camera controller.
PhongMaterial
PhysicalMaterial
PlaneOptions
Renderer
The main renderer responsible for GPU rendering operations.
RendererInitConfig
Static initialization parameters for the GPU context.
RendererSettings
Runtime rendering configuration.
Rig
Logical skeleton describing the bone topology of an animated entity.
Scene
The scene graph container.
ShaderDefines
A collection of shader macro definitions.
SphereOptions
TaaSettings
TAA settings exposed to the user.
Texture
Lightweight “glue” that pairs an Image (via handle) with sampling, view, and colour-space configuration.
TextureHandle
Handle to a texture asset (lightweight glue combining an image with sampling config).
TextureSlot
A texture slot that holds a texture reference and its UV transformation.
TextureTransform
UV texture transformation parameters.
ToneMappingSettings
Tone mapping configuration.
Track
A complete track definition pairing metadata with keyframe data.
TrackBinding
Maps a single animation track to a logical bone in a Rig.
TrackMeta
Metadata identifying which scene node and property a track targets.
Transform
Transform component for scene nodes.
UnlitMaterial

Enums§

AlphaMode
Alpha blending mode for transparency handling.
AntiAliasingMode
Unified anti-aliasing mode for the rendering pipeline.
AssetError
Errors related to asset loading and processing.
BackgroundMapping
Texture mapping method for background rendering.
BackgroundMode
Background rendering mode.
ColorSpace
Describes how pixel data should be interpreted in the GPU shader.
Error
Top-level error type for the Myth engine.
FxaaQuality
FXAA quality preset.
IndexFormat
Format of indices used with pipeline.
InterpolationMode
LoopMode
MaterialType
Material data enum with hybrid dispatch strategy.
PlatformError
Errors related to platform and window system.
RenderError
Errors related to rendering and GPU operations.
RenderPath
Determines the pipeline topology — which render passes are assembled, whether HDR intermediates are allocated, and which post-processing chain is available.
Side
Face culling mode for rendering.
ToneMappingMode
Tone mapping algorithm selection.
TrackData
Type-erased keyframe data for a single animation track.
VertexFormat
Vertex Format for a VertexAttribute (input).

Traits§

AppHandler
Trait for defining application behavior.
GeometryQuery
Trait for resolving a geometry handle to its local-space bounding box.
MaterialTrait
Base trait for all material types.
RenderableMaterialTrait
Advanced rendering interface for materials.
ResolveGeometry
Trait for types that can be resolved into a GeometryHandle.
ResolveMaterial
Trait for types that can be resolved into a MaterialHandle.
SceneExt
Extension trait that adds asset-aware helper methods to Scene.
Window
Platform-independent window interface.

Functions§

create_box
create_plane
create_sphere

Type Aliases§

Result
Alias for Result<T, Error>.