Class Mesh3

The base class for 3D triangle meshes. This class extends Node3 so it can be added directly to the GopherGfx 3D scene graph. It is possible to create a new "empty" Mesh3 and then add triangles to it. Most of the routines in the Geometry3Factory do this. Use those to create a new Mesh3 for simple geometric shapes like spheres, cubes, etc. Those routines also provide good examples of how to create your own custom mesh via code if you wish to create something more complex via programming. Triangle meshes can also be loaded from a variety of 3D file formats using the MeshLoader class.

Hierarchy

Constructors

Properties

_localBoundingBox: BoundingBox3

Bounding box in this transform's local coordinate space

_localBoundingSphere: BoundingSphere

Bounding circle in this transform's local coordinate space

_position: Vector3

The position of this node as a Vector3.

_rotation: Quaternion

The rotation of this transform represented as a quaternion.

_scale: Vector3

The scale of this node as a Vector3.

_worldBoundingBox: BoundingBox3

Bounding box in the world coordinate space

_worldBoundingSphere: BoundingSphere

Bounding box in the world coordinate space

boundingBox: BoundingBox3

The bounding box in vertex coordinate space

boundingSphere: BoundingSphere

The bounding sphere in vertex coordinate space

children: Node3[]
colorBuffer: null | WebGLBuffer
colorCache: null | number[]
gl: WebGL2RenderingContext
hasVertexColors: boolean

Flag that determines whether to use vertex colors.

indexBuffer: null | WebGLBuffer
indexCache: null | number[]
localBoundsDirty: boolean
localMatrixDirty: boolean
localMatrixNegScale: boolean
localMatrixUpdated: boolean
localToParentMatrix: Matrix4

The local transformation matrix of this node.

localToWorldMatrix: Matrix4

The world transformation matrix of this node.

material: Material3
normalBuffer: null | WebGLBuffer
normalCache: null | number[]
parent: null | Node3

The parent transform of this transform. Null if this transform has no parent.

positionBuffer: null | WebGLBuffer
positionCache: null | number[]
texCoordBuffer: null | WebGLBuffer
texCoordCache: null | number[]
triangleCount: number
vertexCount: number
visible: boolean

Whether this transform is currently visible in the scene.

worldBoundsDirty: boolean
worldMatrixDirty: boolean

Accessors

Methods

  • Parameters

    • buffer: null | WebGLBuffer

    Returns number[]

  • Checks for intersection between this Node3 and another

    Returns

    Whether or not the two objects intersect

    Parameters

    • other: Node3

      The other Node3 object

    • mode: IntersectionMode3 = IntersectionMode3.BOUNDING_SPHERE

      The IntersectionMode3 to use for the comparison (default: BOUNDING_SPHERE)

    • space: CoordinateSpace3 = CoordinateSpace3.LOCAL_SPACE

      The CoordinateSpace3 to use for the comparison (default: LOCAL_SPACE)

    Returns boolean

  • Rotates this Node3 object to look at the given target with the given up vector

    Parameters

    • target: Vector3

      The Vector3 representing the target in world space

    • up: Vector3 = Vector3.UP

      The Vector3 representing the up direction (defaults to Vector3.UP)

    • coordinateSpace: CoordinateSpace3 = CoordinateSpace3.LOCAL_SPACE

    Returns void

  • Removes the current Node3 from its parent Node3

    Returns

    true if the Node3 was successfully removed, false otherwise

    Returns boolean

  • Parameters

    • values: number[] | Vector3[]
    • buffer: null | WebGLBuffer
    • dynamicDraw: boolean = false

    Returns void

  • Parameters

    • colors: number[] | Float32Array | Color[]
    • dynamicDraw: boolean = false

    Returns void

  • Parameters

    • indices: number[] | Uint16Array | Vector3[]
    • dynamicDraw: boolean = false

    Returns void

  • Parameters

    • normals: number[] | Float32Array | Vector3[]
    • dynamicDraw: boolean = false

    Returns void

  • Parameters

    • texCoords: number[] | Float32Array | Vector2[]
    • dynamicDraw: boolean = false

    Returns void

  • Parameters

    • vertices: number[] | Float32Array | Vector3[]
    • dynamicDraw: boolean = false

    Returns void

  • Traverses the scene graph starting from this Node3 object and updates the world matrices of all Node3 objects in the graph.

    Parameters

    • parentMatrixDirty: boolean = false

    Returns void

  • Updates the world matrix of this Node3 by computing the multiplication of its local matrix with its parent's world matrix (if it has a parent).

    Returns

    void

    Returns void

Generated using TypeDoc