Interface XGFData_v2Internal

XGF v2 file-format payload — extends v1 with PBR materials, textures, per-geometry normals and per-geometry UVs.

Pack order in the binary form is the field-declaration order below; packXGF and unpackXGF read/write it positionally.

interface XGFData_v2 {
    aabbs: Float32Array<any>;
    colors: Uint8Array<any>;
    eachGeometryAABBBase: Uint32Array<any>;
    eachGeometryColorsBase: Uint32Array<any>;
    eachGeometryEdgeIndicesBase: Uint32Array<any>;
    eachGeometryIndicesBase: Uint32Array<any>;
    eachGeometryNormalsBase: Uint32Array<any>;
    eachGeometryPositionsBase: Uint32Array<any>;
    eachGeometryPrimitiveType: Uint8Array<any>;
    eachGeometryUVsBase: Uint32Array<any>;
    eachMaterialId: string[];
    eachMaterialPBR: Uint8Array<any>;
    eachMaterialTextures: Int32Array<any>;
    eachMeshGeometriesBase: Uint32Array<any>;
    eachMeshMaterial: Int32Array<any>;
    eachMeshMaterialAttributes: Uint8Array<any>;
    eachMeshMatricesBase: Uint32Array<any>;
    eachObjectId: string[];
    eachObjectMeshesBase: Uint32Array<any>;
    eachTextureDataBase: Uint32Array<any>;
    eachTextureHeight: Uint16Array<any>;
    eachTextureId: string[];
    eachTextureMediaType: Uint8Array<any>;
    eachTextureSampler: Uint8Array<any>;
    eachTextureWidth: Uint16Array<any>;
    edgeIndices: Uint32Array<any>;
    indices: Uint32Array<any>;
    matrices: Float64Array<any>;
    normals: Uint16Array<any>;
    positions: Uint16Array<any>;
    textureData: Uint8Array<any>;
    uvs: Float32Array<any>;
}

Properties

aabbs: Float32Array<any>

Geometry AABBs (six floats each: minX, minY, minZ, maxX, maxY, maxZ).

colors: Uint8Array<any>

Vertex RGBA colours (Uint8 × 4 per vertex).

eachGeometryAABBBase: Uint32Array<any>

Per-geometry base into aabbs (six floats).

eachGeometryColorsBase: Uint32Array<any>
eachGeometryEdgeIndicesBase: Uint32Array<any>
eachGeometryIndicesBase: Uint32Array<any>
eachGeometryNormalsBase: Uint32Array<any>

Per-geometry base into normals. 0xffffffff (UINT32_MAX) indicates the geometry has no normals.

eachGeometryPositionsBase: Uint32Array<any>
eachGeometryPrimitiveType: Uint8Array<any>

Per-geometry primitive type: 0 — TrianglesPrimitive 1 — SolidPrimitive 2 — SurfacePrimitive 3 — LinesPrimitive 4 — PointsPrimitive

eachGeometryUVsBase: Uint32Array<any>

Per-geometry base into uvs. 0xffffffff indicates the geometry has no UVs.

eachMaterialId: string[]

Per-material string ID.

eachMaterialPBR: Uint8Array<any>

Per-material PBR + alpha attributes, eight bytes each (in order): color R, color G, color B, opacity, roughness, metallic, alphaMode (0=OPAQUE, 1=MASK, 2=BLEND), alphaCutoff

All values quantised to [0, 255] from [0, 1].

eachMaterialTextures: Int32Array<any>

Per-material texture references, five Int32 entries each (in order): colorTextureIndex, metallicRoughnessTextureIndex, normalsTextureIndex, occlusionTextureIndex, emissiveTextureIndex

Each entry is a 0-based index into the texture array, or -1 to indicate "no texture".

eachMeshGeometriesBase: Uint32Array<any>
eachMeshMaterial: Int32Array<any>

Per-mesh material reference: index into the material array, or -1 to fall back to eachMeshMaterialAttributes.

eachMeshMaterialAttributes: Uint8Array<any>

Per-mesh inline RGBA colour fallback (4 bytes/mesh: R, G, B, opacity). Used when eachMeshMaterial for that mesh is -1 — i.e. the mesh has no material reference and renders as a flat colour.

eachMeshMatricesBase: Uint32Array<any>
eachObjectId: string[]
eachObjectMeshesBase: Uint32Array<any>
eachTextureDataBase: Uint32Array<any>

Per-texture base into textureData.

eachTextureHeight: Uint16Array<any>

Per-texture pixel height.

eachTextureId: string[]

Per-texture string ID.

eachTextureMediaType: Uint8Array<any>

Per-texture media type, matching PNGMediaType etc. Stored as a small integer: 0 — PNG 1 — JPEG 2 — GIF 255 — opaque transcoded buffer (treat as raw bytes; not decoded at load time)

eachTextureSampler: Uint8Array<any>

Per-texture sampler params, five bytes each (in order): minFilter, magFilter, wrapS, wrapT, wrapR

Each is the small-integer code from constants: 1 — RepeatWrapping 2 — ClampToEdgeWrapping 3 — MirroredRepeatWrapping 4 — NearestFilter 5 — LinearFilter 6 — NearestMipMapNearestFilter 7 — LinearMipMapNearestFilter 8 — NearestMipMapLinearFilter 9 — LinearMipMapLinearFilter

eachTextureWidth: Uint16Array<any>

Per-texture pixel width.

edgeIndices: Uint32Array<any>

32-bit edge-line indices.

indices: Uint32Array<any>

32-bit triangle / line indices.

matrices: Float64Array<any>
normals: Uint16Array<any>

Octahedral RG16UI vertex normals — one (x, y) pair per vertex. Geometries that don't carry normals occupy zero range.

positions: Uint16Array<any>

Quantised vertex positions (RGB16UI per vertex × 3).

textureData: Uint8Array<any>

Concatenated encoded image bytes for every texture in the model (typically PNG / JPEG / GIF). The eachTextureMediaType and eachTextureDataBase arrays describe how to slice and decode.

uvs: Float32Array<any>

RG32F vertex UVs — one (u, v) pair per vertex. Floats (not quantised) so tiling values outside [0, 1] round-trip through the file intact, mirroring the runtime VertexUVTexture format.