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.
Re-exports§
pub use glb_skins_anims::matrix4_to_motor_and_scale;pub use glb_skins_anims::parse_glb_living_scene;pub use glb_skins_anims::GlbInterpolation;pub use glb_skins_anims::GlbLivingScene;pub use glb_skins_anims::GlbMorphWeightTrack;pub use glb_skins_anims::GlbNodeRecord;pub use glb_skins_anims::KhrMaterialExtensions;pub use glb_skins_anims::KhrPunctualLight;
Modules§
- glb_
skins_ anims - Rigid glTF 2.0 / GLB →
.10dLiving Container Compiler (SKL1,MRP1,PROC1,EONT1, KHR Material Extensions &KHR_lights_punctual).
Structs§
- Imported
Mesh - Mesh plus optional normal and tangent streams. Tangents may be authored or generated from TEXCOORD_0; importers without the required data leave a stream empty for renderer fallback.
- 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). - Texture
Dependency - Immutable image asset discovered while importing an embedded glTF image.
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_
asset_ with_ normals - Import a mesh and preserve authored normals when the source format provides them. Missing normals in individual primitives are generated from the primitive’s triangle geometry.
- import_
glb - Parse a binary glTF (
.glb): the 12-byte header, JSON chunk, and BIN chunk, then walkmeshes[].primitives[], readingPOSITION(FLOAT VEC3), optionalNORMAL(FLOAT VEC3), optionalTANGENT(FLOAT VEC4), optionalTEXCOORD_0VEC2, and optional index accessors (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_
glb_ static_ scene - Import the selected static scene, baking each node instance and its frames. The caller supplies hard output limits before instances are expanded.
- import_
glb_ with_ normals - GLB importer variant that retains NORMAL VEC3 and TANGENT VEC4 attributes, generates fallback normals where needed, and uses MikkTSpace with deterministic corner splitting when UV0 is available but authored tangents are absent. Authored tangent directions are orthogonalized before returning GPU streams.
- 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.