gpu-curtains
    Preparing search index...

    Class Mat4

    Basic 4x4 matrix class used for matrix calculations.

    Note that like three.js, the constructor and set method take arguments in row-major order, while internally they are stored in the elements array in column-major order.

    Index

    Constructors

    Properties

    type: string

    The type of the Mat4.

    elements: Float32Array

    Our matrix array.

    Methods

    • Sets the matrix from 16 numbers.

      Parameters

      • n11: number

        number

      • n12: number

        number

      • n13: number

        number

      • n14: number

        number

      • n21: number

        number

      • n22: number

        number

      • n23: number

        number

      • n24: number

        number

      • n31: number

        number

      • n32: number

        number

      • n33: number

        number

      • n34: number

        number

      • n41: number

        number

      • n42: number

        number

      • n43: number

        number

      • n44: number

        number

      Returns Mat4

      • This Mat4 after being set.
    • Sets the Mat4 values from an array.

      Parameters

      • array: number[] | Float32Array<ArrayBufferLike> = ...

        Array to use.

      • offset: number = 0

        Optional offset in the array to use.

      Returns Mat4

      • This Mat4 after being set.
    • Computes and returns the determinant of this Mat4. Based on the method outlined here.

      Returns number

      • The determinant.
    • Get the maximum scale of the Mat4 on all axes.

      Returns number

      • Maximum scale of the Mat4.
    • Compute a view Mat4 matrix.

      This is a view matrix which transforms all other objects to be in the space of the view defined by the parameters.

      Equivalent to matrix.lookAt(eye, target, up).invert() but faster.

      Parameters

      • eye: Vec3 = ...

        The position of the object.

      • target: Vec3 = ...

        The position meant to be aimed at.

      • up: Vec3 = ...

        A vector pointing up.

      Returns Mat4

      • The view Mat4 matrix.
    • Create a perspective Mat4 matrix based on the parameters.

      Note, The matrix generated sends the viewing frustum to the unit box. We assume a unit box extending from -1 to 1 in the x and y dimensions and from -1 to 1 in the z dimension, as three.js and more generally WebGL handles it.

      Parameters

      Returns Mat4

      • The camera perspective Mat4 matrix.