Files
MetaCrate/docs/imaging-meshing.md
Chili Palmer 25fdffbd3b
Some checks failed
CI / rust-skia (Rust only) (push) Successful in 2m51s
CI / required (push) Failing after 3m23s
feat(imaging): default to pure-Rust codecs
2026-08-13 11:24:38 +00:00

3.9 KiB

Imaging and meshing integration

Milestone 06 owns the native implementations in libremetaverse-imaging, libremetaverse-imaging-skia, and libremetaverse-prim-mesher. The core imaging and meshing crates contain no CLR bridge, subprocess adapter, foreign RPC, or generated failure-only shim. The rendering crates consume the checked mesh data but remain a separate milestone: SimpleRenderer now provides the reference prim/sculpt conversion pipeline. MeshFoundry now adds bounded mesh asset, rigging, tangent, secondary-UV, terrain, and convex-hull handling without changing the milestone 06 ownership boundary. See the SimpleRenderer guide and MeshFoundry guide.

Feature boundary

Surface Default build Opt-in build Native dependency
Managed images and TGA enabled n/a none
JPEG 2000 disabled libremetaverse-imaging/jpeg2000 OpenJPEG 2.5.x
JPEG 2000 (pure Rust) enabled libremetaverse-imaging/rust-j2k none (j2k 0.8.1)
BMP/GIF/ICO/JPEG/PNG/WBMP/WebP (pure Rust) enabled libremetaverse-imaging-skia/rust-skia none (skia-rs-codec 0.3.0 plus image-webp 0.2.4)
BMP/GIF/ICO/JPEG/PNG/WBMP/WebP (native) disabled libremetaverse-imaging-skia/skia Skia
Prim and sculpt meshing, OBJ ingestion enabled n/a none

OpenJPEG is a non-default workspace member so release tooling can package the adapter explicitly, and imaging reaches it only through the optional dependency. The default rust-j2k feature reaches only the audited pure-Rust j2k graph; enabling both features keeps both explicit codec types available for interoperability testing. Native Skia is likewise an optional, target-specific dependency, while rust-skia is the raster crate default. The consolidated required Gitea gate exercises the native feature, while a dedicated ubuntu-latest job tests rust-skia, audits its normal/build graph without installing native codec tools, and compiles the same code for WASM. Minimal-feature checks still prove no codec is needed for the owned Rust and translated compatibility tests.

Bounds and rendering contract

Decoded images are limited to 4,096 by 4,096 pixels and encoded inputs to 64 MiB. Channel sizes, resize products, codec buffers, sculpt-map dimensions, profile/path sizes, mesh vertex counts, face indices, viewer groups, and OBJ indices use checked arithmetic before allocation or indexing. Malformed input returns a typed error.

The rendering-facing integration tests verify that PrimMesh and SculptMesh produce finite positions, normals, and UVs; aligned face and viewer-face data; preserved prim-face grouping; in-range indices; and the 16-bit index range used by the pinned MeshFoundry reference at every supported sculpt topology and LOD.

Reproducible gates

Run the fixed ownership and feature audit with:

python3 tools/check_milestone_06.py

The audit rejects owned Rust stubs, feature leakage, missing platform jobs, missing performance targets, or drift in the 48 reviewed ManagedImage, Coord/Quat, and PrimMesh compatibility cases. The required gate runs the native crate and reviewed parity tests, Clippy with warnings denied, and rustdoc with warnings denied. Benchmark compilation is retained in the non-routine release gate.

The focused performance baselines are executable Rust programs rather than wall-clock assertions, so slower shared runners do not weaken or destabilize correctness tests:

cargo bench -p libremetaverse-imaging --bench image_pipeline
cargo bench -p libremetaverse-prim-mesher --bench meshing

The image baseline clones, bilinearly resizes, and exports a 2,048-square RGBA image. The meshing baseline builds and indexes a high-detail cut, hollow, twisted circular extrusion. Both report elapsed time and allocation counts so regressions can be compared using the same inputs.