Mat4
类型
继承于 ValueType
表示 4*4 矩阵
索引
属性(properties)
方法
mul
将当前矩阵与指定矩阵相乘mulScalar
将矩阵的每一个元素都乘以指定的缩放值。sub
将当前矩阵与指定的矩阵相减clone
获得指定矩阵的拷贝copy
复制目标矩阵identity
将目标赋值为单位矩阵transpose
转置矩阵invert
矩阵求逆determinant
矩阵行列式multiply
矩阵乘法transform
在给定矩阵变换基础上加入变换translate
在给定矩阵变换基础上加入新位移变换scale
在给定矩阵变换基础上加入新缩放变换rotate
在给定矩阵变换基础上加入新旋转变换rotateX
在给定矩阵变换基础上加入绕 X 轴的旋转变换rotateY
在给定矩阵变换基础上加入绕 Y 轴的旋转变换rotateZ
在给定矩阵变换基础上加入绕 Z 轴的旋转变换fromTranslation
计算位移矩阵fromScaling
计算缩放矩阵fromRotation
计算旋转矩阵fromXRotation
计算绕 X 轴的旋转矩阵fromYRotation
计算绕 Y 轴的旋转矩阵fromZRotation
计算绕 Z 轴的旋转矩阵fromRT
根据旋转和位移信息计算矩阵getTranslation
提取矩阵的位移信息, 默认矩阵中的变换以 S->R->T 的顺序应用getScaling
提取矩阵的缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用getRotation
提取矩阵的旋转信息, 默认输入矩阵不含有缩放信息,如考虑缩放应使用toRTS
函数。toRTS
提取旋转、位移、缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用fromRTS
根据旋转、位移、缩放信息计算矩阵,以 S->R->T 的顺序应用fromRTSOrigin
根据指定的旋转、位移、缩放及变换中心信息计算矩阵,以 S->R->T 的顺序应用fromQuat
根据指定的旋转信息计算矩阵frustum
根据指定的视锥体信息计算矩阵perspective
计算透视投影矩阵ortho
计算正交投影矩阵lookAt
根据视点计算矩阵,注意eye - center
不能为零向量或与up
向量平行inverseTranspose
计算逆转置矩阵add
逐元素矩阵加法subtract
逐元素矩阵减法multiplyScalar
矩阵标量乘法multiplyScalarAndAdd
逐元素矩阵标量乘加: A + B * scalestrictEquals
矩阵等价判断equals
排除浮点数误差的矩阵近似等价判断toArray
矩阵转数组fromArray
数组转矩阵constructor
构造函数,可查看 cc.mat4clone
克隆一个 Mat4 对象set
用另一个矩阵设置这个矩阵的值。equals
当前的矩阵是否与指定的矩阵相等。fuzzyEquals
近似判断两个矩阵是否相等。toString
转换为方便阅读的字符串。identity
Set the matrix to the identity matrixtranspose
Transpose the values of a mat4invert
Inverts a mat4adjoint
Calculates the adjugate of a mat4determinant
Calculates the determinant of a mat4add
Adds two Mat4subtract
Subtracts the current matrix with another onemultiply
Subtracts the current matrix with another onemultiplyScalar
Multiply each element of the matrix by a scalar.translate
Translate a mat4 by the given vectorscale
Scales the mat4 by the dimensions in the given vec3rotate
Rotates a mat4 by the given angle around the given axisgetTranslation
Returns the translation vector component of a transformation matrix.getScale
Returns the scale factor component of a transformation matrixgetRotation
Returns the rotation factor component of a transformation matrixfromRTS
Restore the matrix values from a quaternion rotation, vector translation and vector scalefromQuat
Restore the matrix values from a quaternion rotationlerp
线性插值。
Details
属性(properties)
IDENTITY
Identity of Mat4
meta | description |
---|---|
类型 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:86 |
m
矩阵数据
meta | description |
---|---|
类型 | Float64Array | Float32Array |
定义于 | cocos2d/core/value-types/mat4.ts:1641 |
方法
mul
将当前矩阵与指定矩阵相乘
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:52 |
参数列表
other
Mat4 the second operandout
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
将矩阵的每一个元素都乘以指定的缩放值。
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:63 |
参数列表
number
Number amount to scale the matrix's elements byout
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
将当前矩阵与指定的矩阵相减
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:74 |
参数列表
other
Mat4 the second operandout
Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
clone
获得指定矩阵的拷贝
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:93 |
copy
复制目标矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:111 |
identity
将目标赋值为单位矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:160 |
transpose
转置矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:189 |
invert
矩阵求逆
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:235 |
determinant
矩阵行列式
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:290 |
multiply
矩阵乘法
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:322 |
transform
在给定矩阵变换基础上加入变换
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:364 |
translate
在给定矩阵变换基础上加入新位移变换
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:398 |
scale
在给定矩阵变换基础上加入新缩放变换
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:424 |
rotate
在给定矩阵变换基础上加入新旋转变换
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:454 |
参数列表
rad
Unknown 旋转角度axis
Unknown 旋转轴
rotateX
在给定矩阵变换基础上加入绕 X 轴的旋转变换
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:518 |
参数列表
rad
Unknown 旋转角度
rotateY
在给定矩阵变换基础上加入绕 Y 轴的旋转变换
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:564 |
参数列表
rad
Unknown 旋转角度
rotateZ
在给定矩阵变换基础上加入绕 Z 轴的旋转变换
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:610 |
参数列表
rad
Unknown 旋转角度
fromTranslation
计算位移矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:658 |
fromScaling
计算缩放矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:687 |
fromRotation
计算旋转矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:716 |
fromXRotation
计算绕 X 轴的旋转矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:762 |
fromYRotation
计算绕 Y 轴的旋转矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:794 |
fromZRotation
计算绕 Z 轴的旋转矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:826 |
fromRT
根据旋转和位移信息计算矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:858 |
getTranslation
提取矩阵的位移信息, 默认矩阵中的变换以 S->R->T 的顺序应用
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:903 |
getScaling
提取矩阵的缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:920 |
getRotation
提取矩阵的旋转信息, 默认输入矩阵不含有缩放信息,如考虑缩放应使用 toRTS
函数。
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:948 |
toRTS
提取旋转、位移、缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:990 |
fromRTS
根据旋转、位移、缩放信息计算矩阵,以 S->R->T 的顺序应用
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1019 |
fromRTSOrigin
根据指定的旋转、位移、缩放及变换中心信息计算矩阵,以 S->R->T 的顺序应用
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1067 |
参数列表
q
Unknown 旋转值v
Unknown 位移值s
Unknown 缩放值o
Unknown 指定变换中心
fromQuat
根据指定的旋转信息计算矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1124 |
frustum
根据指定的视锥体信息计算矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1172 |
参数列表
left
Unknown 左平面距离right
Unknown 右平面距离bottom
Unknown 下平面距离top
Unknown 上平面距离near
Unknown 近平面距离far
Unknown 远平面距离
perspective
计算透视投影矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1211 |
参数列表
fovy
Unknown 纵向视角高度aspect
Unknown 长宽比near
Unknown 近平面距离far
Unknown 远平面距离
ortho
计算正交投影矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1247 |
参数列表
left
Unknown 左平面距离right
Unknown 右平面距离bottom
Unknown 下平面距离top
Unknown 上平面距离near
Unknown 近平面距离far
Unknown 远平面距离
lookAt
根据视点计算矩阵,注意 eye - center
不能为零向量或与 up
向量平行
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1285 |
参数列表
eye
Unknown 当前位置center
Unknown 目标视点up
Unknown 视口上方向
inverseTranspose
计算逆转置矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1349 |
add
逐元素矩阵加法
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1410 |
subtract
逐元素矩阵减法
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1439 |
multiplyScalar
矩阵标量乘法
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1468 |
multiplyScalarAndAdd
逐元素矩阵标量乘加: A + B * scale
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1497 |
strictEquals
矩阵等价判断
meta | description |
---|---|
返回 | Bool |
定义于 | cocos2d/core/value-types/mat4.ts:1526 |
equals
排除浮点数误差的矩阵近似等价判断
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1543 |
toArray
矩阵转数组
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1607 |
参数列表
ofs
Unknown 数组内的起始偏移量
fromArray
数组转矩阵
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1624 |
参数列表
ofs
Unknown 数组起始偏移量
constructor
构造函数,可查看 cc.mat4
meta | description |
---|---|
定义于 | cocos2d/core/value-types/mat4.ts:1649 |
clone
克隆一个 Mat4 对象
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1689 |
set
用另一个矩阵设置这个矩阵的值。
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1705 |
参数列表
srcObj
Mat4
equals
当前的矩阵是否与指定的矩阵相等。
meta | description |
---|---|
返回 | Boolean |
定义于 | cocos2d/core/value-types/mat4.ts:1735 |
参数列表
other
Mat4
fuzzyEquals
近似判断两个矩阵是否相等。
判断 2 个矩阵是否在默认误差范围之内,如果在则返回 true,反之则返回 false。
meta | description |
---|---|
返回 | Boolean |
定义于 | cocos2d/core/value-types/mat4.ts:1746 |
参数列表
other
Mat4
toString
转换为方便阅读的字符串。
meta | description |
---|---|
返回 | string |
定义于 | cocos2d/core/value-types/mat4.ts:1759 |
identity
Set the matrix to the identity matrix
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1784 |
transpose
Transpose the values of a mat4
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1794 |
参数列表
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
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1805 |
参数列表
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
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1816 |
参数列表
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
meta | description |
---|---|
返回 | Number |
定义于 | cocos2d/core/value-types/mat4.ts:1827 |
add
Adds two Mat4
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1836 |
参数列表
other
Mat4 the second operandout
Mat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
subtract
Subtracts the current matrix with another one
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1848 |
参数列表
other
Mat4 the second operand
multiply
Subtracts the current matrix with another one
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1858 |
参数列表
other
Mat4 the second operand
multiplyScalar
Multiply each element of the matrix by a scalar.
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1868 |
参数列表
number
Number amount to scale the matrix's elements by
translate
Translate a mat4 by the given vector
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1878 |
参数列表
v
Vec3 vector to translate byout
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
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1890 |
参数列表
v
Vec3 vector to scale byout
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
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1902 |
参数列表
rad
Number the angle to rotate the matrix byaxis
Vec3 the axis to rotate aroundout
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.
meta | description |
---|---|
返回 | Vec3 |
定义于 | cocos2d/core/value-types/mat4.ts:1915 |
参数列表
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
meta | description |
---|---|
返回 | Vec3 |
定义于 | cocos2d/core/value-types/mat4.ts:1926 |
参数列表
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
meta | description |
---|---|
返回 | Quat |
定义于 | cocos2d/core/value-types/mat4.ts:1937 |
参数列表
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
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1948 |
参数列表
fromQuat
Restore the matrix values from a quaternion rotation
meta | description |
---|---|
返回 | Mat4 |
定义于 | cocos2d/core/value-types/mat4.ts:1961 |
参数列表
q
Quat Rotation quaternion
lerp
线性插值。
当 ratio = 0 时返回自身,ratio = 1 时返回目标,ratio = 0.5 返回自身和目标的平均值。。
meta | description |
---|---|
返回 | ValueType |
定义于 | cocos2d/core/value-types/value-type.ts:63 |