omega-game-engine
    Preparing search index...

    Class MeshData

    Base class for geometric mesh data. It stores vertex positions, normals, and UV coordinates, along with optional tangent and bitangent vectors for normal mapping. *

    Hierarchy (View Summary)

    Implements

    Indexable

    • [key: string]: any
    Index

    Constructors

    • Creates an instance of MeshData. *

      Parameters

      • vertices: vec3[]

        The array of vertex positions. *

      • Optionalnormals: vec3[] = []

        The array of vertex normals. *

      • Optionaluvs: vec2[] = []

        The array of texture coordinates. *

      • Optionalindices: number[] = []

        The array of vertex indices.

      Returns MeshData

    Properties

    _className: string
    _serializationIgnoreKeys: string[]
    _uuid: string
    bitangents?: vec3[]

    The array of bitangent vectors. *

    indices: number[]

    The array of vertex indices. *

    name: string = ''
    normals: vec3[]

    The array of vertex normals. *

    tangents?: vec3[]

    The array of tangent vectors. *

    uvs: vec2[]

    The array of texture coordinates. *

    vertices: vec3[]

    The array of vertex positions. *

    Accessors

    • get className(): string

      Returns string

    Methods

    • Calculates smooth normals and generates indices for the mesh based on its vertices.

      • It computes face normals and then averages them for vertex normals to create a smooth appearance.
      • The calculated normals and indices are stored directly in this.normals and this.indices.

      Returns void

    • Calculates tangents and bitangents for the mesh and populates the instance's arrays.

      • This method should be called after the mesh's vertices, normals, UVs, and indices are set.

      Returns void

    • Inverts the direction of all normal vectors in the mesh.

      • This is useful for flipping faces or correcting normal orientations.

      Returns void

    • Calculates the bounding box for this mesh using its internal vertices.

      Parameters

      • vertices: vec3[]

      Returns null | BoundingBox

      A BoundingBox object, or null if the mesh has no vertices.

    • Calculates a bounding sphere for this mesh using its internal vertices. The sphere's center is the mesh's centroid.

      Parameters

      • vertices: vec3[]

      Returns null | BoundingSphere

      A BoundingSphere object, or null if the mesh has no vertices.

    • Creates a new MeshData instance.

      Parameters

      • Optionalvertices: vec3[]

        The array of vertex positions. *

      • Optionalnormals: vec3[] = []

        The array of vertex normals. *

      • Optionaluvs: vec2[] = []

        The array of texture coordinates. *

      • Optionalindices: number[] = []

        The array of vertex indices. *

      Returns MeshData

      • A new MeshData instance.