API

Interface IGetSetVerticesData

Define an interface for all classes that will get and set the data on vertices

interface IGetSetVerticesData {
    getIndices(
        copyWhenShared?: boolean,
        forceCopy?: boolean,
    ): Nullable<IndicesArray>;
    getVerticesData(
        kind: string,
        copyWhenShared?: boolean,
        forceCopy?: boolean,
    ): Nullable<FloatArray>;
    isVerticesDataPresent(kind: string): boolean;
    setIndices(
        indices: IndicesArray,
        totalVertices: Nullable<number>,
        updatable?: boolean,
    ): void;
    setVerticesData(
        kind: string,
        data: FloatArray,
        updatable: boolean,
        stride?: number,
    ): void;
    updateVerticesData(
        kind: string,
        data: FloatArray,
        updateExtends?: boolean,
        makeItUnique?: boolean,
    ): void;
}

Implemented by

Index
  • Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.

    Parameters

    • OptionalcopyWhenShared: boolean

      If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.

    • OptionalforceCopy: boolean

      defines a boolean indicating that the returned array must be cloned upon returning it

    Returns Nullable<IndicesArray>

    the indices array or an empty array if the mesh has no geometry

  • Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.

    Parameters

    • kind: string

      defines the data kind (Position, normal, etc...)

    • OptionalcopyWhenShared: boolean

      defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes

    • OptionalforceCopy: boolean

      defines a boolean indicating that the returned array must be cloned upon returning it

    Returns Nullable<FloatArray>

    a float array containing vertex data

  • Gets a boolean indicating if specific vertex data is present

    Parameters

    • kind: string

      defines the vertex data kind to use

    Returns boolean

    true is data kind is present

  • Creates a new index buffer

    Parameters

    • indices: IndicesArray

      defines the indices to store in the index buffer

    • totalVertices: Nullable<number>

      defines the total number of vertices (could be null)

    • Optionalupdatable: boolean

      defines if the index buffer must be flagged as updatable (false by default)

    Returns void

  • Set specific vertex data

    Parameters

    • kind: string

      defines the data kind (Position, normal, etc...)

    • data: FloatArray

      defines the vertex data to use

    • updatable: boolean

      defines if the vertex must be flagged as updatable (false as default)

    • Optionalstride: number

      defines the stride to use (0 by default). This value is deduced from the kind value if not specified

    Returns void

  • Update a specific associated vertex buffer

    Parameters

    • kind: string

      defines which buffer to write to (positions, indices, normals, etc). Possible kind values :

      • VertexBuffer.PositionKind
      • VertexBuffer.UVKind
      • VertexBuffer.UV2Kind
      • VertexBuffer.UV3Kind
      • VertexBuffer.UV4Kind
      • VertexBuffer.UV5Kind
      • VertexBuffer.UV6Kind
      • VertexBuffer.ColorKind
      • VertexBuffer.MatricesIndicesKind
      • VertexBuffer.MatricesIndicesExtraKind
      • VertexBuffer.MatricesWeightsKind
      • VertexBuffer.MatricesWeightsExtraKind
    • data: FloatArray

      defines the data source

    • OptionalupdateExtends: boolean

      defines if extends info of the mesh must be updated (can be null). This is mostly useful for "position" kind

    • OptionalmakeItUnique: boolean

      defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)

    Returns void