Interface XGFData_v1Internal

The elements of a XGF v1.0 file, unpacked into a set of arrays for parsing.

This interface represents the structure of the XGF v1.0 file format. Although this interface is used internally, we include it in the API documentation so that it can also serve as a reference to the file format.

interface XGFData_v1 {
    aabbs: Float32Array<any>;
    colors: Uint8Array<any>;
    eachGeometryAABBBase: Uint32Array<any>;
    eachGeometryColorsBase: Uint32Array<any>;
    eachGeometryEdgeIndicesBase: Uint32Array<any>;
    eachGeometryIndicesBase: Uint32Array<any>;
    eachGeometryPositionsBase: Uint32Array<any>;
    eachGeometryPrimitiveType: Uint8Array<any>;
    eachMeshGeometriesBase: Uint32Array<any>;
    eachMeshMaterialAttributes: Uint8Array<any>;
    eachMeshMatricesBase: Uint32Array<any>;
    eachObjectId: string[];
    eachObjectMeshesBase: Uint32Array<any>;
    edgeIndices: Uint32Array<any>;
    indices: Uint32Array<any>;
    matrices: Float64Array<any>;
    positions: Uint16Array<any>;
}

Properties

aabbs: Float32Array<any>

Flat array containing 3D axis-aligned boundary (AABB) of each geometry's vertex positions.

Each AABB is the double-precision axis-aligned 3D boundary of its geometry's 3D vertex positions in XGFData_v1.positions.

Each AABB has the layout [minX, minY, minZ, maxX, maxY, maxZ].

To decompress a quantized vertex pUint (unsigned 16-bit integers) to get pDouble (64-bit floats), we do this:

pDouble[0] = (pUint[0] * (maxX - minX) / 65535) + minX
pDouble[1] = (pUint[1] * (maxY - minY) / 65535) + minY
pDouble[2] = (pUint[2] * (maxZ - minZ) / 65535) + minZ

Multiple geometries can share the same AABB, in which case they will have the same pointer to the start of their portion in XGFData_v1.aabbs.

colors: Uint8Array<any>

Flat array containing all RGBA geometry vertex colors.

Each element is in range [0..255].

eachGeometryAABBBase: Uint32Array<any>

For each geometry, a pointer to the start of its portion in XGFData_v1.aabbs.

Each portion is six elements of XGFData_v1.aabbs, containing [minX, minY, minZ, maxX, maxY, maxZ].

Each AABB is the boundary of the geometry's unquantized, double-precision vertex positions, which is used in the Viewer to decompress them from 16-bit integers to double-precision floats.

Multiple geometries can share the same AABB, in which case they will have the same pointer to the start of their portion in XGFData_v1.aabbs.

eachGeometryColorsBase: Uint32Array<any>

For each geometry, a pointer to the start of its portion in XGFData_v1.colors.

eachGeometryEdgeIndicesBase: Uint32Array<any>

For each geometry, a pointer to the start of its portion in XGFData_v1.edgeIndices.

eachGeometryIndicesBase: Uint32Array<any>

For each geometry, a pointer to the start of its portion in XGFData_v1.indices.

eachGeometryPositionsBase: Uint32Array<any>

For each geometry, a pointer to the start of its portion in XGFData_v1.positions.

eachGeometryPrimitiveType: Uint8Array<any>

For each geometry, the primitive type.

Supported types are:

  • 0: Triangle mesh (same as 2)
  • 1: Solid, closed triangle mesh
  • 2: Triangle surface (same as 0)
  • 3: Lines
  • 4: Points
eachMeshGeometriesBase: Uint32Array<any>

For each mesh, a pointer to the start of its portion in XGFData_v1.eachGeometryPositionsBase, XGFData_v1.eachGeometryColorsBase, XGFData_v1.eachGeometryIndicesBase and XGFData_v1.eachGeometryEdgeIndicesBase.

Multiple meshes can share the same geometry, in which case they will have the same pointer to the start of their portion in the eachGeometry* arrays.

eachMeshMaterialAttributes: Uint8Array<any>

Flat array containing four material attributes for each mesh.

The attributes for each mesh are:

  • Color R [0..255]
  • Color G [0..255]
  • Color B [0..255]
  • Opacity [0..255]

Each set of attributes belongs exclusively to a single mesh, and is not shared between meshes.

eachMeshMatricesBase: Uint32Array<any>

For each mesh, a pointer to its matrix in XGFData_v1.matrices.

Each portion is sixteen elements, comprising a 4x4 matrix.

Multiple meshes can share the same matrix, in which case they will have the same pointer to the start of their portion in XGFData_v1.matrices.

eachObjectId: string[]

For each object, a unique string ID.

eachObjectMeshesBase: Uint32Array<any>

For each object, a pointer to its first mesh in XGFData_v1.eachMeshGeometriesBase, XGFData_v1.eachMeshMatricesBase and XGFData_v1.eachMeshMaterialAttributes.

Each mesh belongs to exactly one object. Meshes that belong to the same object are stored in contiguous runs in the eachMesh* arrays, and the start of each run is indicated by this array. The end of each run is indicated by the next element in this array, or the end of the eachMesh* arrays for the last object.

edgeIndices: Uint32Array<any>

Flat array cotaining all 32-bit geometry edge indices.

indices: Uint32Array<any>

Flat array containing all 32-bit geometry indices.

matrices: Float64Array<any>

Flat array containing all modeling transform matrices.

Each matrix has sixteen elements. These are 64-bit precision, and may contain huge full-precision translations that are absolute and relative to the World-space origin.

Multiple meshes can share the same matrix, in which case they will have the same pointer to the start of their portion in XGFData_v1.matrices.

positions: Uint16Array<any>

Flat array containing all quantized 3D geometry vertex positions.

These positions are quantized to 16-bit unsigned integers.