mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-21 15:00:42 +01:00
An open-source, clean-room implementation of a Substance 3D Painter-style texturing workflow, written in pure Rust with egui and wgpu. - Layer stack with 32 blend modes, masks, generators, content effects and anchor points - Painting, projection, smudge, clone, path, lasso fill, particle brush and quick mask - 43 procedural materials, 17 smart materials and 10 smart masks - Mesh map baking with high-poly, cage and match-by-name support - PBR viewport with HDR environments, TAA and a path-traced Rendering mode - glTF, FBX, COLLADA, OBJ, PLY and STL import; texture export presets; OBJ and GLB export - Dockable Painter-style UI, shortcut editor, web build, MCP server and CLI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.9 KiB
Rust
42 lines
1.9 KiB
Rust
//! TextureCraft in the browser.
|
|
//!
|
|
//! Runs the same [`texturecraft_ui_egui::TextureCraftApp`] as the desktop app through eframe's web
|
|
//! runner (wgpu: WebGPU where available, WebGL2 otherwise). Build with `trunk build --release`
|
|
//! from this directory (`packaging/web/package.sh` zips the result).
|
|
//!
|
|
//! Differences from the desktop app: no control server (browsers can't listen on sockets), and
|
|
//! file I/O goes through `texturecraft_ui_egui::web_files` (file picker in, downloads out).
|
|
//!
|
|
//! URL query flag: `?webgl` forces the WebGL2 backend instead of WebGPU.
|
|
|
|
#![forbid(unsafe_code)]
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
mod web;
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
fn main() {
|
|
web::start();
|
|
}
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
fn main() {
|
|
eprintln!("texturecraft-web only runs in the browser: build it with `trunk build --release` in apps/texturecraft-web");
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
/// A WebAssembly module that never downloads runs no Rust, so the page itself replaces the
|
|
/// endless "Loading" with a way to retry, without a hand-written script.
|
|
#[test]
|
|
fn loading_page_offers_a_reload_when_startup_stalls() {
|
|
let html = include_str!("../index.html");
|
|
let (_, hint) = html.split_once("<p id=\"texturecraft_stalled\">").expect("stalled-startup hint in the loading element");
|
|
assert!(hint.contains("failed to") && hint.contains("<a href=\"\">Reload</a>"), "{hint}");
|
|
assert!(html.contains("animation: texturecraft-stalled"), "the hint appears after a delay");
|
|
assert!(html.contains("id=\"texturecraft_canvas\"") && html.contains("data-cargo-profile=\"wasm-release\""));
|
|
assert!(!html.contains("<script"), "trunk injects the generated loader; the page has no script of its own");
|
|
}
|
|
}
|