• Mat4 类型
    • 索引
      • 方法
  • Details
    • 方法
      • constructor
        • 参数列表
      • clone
      • set
        • 参数列表
      • equals
        • 参数列表
      • fuzzyEquals
        • 参数列表
      • toString
      • identity
      • transpose
        • 参数列表
      • invert
        • 参数列表
      • adjoint
        • 参数列表
      • determinant
      • add
        • 参数列表
      • sub
        • 参数列表
      • mul
        • 参数列表
      • mulScalar
        • 参数列表
      • translate
        • 参数列表
      • scale
        • 参数列表
      • rotate
        • 参数列表
      • getTranslation
        • 参数列表
      • getScale
        • 参数列表
      • getRotation
        • 参数列表
      • fromRTS
        • 参数列表
      • fromQuat
        • 参数列表
      • mat4
        • 参数列表
      • lerp
        • 参数列表

    Mat4 类型

    继承于 ValueType

    模块: cc父模块: cc

    表示 4*4 矩阵

    索引

    方法
    • constructor 构造函数,可查看 cc.mat4
    • clone 克隆一个 Mat4 对象
    • set 用另一个矩阵设置这个矩阵的值。
    • equals 当前的矩阵是否与指定的矩阵相等。
    • fuzzyEquals 近似判断两个矩阵是否相等。
    • toString 转换为方便阅读的字符串。
    • identity Set the matrix to the identity matrix
    • transpose Transpose the values of a mat4
    • invert Inverts a mat4
    • adjoint Calculates the adjugate of a mat4
    • determinant Calculates the determinant of a mat4
    • add Adds two Mat4
    • sub Subtracts the current matrix with another one
    • mul Subtracts the current matrix with another one
    • mulScalar Multiply each element of the matrix by a scalar.
    • translate Translate a mat4 by the given vector
    • scale Scales the mat4 by the dimensions in the given vec3
    • rotate Rotates a mat4 by the given angle around the given axis
    • getTranslation Returns the translation vector component of a transformation matrix.
    • getScale Returns the scale factor component of a transformation matrix
    • getRotation Returns the rotation factor component of a transformation matrix
    • fromRTS Restore the matrix values from a quaternion rotation, vector translation and vector scale
    • fromQuat Restore the matrix values from a quaternion rotation
    • mat4 通过该简便的函数进行创建 cc.Mat4 对象。
    • lerp 线性插值。

    Details

    方法

    constructor

    构造函数,可查看 cc.mat4

    metadescription
    定义于cocos2d/core/value-types/mat4.js:43
    参数列表
    • m00 Number Component in column 0, row 0 position (index 0)
    • m01 Number Component in column 0, row 1 position (index 1)
    • m02 Number Component in column 0, row 2 position (index 2)
    • m03 Number Component in column 0, row 3 position (index 3)
    • m10 Number Component in column 1, row 0 position (index 4)
    • m11 Number Component in column 1, row 1 position (index 5)
    • m12 Number Component in column 1, row 2 position (index 6)
    • m13 Number Component in column 1, row 3 position (index 7)
    • m20 Number Component in column 2, row 0 position (index 8)
    • m21 Number Component in column 2, row 1 position (index 9)
    • m22 Number Component in column 2, row 2 position (index 10)
    • m23 Number Component in column 2, row 3 position (index 11)
    • m30 Number Component in column 3, row 0 position (index 12)
    • m31 Number Component in column 3, row 1 position (index 13)
    • m32 Number Component in column 3, row 2 position (index 14)
    • m33 Number Component in column 3, row 3 position (index 15)
    clone

    克隆一个 Mat4 对象

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:95
    set

    用另一个矩阵设置这个矩阵的值。

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:110
    参数列表
    • srcObj Mat4
    equals

    当前的矩阵是否与指定的矩阵相等。

    metadescription
    返回Boolean
    定义于cocos2d/core/value-types/mat4.js:139
    参数列表
    • other Mat4
    fuzzyEquals

    近似判断两个矩阵是否相等。判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。

    metadescription
    返回Boolean
    定义于cocos2d/core/value-types/mat4.js:150
    参数列表
    • other Mat4
    toString

    转换为方便阅读的字符串。

    metadescription
    返回string
    定义于cocos2d/core/value-types/mat4.js:163
    identity

    Set the matrix to the identity matrix

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:180
    transpose

    Transpose the values of a mat4

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:190
    参数列表
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
    invert

    Inverts a mat4

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:201
    参数列表
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
    adjoint

    Calculates the adjugate of a mat4

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:212
    参数列表
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
    determinant

    Calculates the determinant of a mat4

    metadescription
    返回Number
    定义于cocos2d/core/value-types/mat4.js:223
    add

    Adds two Mat4

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:232
    参数列表
    • other Mat4 the second operand
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
    sub

    Subtracts the current matrix with another one

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:244
    参数列表
    • other Mat4 the second operand
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
    mul

    Subtracts the current matrix with another one

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:256
    参数列表
    • other Mat4 the second operand
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
    mulScalar

    Multiply each element of the matrix by a scalar.

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:268
    参数列表
    • number Number amount to scale the matrix's elements by
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
    translate

    Translate a mat4 by the given vector

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:280
    参数列表
    • v Vec3 vector to translate by
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
    scale

    Scales the mat4 by the dimensions in the given vec3

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:292
    参数列表
    • v Vec3 vector to scale by
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
    rotate

    Rotates a mat4 by the given angle around the given axis

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:304
    参数列表
    • rad Number the angle to rotate the matrix by
    • axis Vec3 the axis to rotate around
    • out Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
    getTranslation

    Returns the translation vector component of a transformation matrix.

    metadescription
    返回Vec3
    定义于cocos2d/core/value-types/mat4.js:317
    参数列表
    • out Vec3 Vector to receive translation component, if not provided, a new vec3 will be created
    getScale

    Returns the scale factor component of a transformation matrix

    metadescription
    返回Vec3
    定义于cocos2d/core/value-types/mat4.js:328
    参数列表
    • out Vec3 Vector to receive scale component, if not provided, a new vec3 will be created
    getRotation

    Returns the rotation factor component of a transformation matrix

    metadescription
    返回Quat
    定义于cocos2d/core/value-types/mat4.js:339
    参数列表
    • out Quat Vector to receive rotation component, if not provided, a new quaternion object will be created
    fromRTS

    Restore the matrix values from a quaternion rotation, vector translation and vector scale

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:350
    参数列表
    • q Quat Rotation quaternion
    • v Vec3 Translation vector
    • s Vec3 Scaling vector
    fromQuat

    Restore the matrix values from a quaternion rotation

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:363
    参数列表
    • q Quat Rotation quaternion
    mat4

    通过该简便的函数进行创建 cc.Mat4 对象。

    metadescription
    返回Mat4
    定义于cocos2d/core/value-types/mat4.js:375
    参数列表
    • m00 Number Component in column 0, row 0 position (index 0)
    • m01 Number Component in column 0, row 1 position (index 1)
    • m02 Number Component in column 0, row 2 position (index 2)
    • m03 Number Component in column 0, row 3 position (index 3)
    • m10 Number Component in column 1, row 0 position (index 4)
    • m11 Number Component in column 1, row 1 position (index 5)
    • m12 Number Component in column 1, row 2 position (index 6)
    • m13 Number Component in column 1, row 3 position (index 7)
    • m20 Number Component in column 2, row 0 position (index 8)
    • m21 Number Component in column 2, row 1 position (index 9)
    • m22 Number Component in column 2, row 2 position (index 10)
    • m23 Number Component in column 2, row 3 position (index 11)
    • m30 Number Component in column 3, row 0 position (index 12)
    • m31 Number Component in column 3, row 1 position (index 13)
    • m32 Number Component in column 3, row 2 position (index 14)
    • m33 Number Component in column 3, row 3 position (index 15)
    lerp

    线性插值。当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。

    metadescription
    返回ValueType
    定义于cocos2d/core/value-types/value-type.js:67
    参数列表
    • to ValueType the to value
    • ratio number the interpolation coefficient