/** * `.holo` mesh-geometry codec — the SERIALIZATION half of Track 0. * * The in-memory mesh IR ({@link SkinnedMeshData}, draw-spec.ts) already exists and * `extractGltfSkinnedMesh` produces it from a real GLB — but a `.holo` file still * can only point at external geometry (`gltf-importer.ts` emits * `geometry: "file#Node"`). This codec lets a `.holo` composition CARRY the real * mesh: it serializes a `SkinnedMeshData` to/from a compact base64 block so the * surface survives a round-trip (import → `.holo` → parse → compile) byte-exact, * instead of degrading to a text pointer. * * Buffers are base64 over the raw little-endian bytes (the same convention as * `HolomapPointCloudPayload`). Encoding is symmetric, so the round-trip is * byte-exact on any single runtime. Web-safe (btoa/atob, no Node `Buffer`) — * engine renders in-browser. * * @package @holoscript/engine/native-render */ import type { SkinnedMeshData } from './draw-spec'; /** * A real imported triangle mesh, embeddable in `.holo` text. Positions/normals/ * tangents/uvs are Float32; indices/jointIndices are Uint32; all base64 LE. */ export interface HoloMeshGeometry { /** base64 LE Float32, 3 floats/vertex. */ positionsB64: string; /** base64 LE Float32, 3 floats/vertex. */ normalsB64: string; /** base64 LE Float32, 4 floats/vertex (Kajiya-Kay strand tangent + strandT). */ tangentsB64: string; /** base64 LE Float32, 2 floats/vertex (glTF TEXCOORD_0). Omitted when the source has no UVs. */ uvsB64?: string; /** base64 LE Uint32 triangle indices. */ indicesB64: string; /** base64 LE Uint32, 4 palette joint indices/vertex. */ jointIndicesB64: string; /** base64 LE Float32, 4 skin weights/vertex. */ jointWeightsB64: string; /** base64 LE Float32, `jointCount` × 16 column-major inverse-bind matrices. Carries the RIG * so a carried mesh can be re-emitted WITH a glTF skin (joints + JOINTS_0/WEIGHTS_0 + IBM); * omitted for an unskinned mesh, in which case export degrades to geometry-only. */ inverseBindMatricesB64?: string; /** Palette joint count the inverse-binds + joint indices index into (present iff IBM is). */ jointCount?: number; vertexCount: number; } /** * A decoded mesh plus — when the `.holo` block carried a rig — the inverse-bind matrices and * palette joint count needed to re-emit a glTF skin. The base {@link SkinnedMeshData} has no * rig fields, so the exporter reads these to decide skin-vs-geometry-only re-emit. */ export interface DecodedHoloMesh extends SkinnedMeshData { inverseBindMatrices?: Float32Array; jointCount?: number; } /** * Serialize an in-memory mesh to a `.holo`-carriable block. Accepts the base * {@link SkinnedMeshData} and, optionally, the rig ({@link GltfSkinnedMesh} satisfies this) — * when `inverseBindMatrices` + `jointCount` are present they are carried so the mesh can later * be re-emitted WITH a glTF skin instead of degrading to geometry-only. */ export declare function encodeSkinnedMeshToHolo(mesh: SkinnedMeshData & { inverseBindMatrices?: Float32Array; jointCount?: number; }): HoloMeshGeometry; /** Decode a `.holo` mesh block back to an in-memory mesh, surfacing the rig when carried. */ export declare function decodeSkinnedMeshFromHolo(geo: HoloMeshGeometry): DecodedHoloMesh; //# sourceMappingURL=HoloMeshGeometry.d.ts.map