Class ModelMesh

Create a model from an array of information such as vertices, indices, normal vectors, etc.

Hierarchy

Constructors

Properties

_accessible: boolean = true

Availability of the model.

_elementCount: number = 0

A vertex has several elements, xyz is 3.

_glIndexByteCount: number

Each index occupies several bytes, 8 bits per byte.

_glIndexType: number

The storage type of the index, for example: UInt8.

_indexBufferBinding: IndexBufferBinding = null

The index buffer corresponding to the mesh

_indices: Uint8Array | Uint16Array | Uint32Array = null

Index type array.

_indicesFormat: IndexFormat = null

Index format.

_instanceCount: number = 0

A Mesh may consist of multiple vertex instances.

_lastUploadVertexCount: number = -1
_normals: Vector3[] = null

Array of normal vectors.

_platformPrimitive: Renderer

A platform that provides rendering capabilities.

_positions: Vector3[] = []

Array of vertex positions.

_uv: Vector2[] = null

Array of texture coordinates

_vertexBufferBindings: VertexBufferBinding[] = []

The vertex buffer corresponding to the mesh.

_vertexCount: number = 0

The number of vertices in the model.

_vertexElementMap: Record<string, VertexElement> = {}

Vertex entity record table, used for caching.

_vertexElements: VertexElement[] = []

Array of vertex elements.

_verticesFloat32: Float32Array = null
_verticesUint8: Uint8Array = null
gl: WebGLRenderingContext
name: string

Name.

Accessors

  • get subMeshes(): readonly SubMesh[]
  • A collection of sub-mesh, each sub-mesh can be rendered with an independent material.

    Returns readonly SubMesh[]

Methods

  • Vertex elements are composed of vertex coordinates, texture coordinates, normal vectors and other information.

    Returns void

  • Fill the void Float32Array with postion, normal and uvs.

    Parameters

    • vertices: Float32Array

      void Float32Array

    Returns void

  • Add sub-mesh, each sub-mesh can correspond to an independent material.

    Returns

    Sub-mesh

    Parameters

    • subMesh: SubMesh

      Start drawing offset, if the index buffer is set, it means the offset in the index buffer, if not set, it means the offset in the vertex buffer

    Returns SubMesh

  • Add sub-mesh, each sub-mesh can correspond to an independent material.

    Returns

    Sub-mesh

    Parameters

    • start: number

      Start drawing offset, if the index buffer is set, it means the offset in the index buffer, if not set, it means the offset in the vertex buffer

    • count: number

      Drawing count, if the index buffer is set, it means the count in the index buffer, if not set, it means the count in the vertex buffer

    • Optional topology: MeshTopology

      Drawing topology, default is MeshTopology.Triangles

    Returns SubMesh

  • Get indices for the mesh.

    Returns Uint8Array | Uint16Array | Uint32Array

  • Set indices for the mesh.

    Parameters

    • indices: Uint8Array | Uint16Array | Uint32Array

      The indices for the mesh.

    Returns void

  • Set the vertex position information of the model.

    Parameters

    • positions: Vector3[]

      Array of model vertex coordinates.

    Returns void

  • Upload Mesh Data to the graphics API.

    Parameters

    • noLongerAccessible: boolean = true

    Returns void

Generated using TypeDoc