• Creates a new mesh object from the supplied vertex information and topology.

    Parameters

    • device: GraphicsDevice

      The graphics device used to manage the mesh.

    • positions: number[]

      An array of 3-dimensional vertex positions.

    • Optional opts: {
          blendIndices: number[];
          blendWeights: number[];
          colors: number[];
          indices: number[];
          normals: number[];
          tangents: number[];
          uvs: number[];
          uvs1: number[];
      }

      An object that specifies optional inputs for the function as follows:

      • blendIndices: number[]

        An array of 4-dimensional bone indices where each component is an integer in the range 0 to 255.

      • blendWeights: number[]

        An array of 4-dimensional bone weights where each component is in the range 0 to 1 and the sum of the weights should equal 1.

      • colors: number[]

        An array of 4-dimensional vertex colors where each component is an integer in the range 0 to 255.

      • indices: number[]

        An array of triangle indices.

      • normals: number[]

        An array of 3-dimensional vertex normals.

      • tangents: number[]

        An array of 3-dimensional vertex tangents.

      • uvs: number[]

        An array of 2-dimensional vertex texture coordinates.

      • uvs1: number[]

        Same as opts.uvs, but for additional UV set

    Returns Mesh

    A new Mesh constructed from the supplied vertex and triangle data.

    Example

    // Create a simple, indexed triangle (with texture coordinates and vertex normals)
    const mesh = pc.createMesh(graphicsDevice, [0, 0, 0, 1, 0, 0, 0, 1, 0], {
    normals: [0, 0, 1, 0, 0, 1, 0, 0, 1],
    uvs: [0, 0, 1, 0, 0, 1],
    indices: [0, 1, 2]
    });