# =============================================================================
# Myth Engine — Cargo Workspace Root
# =============================================================================

[workspace]
resolver = "2"
members = [
    "crates/myth_core",
    "crates/myth_macros",
    "crates/myth_resources",
    "crates/myth_animation",
    "crates/myth_scene",
    "crates/myth_assets",
    "crates/myth_render",
    "crates/myth_app",
]

# =============================================================================
# Workspace-wide package properties
# =============================================================================

[workspace.package]
version = "0.2.0"
rust-version = "1.92"
edition = "2024"
authors = ["Pan Xinmiao <pan_xinmiao@163.com>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/panxinmiao/myth"
homepage = "https://github.com/panxinmiao/myth"
keywords = ["3d", "gamedev", "wgpu", "webgpu", "graphics"]
categories = ["game-development", "graphics", "rendering::engine"]                                                                                             

# =============================================================================
# Workspace-wide dependency versions
# =============================================================================

[workspace.dependencies]
# Internal crates
myth_core      = { path = "crates/myth_core", version = "0.2.0" }
myth_macros    = { path = "crates/myth_macros", version = "0.2.0" }
myth_resources = { path = "crates/myth_resources", version = "0.2.0" }
myth_animation = { path = "crates/myth_animation", version = "0.2.0" }
myth_scene     = { path = "crates/myth_scene", version = "0.2.0" }
myth_assets    = { path = "crates/myth_assets", version = "0.2.0" }
myth_render    = { path = "crates/myth_render", version = "0.2.0" }
myth_app       = { path = "crates/myth_app", version = "0.2.0" }

# Graphics and Math
wgpu = { version = "29.0.1", features = ["wgsl"] }
glam = { version = "0.32.1", features = ["bytemuck", "scalar-math"] }
bumpalo = "3.20.2"
bytemuck = { version = "1.25", features = ["derive", "min_const_generics"] }
rand = "0.10.0"

# Windowing and Input
winit = { version = "0.30.13" }
raw-window-handle = "0.6"

# Resources and Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
image = { version = "0.25.10", default-features = false, features = ["png", "jpeg", "hdr", "exr", "webp"] }
gltf = { version = "1.4.2", package = "myth-gltf", features = [
    "extensions", "KHR_materials_pbrSpecularGlossiness",
    "KHR_materials_specular", "KHR_materials_emissive_strength", "EXT_texture_webp",
    "KHR_materials_ior", "KHR_texture_transform", "allow_empty_animation_target_node",
    "EXT_meshopt_compression", "KHR_mesh_quantization",
] }
base64 = "0.22"

# Meshopt Compression (for glTF EXT_meshopt_compression)
meshopt = { version = "0.6" }

# Networking (HTTP)
ehttp = { version = "0.7.1", default-features = false, features = ["native-async"] }
url = "2.5"

# Utilities
thiserror = "2.0"
log = "0.4"
env_logger = "0.11.10"
pollster = "0.4"
paste = "1.0"
uuid = { version = "1.23.0", features = ["v4", "v5", "fast-rng", "macro-diagnostics", "js"] }
xxhash-rust = { version = "0.8", features = ["xxh3"] }
slotmap = { version = "1.1.1", features = ["serde"] }
smallvec = "1.15"
half = "2.7"
rustc-hash = "2.1.2"
lasso = "0.7"
parking_lot = "0.12"
futures = "0.3.32"
bitflags = "2.11.0"
flume = "0.12.0"

# Templating
minijinja = { version = "2.19.0", features = ["loader", "custom_syntax"] }
rust-embed = "8.11.0"

# WASM
wasm-bindgen = "0.2.117"
wasm-bindgen-futures = "0.4.67"
web-sys = "0.3.94"
js-sys = "0.3.94"
web-time = "1.1"
console_error_panic_hook = "0.1.7"
console_log = "1.0"
getrandom = { version = "0.4.2", features = ["wasm_js"] }

# Async runtime
tokio = { version = "1.51.0", default-features = false }

# Dev / Test / Bench
anyhow = "1.0.102"
rfd = "0.17.2"
criterion = { version = "0.8.2", default-features = false, features = ["html_reports"] }
wasm-bindgen-test = "0.3.67"

# Egui (dev-dependencies)
egui = "0.34.1"
egui-wgpu = "0.34.1"
egui-winit = { version = "0.34.1", default-features = false }

# Shared lint configuration
[workspace.lints.rust]

[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
# Graphics engine exceptions
cast_precision_loss = "allow"
cast_possible_truncation = "allow"
cast_sign_loss = "allow"
module_name_repetitions = "allow"
missing_errors_doc = "allow"
missing_panics_doc = "allow"
too_many_arguments = "allow"
doc_markdown = "allow"
too_many_lines = "allow"
ref_as_ptr = "allow"

# =============================================================================
# Umbrella Crate — `myth`
# =============================================================================

[package]
name = "myth-engine"
description = "A developer-friendly, high-performance 3D rendering engine written in Rust."
readme = "README.md"
keywords.workspace = true
categories.workspace = true
version.workspace = true
rust-version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true

exclude = [
    "examples/assets/*",
    "docs/images/*",
    ".github/*",
    ".gitignore",
    ".vscode/*",
]

[lib]
name = "myth"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

[dependencies]
myth_core      = { workspace = true }
myth_resources = { workspace = true }
myth_animation = { workspace = true }
myth_scene     = { workspace = true }
myth_assets    = { workspace = true }
myth_render    = { workspace = true }
myth_app       = { workspace = true }

glam = { workspace = true }
log  = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
rfd    = { workspace = true }
env_logger = { workspace = true }
image = { workspace = true }
pollster = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
rustc-hash = { workspace = true }
slotmap = { workspace = true }
uuid = { workspace = true }
bytemuck = { workspace = true }
parking_lot = { workspace = true }
half = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
criterion = { workspace = true, features = ["html_reports"] }
egui      = { workspace = true }
egui-wgpu = { workspace = true, features = ["winit"] }
egui-winit = { workspace = true }
tokio = { workspace = true, features = ["fs", "rt-multi-thread", "macros"] }
ehttp = { workspace = true }
wgpu = { workspace = true }
winit = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = { workspace = true }
criterion = { workspace = true, default-features = false }
egui      = { workspace = true }
egui-wgpu = { workspace = true, features = ["winit"] }
egui-winit = { workspace = true, default-features = false, features = ["links"] }
wasm-bindgen = { workspace = true }
wasm-bindgen-futures = { workspace = true }
console_error_panic_hook = { workspace = true }
console_log = { workspace = true }
tokio = { workspace = true, features = ["macros", "sync", "rt", "time"] }
ehttp = { workspace = true }
wgpu = { workspace = true, features = ["webgpu", "fragile-send-sync-non-atomic-wasm"] }
winit = { workspace = true }
web-sys = { workspace = true, features = ["Window", "Document", "Element", "DomTokenList", "Location", "UrlSearchParams"] }

[[bench]]
name = "render_graph_bench"
harness = false

[features]
default = ["winit", "gltf", "http"]
winit = ["myth_app/winit"]
gltf = ["myth_assets/gltf"]
rdg_inspector = ["myth_render/rdg_inspector"]
debug_view = ["myth_render/debug_view", "myth_scene/debug_view"]
gltf-meshopt = ["gltf", "myth_assets/gltf-meshopt"]
http = ["myth_assets/http"]

[lints]
workspace = true

[[example]]
name = "lut_baker"
path = "examples/tools/lut_baker.rs"