Expand description
Asset import: OBJ / STL / GLB → Mesh + semantic NQuins (Phase 1.3).
Asset-import bridge — OBJ / STL mesh → NQuin stream (Phase 1.3,
RENDERER_IMPLEMENTATION_PLAN.md).
Pure &[u8] → (geometry, semantic NQuins). No std::fs — wasm-safe (migration review
§2.1): the shell / CLI reads the file (or runs the OS picker) and hands the bytes down. This is
the ingest path (not a hot path), so Vec / HashMap are fine — the same convention as
kml_bridge.
Two layers, per STELLAR §E (“artefacts carry their geometry, and are semantically known”):
- [
Mesh] — raw geometry (vertex positions + triangle indices + bounding box): the data the GPU vertex/index buffers (Phase 1.2) will consume. - [
mesh_to_nquins] — the semantic layer: the asset is known (type, counts, bounding box, centroid, source format) as NQuins in the one identity space — not just points/pixels.
Hot-path rendering (depth-stencil, mesh buffers, projection) is the GPU half of Phase 1 and is verified on hardware; this module is the CPU half and is unit-tested here.
Structs§
- Mesh
- Raw triangle-mesh geometry. The hot-path GPU buffers (Phase 1.2) consume
positions+triangles; the bounding box is precomputed for the projection / culling layer (§E §4).
Enums§
- Asset
Error - Error type for asset import.
Constants§
Functions§
- import_
asset - Import a mesh, sniffing the format from the bytes (or trusting an explicit lowercase
extension hint like
"obj"/"stl"). - import_
glb - Parse a binary glTF (
.glb): the 12-byte header, JSON chunk, and BIN chunk, then walkmeshes[].primitives[], reading eachPOSITIONaccessor (FLOAT VEC3) and the optional index accessor (u8/u16/u32 SCALAR) out of the BIN buffer. Triangle primitives only (mode 4); other modes are skipped (a faithful first cut). Embedded/external-URI buffers are not handled here — self-contained GLB binary only. - import_
obj - Parse a Wavefront
.obj:v x y zvertices andffaces (polygons fan-triangulated). Face tokens may bev,v/vt,v//vn, orv/vt/vn; indices are 1-based and may be negative (relative to the current vertex count).vt/vn/vp/ groups are ignored for geometry. - import_
stl - Parse a
.stl(auto-detects binary vs ASCII). Each STL triangle contributes 3 fresh vertices (no welding) — a faithful, lossless first cut; vertex de-duplication is a later optimisation. - mesh_
to_ nquins - Emit the semantic quins for a mesh asset (the asset is known, not just drawn): its type,
vertex/triangle counts, bounding box, centroid, and source format — all in
GEOMETRY_CONTEXT, in the one identity space. Floats use the inline-float object tag (ADR 0008); counts are raw integers. The returned lexicon maps the asset-URI / format hashes back to their strings. - mesh_
to_ nquins_ with_ dev - Like
mesh_to_nquins_with_digestsbut for a developmental body: also asserts the gestationalt-axis coordinate —gestationalAgeDays(postfertilization) andcarnegieStage. This is what makes a fetal.10da slice of a 4-D developmental body: consecutive stages, ordered by gestational age, are the same body along thet-axis (reproductive-continuum plan §2). Both are plainu64objects. - mesh_
to_ nquins_ with_ digests - Like
mesh_to_nquinsbut also asserts the immutablesourceDigestand the.10dcompiledDigest— the manifest→container join (geometry-asset-ontology §4). Both are CRC-32Cu32content hashes stored asu64objects:sourceDigestover the immutable source asset bytes,compiledDigestthe whole-file CRC of the.10dcontainer this manifest describes. - mesh_
to_ nquins_ with_ meta - Like
mesh_to_nquins_with_digestsbut also asserts the anatomy binding for a 3D-body organ:bodySystem(which of the 17 body systems this organ belongs to — which system’s burden colours it) andanatomyModel("male"/"female"— the reference model whose set it is part of, chosen from the user’s declared XY/XX chromosomal basis). Both are string facts carried in the lexicon, likesourceFormat; aNonefield is simply not asserted.