Mat4 类型
继承于 ValueType
模块: cc
表示 4*4 矩阵
索引
方法
constructor构造函数,可查看 cc.mat4clone克隆一个 Mat4 对象set用另一个矩阵设置这个矩阵的值。equals当前的矩阵是否与指定的矩阵相等。fuzzyEquals近似判断两个矩阵是否相等。toString转换为方便阅读的字符串。identitySet the matrix to the identity matrixtransposeTranspose the values of a mat4invertInverts a mat4adjointCalculates the adjugate of a mat4determinantCalculates the determinant of a mat4addAdds two Mat4subSubtracts the current matrix with another onemulSubtracts the current matrix with another onemulScalarMultiply each element of the matrix by a scalar.translateTranslate a mat4 by the given vectorscaleScales the mat4 by the dimensions in the given vec3rotateRotates a mat4 by the given angle around the given axisgetTranslationReturns the translation vector component of a transformation matrix.getScaleReturns the scale factor component of a transformation matrixgetRotationReturns the rotation factor component of a transformation matrixfromRTSRestore the matrix values from a quaternion rotation, vector translation and vector scalefromQuatRestore the matrix values from a quaternion rotationlerp线性插值。
Details
方法
constructor
构造函数,可查看 cc.mat4
| meta | description |
|---|---|
| 定义于 | cocos2d/core/value-types/mat4.js:43 |
参数列表
m00Number Component in column 0, row 0 position (index 0)m01Number Component in column 0, row 1 position (index 1)m02Number Component in column 0, row 2 position (index 2)m03Number Component in column 0, row 3 position (index 3)m10Number Component in column 1, row 0 position (index 4)m11Number Component in column 1, row 1 position (index 5)m12Number Component in column 1, row 2 position (index 6)m13Number Component in column 1, row 3 position (index 7)m20Number Component in column 2, row 0 position (index 8)m21Number Component in column 2, row 1 position (index 9)m22Number Component in column 2, row 2 position (index 10)m23Number Component in column 2, row 3 position (index 11)m30Number Component in column 3, row 0 position (index 12)m31Number Component in column 3, row 1 position (index 13)m32Number Component in column 3, row 2 position (index 14)m33Number Component in column 3, row 3 position (index 15)
clone
克隆一个 Mat4 对象
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:95 |
set
用另一个矩阵设置这个矩阵的值。
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:110 |
参数列表
srcObjMat4
equals
当前的矩阵是否与指定的矩阵相等。
| meta | description |
|---|---|
| 返回 | Boolean |
| 定义于 | cocos2d/core/value-types/mat4.js:139 |
参数列表
otherMat4
fuzzyEquals
近似判断两个矩阵是否相等。
判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。
| meta | description |
|---|---|
| 返回 | Boolean |
| 定义于 | cocos2d/core/value-types/mat4.js:150 |
参数列表
otherMat4
toString
转换为方便阅读的字符串。
| meta | description |
|---|---|
| 返回 | string |
| 定义于 | cocos2d/core/value-types/mat4.js:163 |
identity
Set the matrix to the identity matrix
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:180 |
transpose
Transpose the values of a mat4
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:190 |
参数列表
outMat4 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:201 |
参数列表
outMat4 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:212 |
参数列表
outMat4 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
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/value-types/mat4.js:223 |
add
Adds two Mat4
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:232 |
参数列表
otherMat4 the second operandoutMat4 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:244 |
参数列表
otherMat4 the second operandoutMat4 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:256 |
参数列表
otherMat4 the second operandoutMat4 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.
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:268 |
参数列表
numberNumber amount to scale the matrix's elements byoutMat4 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:280 |
参数列表
vVec3 vector to translate byoutMat4 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:292 |
参数列表
vVec3 vector to scale byoutMat4 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:304 |
参数列表
radNumber the angle to rotate the matrix byaxisVec3 the axis to rotate aroundoutMat4 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.
| meta | description |
|---|---|
| 返回 | Vec3 |
| 定义于 | cocos2d/core/value-types/mat4.js:317 |
参数列表
outVec3 Vector to receive translation component, if not provided, a new vec3 will be created
getScale
Returns the scale factor component of a transformation matrix
| meta | description |
|---|---|
| 返回 | Vec3 |
| 定义于 | cocos2d/core/value-types/mat4.js:328 |
参数列表
outVec3 Vector to receive scale component, if not provided, a new vec3 will be created
getRotation
Returns the rotation factor component of a transformation matrix
| meta | description |
|---|---|
| 返回 | Quat |
| 定义于 | cocos2d/core/value-types/mat4.js:339 |
参数列表
outQuat 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
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:350 |
参数列表
fromQuat
Restore the matrix values from a quaternion rotation
| meta | description |
|---|---|
| 返回 | Mat4 |
| 定义于 | cocos2d/core/value-types/mat4.js:363 |
参数列表
qQuat Rotation quaternion
lerp
线性插值。
当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。
| meta | description |
|---|---|
| 返回 | ValueType |
| 定义于 | cocos2d/core/value-types/value-type.js:67 |