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
| Feature | Default | Description |
|---|---|---|
winit | yes | Window management via winit |
gltf | yes | glTF 2.0 model loading |
http | yes | HTTP asset loading |
gltf-meshopt | no | Meshopt decompression for glTF |
debug_view | no | Render graph debug view targets |
rdg_inspector | no | Render 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
Resultalias. - interner
- Global String Interner
- math
- prelude
- render
- utils
Structs§
- Animation
Action - Animation
Clip - A named collection of animation tracks with a computed duration.
- Animation
Event - A single animation event defined at a specific time within a clip.
- Animation
Mixer - Manages playback and blending of multiple animation actions.
- Animation
System - Animation system.
- App
- Application builder for configuring and launching the engine.
- Asset
Server - Central asset manager for the engine.
- Attribute
- Attribute holds CPU-side data (
Option<Arc<Vec<u8>>>) and metadata. - Background
Settings - Background rendering configuration (mode + automatic uniform version control).
- Binder
- Resolves animation clip track targets to logical bone indices via a
Rig. - Camera
- Clip
Binding - Precomputed mapping from an
crate::clip::AnimationClipto aRig. - Engine
- The core engine instance that orchestrates all rendering subsystems.
- Fired
Event - A fired event, carrying contextual information about when and where it originated.
- Frame
Composer - Frame Composer
- Frame
State - Per-frame timing and state information.
- Fxaa
Settings - FXAA post-processing configuration.
- Geometry
- Geometry
Handle - Handle to a geometry asset in the
AssetStorage. - Image
- CPU-side image data.
- Image
Handle - Handle to a raw image data asset in the [
AssetStorage]. - Light
- Material
- Material
Handle - Handle to a material asset.
- Mesh
- Node
- A minimal scene node containing only essential hot data.
- Node
Handle - Strongly-typed handle for scene nodes.
- Orbit
Controls - Mouse-based orbit camera controller.
- Phong
Material - Physical
Material - Plane
Options - Renderer
- The main renderer responsible for GPU rendering operations.
- Renderer
Init Config - Static initialization parameters for the GPU context.
- Renderer
Settings - Runtime rendering configuration.
- Rig
- Logical skeleton describing the bone topology of an animated entity.
- Scene
- The scene graph container.
- Shader
Defines - A collection of shader macro definitions.
- Sphere
Options - TaaSettings
- TAA settings exposed to the user.
- Texture
- Lightweight “glue” that pairs an
Image(via handle) with sampling, view, and colour-space configuration. - Texture
Handle - Handle to a texture asset (lightweight glue combining an image with sampling config).
- Texture
Slot - A texture slot that holds a texture reference and its UV transformation.
- Texture
Transform - UV texture transformation parameters.
- Tone
Mapping Settings - Tone mapping configuration.
- Track
- A complete track definition pairing metadata with keyframe data.
- Track
Binding - Maps a single animation track to a logical bone in a
Rig. - Track
Meta - Metadata identifying which scene node and property a track targets.
- Transform
- Transform component for scene nodes.
- Unlit
Material
Enums§
- Alpha
Mode - Alpha blending mode for transparency handling.
- Anti
Aliasing Mode - Unified anti-aliasing mode for the rendering pipeline.
- Asset
Error - Errors related to asset loading and processing.
- Background
Mapping - Texture mapping method for background rendering.
- Background
Mode - Background rendering mode.
- Color
Space - Describes how pixel data should be interpreted in the GPU shader.
- Error
- Top-level error type for the Myth engine.
- Fxaa
Quality - FXAA quality preset.
- Index
Format - Format of indices used with pipeline.
- Interpolation
Mode - Loop
Mode - Material
Type - Material data enum with hybrid dispatch strategy.
- Platform
Error - Errors related to platform and window system.
- Render
Error - Errors related to rendering and GPU operations.
- Render
Path - 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.
- Tone
Mapping Mode - Tone mapping algorithm selection.
- Track
Data - Type-erased keyframe data for a single animation track.
- Vertex
Format - Vertex Format for a
VertexAttribute(input).
Traits§
- AppHandler
- Trait for defining application behavior.
- Geometry
Query - Trait for resolving a geometry handle to its local-space bounding box.
- Material
Trait - Base trait for all material types.
- Renderable
Material Trait - Advanced rendering interface for materials.
- Resolve
Geometry - Trait for types that can be resolved into a
GeometryHandle. - Resolve
Material - Trait for types that can be resolved into a
MaterialHandle. - Scene
Ext - Extension trait that adds asset-aware helper methods to
Scene. - Window
- Platform-independent window interface.
Functions§
Type Aliases§
- Result
- Alias for
Result<T, Error>.