Provides access to EXT_structural_metadata property tables, property textures, and
property attributes for a GLTF scene or primitive. Instances are created by
GLTFStructuralMetadataExtension and attached to scene.userData.structuralMetadata
and mesh.userData.structuralMetadata.
On this page
Methods
new StructuralMetadata(
// The root `EXT_structural_metadata` extension object.
definition: Object,
// Loaded GLTF textures referenced by property textures.
textures: Array<Texture>,
// Loaded GLTF buffer views referenced by property tables.
buffers: Array<ArrayBuffer>,
// Per-primitive metadata indices (property texture / attribute refs).
nodeMetadata: Object | null = null,
// The three.js object associated with `nodeMetadata`.
object: Object3D | null = null
)getPropertyTableData(
// Table index or array of table indices.
tableIndices: number | Array<number>,
// Row ID or array of row IDs.
ids: number | Array<number>,
// Optional target object or array to write into.
target: Object | Array | null = null
): Object | ArrayReturns data from one or more property tables. Pass a single table index and row ID to get one object, or parallel arrays of table indices and row IDs to get an array of results. Each returned object conforms to the structure class referenced in the schema.
getPropertyTableInfo(
tableIndices: Array<number> | null = null
): Array<{name: string, className: string}> | ObjectReturns name and class information for one or more property tables. Defaults to all
tables when tableIndices is null.
getPropertyTextureData(
// Triangle index from a raycast hit.
triangle: number,
// Barycentric coordinate of the hit point.
barycoord: Vector3,
// Optional target array to write into.
target: Array = []
): ArrayReturns data from property textures at the given point on the mesh. Takes the triangle
index and barycentric coordinate from a raycast result. See MeshFeatures.getFeatures
for how to obtain these values.
async getPropertyTextureDataAsync(
// Triangle index from a raycast hit.
triangle: number,
// Barycentric coordinate of the hit point.
barycoord: Vector3,
// Optional target array to write into.
target: Array = []
): ArrayReturns the same data as getPropertyTextureData but performs texture reads
asynchronously.
getPropertyTextureInfo(): Array<{name: string, className: string, properties: Object}>Returns information about the property texture accessors, including their class names and per-property channel/texcoord mappings.
getPropertyAttributeData(
// Vertex index.
attributeIndex: number,
// Optional target array to write into.
target: Array = []
): ArrayReturns data stored as property attributes for the given vertex index.
getPropertyAttributeInfo(): Array<{name: string, className: string}>Returns name and class information for all property attribute accessors.
dispose(): voidDisposes all texture, table, and attribute accessors.