import { Accessor , ExtensionProperty , IProperty , Nullable , PropertyType } from '@gltf-transform/core' ; import { EXT_MESH_GPU_INSTANCING } from '../constants' ; interface IInstancedMesh extends IProperty { attributes : { [ key ] : Accessor ; } ; } export const INSTANCE_ATTRIBUTE = 'INSTANCE_ATTRIBUTE' ; /**
 * # InstancedMesh
 *
 * Defines GPU instances of a  Mesh under one  Node . See  MeshGPUInstancing .
  export class InstancedMesh extends ExtensionProperty < IInstancedMesh > { public static EXTENSION_NAME = EXT_MESH_GPU_INSTANCING ; public declare extensionName : typeof EXT_MESH_GPU_INSTANCING ; public declare propertyType : 'InstancedMesh' ; public declare parentTypes : [ PropertyType . NODE ] ; protected init ( ) { this . extensionName = EXT_MESH_GPU_INSTANCING ; this . propertyType = 'InstancedMesh' ; this . parentTypes = [ PropertyType . NODE ] ; } protected getDefaults ( ) { return Object . assign ( super . getDefaults ( ) as IProperty , { attributes : { } } ) ; } /** Returns an instance attribute as an  Accessor .  public getAttribute ( semantic ) { return this . getRefMap ( 'attributes' , semantic ) ; } /**
     * Sets an instance attribute to an  Accessor . All attributes must have the same
     * instance count.
      public setAttribute ( semantic , accessor ) { return this . setRefMap ( 'attributes' , semantic , accessor , { usage : INSTANCE_ATTRIBUTE } ) ; } /**
     * Lists all instance attributes  Accessor s associated with the InstancedMesh. Order
     * will be consistent with the order returned by  {@link .listSemantics} ().
      public listAttributes ( ) { return this . listRefMapValues ( 'attributes' ) ; } /**
     * Lists all instance attribute semantics associated with the primitive. Order will be
     * consistent with the order returned by  {@link .listAttributes} ().
      public listSemantics ( ) { return this . listRefMapKeys ( 'attributes' ) ; } }