AR_Engine_SDK
|
Functions | |
function | XRT_RayToAABB3 (vStart, vDelta, vMins, vMaxs, vPoint, pfFraction, vNormal) end |
function | XRT_RayToAABB3 (vStart, vDelta, vMins, vMaxs) end |
function | XRT_PlaneAABBOverlap (Plane, _vMins, _vMaxs) end |
function | XRT_PlaneSphereOverlap (Plane, vCenter, fRadius) end |
function | XRT_PlaneSphereOverlap (vNormal, fDist, vCenter, fRadius) end |
function | XG_InvSqrt (v) end |
function | XG_SquareMagnitude (v) end |
function | XG_Magnitude (v) end |
function | XG_MagnitudeH (v) end |
function | XG_Vector423 (v) end |
function | XG_Normalize (v) end |
function | XG_CompressDir (v, b1, b2) end |
function | XG_CompressDir (v) end |
function | XG_DecompressDir (b1, b2) end |
function | XG_VecMin (v1, v2) end |
function | XG_VecMax (v1, v2) end |
function | XG_ViewToWorld (vIn, matView) end |
function | XG_IdentityMatrix3 () end |
function | XG_TransformMatrix3 (fRad, vecPos) end |
function | XG_TransformMatrix3 (fRad, vecPos, vecScale) end |
function | XG_TransformMatrix3 (vecXDir, vecPos) end |
function | XG_TransformMatrix3 (vecXDir, vecPos, vecScale) end |
function | XG_IdentityMatrix () end |
function | XG_ZeroMatrix () end |
function | XG_ViewMatrix (from, dir, vecUp, roll) end |
function | XG_LookAtMatrix (from, to, vecUp, roll) end |
function | XG_TransformMatrix (vecDir, vecUp, vecPos) end |
function | XG_RotateX (vRad) end |
function | XG_RotateX (mat, vRad) end |
function | XG_RotateY (vRad) end |
function | XG_RotateY (mat, vRad) end |
function | XG_RotateZ (vRad) end |
function | XG_RotateZ (mat, vRad) end |
function | XG_RotateAxis (vecAxis, vRad) end |
function | XG_RotateAxis (vecPos, vecAxis, vRad) end |
function | XG_RotateEuler (xRad, yRad, zRad) end |
function | XG_RotatePosAroundX (vPos, fRad) end |
function | XG_RotatePosAroundY (vPos, fRad) end |
function | XG_RotatePosAroundZ (vPos, fRad) end |
function | XG_RotatePosAroundAxis (vPos, vAxis, fRad) end |
function | XG_RotatePosAroundLine (vPos, vOrigin, vDir, fRad) end |
function | XG_RotateVecAroundLine (v, vOrigin, vDir, fRad) end |
function | XG_Scaling (sx, sy, sz) end |
function | XG_Scaling (mat, sx, sy, sz) end |
function | XG_ScalingRelative (matRoot, sx, sy, sz) end |
function | XG_Translate (x, y, z) end |
function | XG_ScaleAlongAxis (vAxis, fScale) end |
function | XG_Transpose (mat) end |
function | XG_Transpose (matIn, pmatOut) end |
function | XG_Transpose (matIn) end |
function | XG_DecomposeMatrix (mat, scale, orient, pos) end |
function | XG_DecomposeMatrix (mat) end |
function | XG_DecomposeStrechedMatrixDiscardScale (mat, rotate, pos, sign) end |
function | XG_DecomposeStrechedMatrixDiscardScale (mat) end |
function | XG_GetCubeMapDirAndUp (nFaceIndex, pDir, pUp) end |
function | XG_GetCubeMapDirAndUp (nFaceIndex) end |
function | XG_ColorValueToColorRGBA (colorValue) end |
function | XG_ColorRGBAToColorValue (colorRGBA) end |
function | XG_MirrorMatrix (p, n) end |
function | XG_InverseTM (mat) end |
function | XG_InverseTM (matIn, pmatOut) end |
function | XG_InverseTM (matIn) end |
function | XG_InverseMatrix (mat) end |
function | XG_InverseMatrix (matIn, pmatOut) end |
function | XG_InverseMatrix (matIn) end |
function | XG_InverseAffineMatrix (mat) end |
function | XG_InverseAffineMatrix (matIn, pmatOut) end |
function | XG_InverseAffineMatrix (matIn) end |
function | XG_OrthoMatrix (fWidth, fHeight, fZNear, fZFar) end |
function | XG_OrthoOffCenterMatrix (fLeft, fRight, fBottom, fTop, fZNear, fZFar) end |
function | XG_PerspectiveMatrix (fWidth, fHeight, fZNear, fZFar) end |
function | XG_PerspectiveFovMatrix (fFovY, fAspect, fZNear, fZFar) end |
function | XG_PerspectiveOffCenterMatrix (fLeft, fRight, fBottom, fTop, fZNear, fZFar) end |
function | XG_OrthoMatrixRH (fWidth, fHeight, fZNear, fZFar) end |
function | XG_OrthoOffCenterMatrixRH (fLeft, fRight, fBottom, fTop, fZNear, fZFar) end |
function | XG_PerspectiveMatrixRH (fWidth, fHeight, fZNear, fZFar) end |
function | XG_PerspectiveFovMatrixRH (fFovY, fAspect, fZNear, fZFar) end |
function | XG_PerspectiveOffCenterMatrixRH (fLeft, fRight, fBottom, fTop, fZNear, fZFar) end |
function | XG_ClearAABB (vMins, vMaxs) end |
function | XG_AddVertexToAABB (vMins, vMaxs, vPoint) end |
function | XG_ExpandAABB (vecMins, vecMaxs, obb) end |
function | XG_ExpandAABB (vecMins, vecMaxs, subAABB) end |
function | XG_BuildAABB (pAABB, obb) end |
function | XG_BuildAABB (obb) end |
function | XG_MergeAABB (pAABB, subAABB) end |
function | XG_CompleteAABB (pAABB) end |
function | XG_CompleteOBB (pOBB) end |
function | XG_RandDirH () end |
function | XG_HSVToRGB (hsvColor, pRgbColor) end |
function | XG_HSVToRGB (hsvColor) end |
function | XG_RGBToHSV (rgbColor, pHsvColor) end |
function | XG_RGBToHSV (rgbColor) end |
function | XG_RGBToHSL (r, g, b, h, s, l) end |
function | XG_RGBToHSL (r, g, b) end |
function | XG_DecompressColor (rgbColor, pR, pG, pB, pA) end |
function | XG_DecompressColor (rgbColor) end |
function | XG_Matrix3Rotate (fRad) end |
function | XG_Matrix3Rotate (mat, fRad) end |
function | XG_Matrix3Translate (x, y) end |
function | XG_Matrix3Translate (mat, x, y) end |
function | XG_VectorMatrix3x3 (v, mat) end |
function | XG_DistSquareToAABB (vPos, aabb) end |
function | XG_TransformAABB (aabb, mat) end |
function | XG_RayToTriangle (vStart, vDelta, v0, v1, v2, vPoint, bTwoSides, pfFraction) end |
function | XG_RayToTriangle (vStart, vDelta, v0, v1, v2, bTwoSides) end |
function | TransformMatrix (qRotation, vTranslation, vScaling) end |
function | XG_CastRay (pViewport, vecScreenPoint, vecStart, vecDir) end |
function | XG_CastRay (pViewport, vecScreenPoint) end |
function | XG_NormalizedCrossProduct (vec1, vec2) end |
function | XG_IsZeroLength (vecIn) end |
function | XG_PointToLineDistance (vecPoint, vecLinePoint, vecLineDirection, pFraction) end |
function | XG_PointToLineDistance (vecPoint, vecLinePoint, vecLineDirection) end |
function | XG_LineLineDistance (vecPoint0, vecDir0, vecPoint1, vecDir1, pFractions) end |
function | XG_LineLineDistance (vecPoint0, vecDir0, vecPoint1, vecDir1) end |
function | XG_LinePlaneIntersection (vecLinePoint, vecLineDir, vecPlanePoint, vecPlaneNormal) end |
function | XG_LineSphereIntersection (vecLinePoint, vecLineDir, vecSphereCenter, fRadius) end |
function | X_Equals (a, b, eps) end |
function | X_IsPowerOfTwo (x) end |
function | X_CeilPowerOfTwo (x) end |
function | X_FloorPowerOfTwo (x) end |
function | X_Srand_Time () end |
function | X_Srand_ (seed) end |
function | X_Rand_ () end |
function | X_Random_0_to_1 () end |
function | X_RandInt (lower, upper) end |
function | X_RandFloat (lower, upper) end |
function | XG_CompressDirH (x, z) end |
function | XG_DecompressDirH (byDir) end |
function | QuaternionDiffAngle () end |
@type number @readonly More... | |
function | SlerpQuaternion () end |
function | QuaternionToEulerAngle_Continuous () end |
function | QuaternionToAxisAngle () end |
function | QuaternionToMatrix () end |
function | MatrixToQuaternion () end |
function | Conjugate () end |
function | Inverse () end |
function | Slerp () end |
function | Nlerp () end |
function | QuaternionToEulerAngle () end |
function | EulerAngleToQuaternion () end |
function | EulerAngleToQuaternionValue () end |
function | QuaternionRotationFromTo () end |
function | AxisAngleToQuaternion () end |
Variables | |
DEFAULTFOVDEGREE = 0 | |
@type number @readonly More... | |
DEFAULTZNEAR = 0 | |
@type number @readonly More... | |
DEFAULTZFAR = 0 | |
@type number @readonly More... | |
DEFAULTRADIO = 0 | |
@type number @readonly More... | |
function AxisAngleToQuaternion | ( | ) |
@manual xelua_XEngine_AxisAngleToQuaternion_manual AxisAngleToQuaternion_manual
function Conjugate | ( | ) |
@manual xelua_XEngine_Conjugate_manual Conjugate_manual
function EulerAngleToQuaternion | ( | ) |
@manual xelua_XEngine_EulerAngleToQuaternion_manual EulerAngleToQuaternion_manual
function EulerAngleToQuaternionValue | ( | ) |
@manual xelua_XEngine_EulerAngleToQuaternionValue_manual EulerAngleToQuaternionValue_manual
function Inverse | ( | ) |
@manual xelua_XEngine_Inverse_manual Inverse_manual
function MatrixToQuaternion | ( | ) |
@manual xelua_XEngine_MatrixToQuaternion_manual MatrixToQuaternion_manual
function Nlerp | ( | ) |
@manual xelua_XEngine_Nlerp_manual Nlerp_manual
function QuaternionDiffAngle | ( | ) |
@type number @readonly
@type number @readonly @type number @readonly @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @type XConsoleVariable @manual xelua_XEngine_QuaternionDiffAngle_manual QuaternionDiffAngle_manual
function QuaternionRotationFromTo | ( | ) |
@manual xelua_XEngine_QuaternionRotationFromTo_manual QuaternionRotationFromTo_manual
function QuaternionToAxisAngle | ( | ) |
@manual xelua_XEngine_QuaternionToAxisAngle_manual QuaternionToAxisAngle_manual
function QuaternionToEulerAngle | ( | ) |
@manual xelua_XEngine_QuaternionToEulerAngle_manual QuaternionToEulerAngle_manual
function QuaternionToEulerAngle_Continuous | ( | ) |
@manual xelua_XEngine_QuaternionToEulerAngle_Continuous_manual QuaternionToEulerAngle_Continuous_manual
function QuaternionToMatrix | ( | ) |
@manual xelua_XEngine_QuaternionToMatrix_manual QuaternionToMatrix_manual
function Slerp | ( | ) |
@manual xelua_XEngine_Slerp_manual Slerp_manual
function SlerpQuaternion | ( | ) |
@manual xelua_XEngine_SlerpQuaternion_manual SlerpQuaternion_manual
function TransformMatrix | ( | qRotation | , |
vTranslation | , | ||
vScaling | |||
) |
构建变换矩阵,并将其返回
qRotation | XQUATERNION |
vTranslation | XVECTOR3 |
vScaling | XVECTOR3 |
function X_CeilPowerOfTwo | ( | x | ) |
X_CeilPowerOfTwo00
x | number |
function X_Equals | ( | a | , |
b | , | ||
eps | |||
) |
判断变量 a 和 b 是否在一定误差范围内相等(提供了两个接口,支持xfloat32和xfloat64两种类型)
a | number |
b | number |
eps | number 误差范围(xfloat32类型) |
判断变量 a 和 b 是否在一定误差范围内相等(提供了两个接口,支持xfloat32和xfloat64两种类型)
a | number |
b | number |
eps | number 误差范围(xfloat64类型) |
function X_FloorPowerOfTwo | ( | x | ) |
X_FloorPowerOfTwo00
x | number |
function X_IsPowerOfTwo | ( | x | ) |
判断 x 是否是 2 的 n 次幂
x | number |
function X_Rand_ | ( | ) |
X_Rand_00
X_RandFloat00
lower | number |
upper | number |
function X_Random_0_to_1 | ( | ) |
X_Random_0_to_100
function X_Srand_ | ( | seed | ) |
X_Srand_00
seed | number |
function X_Srand_Time | ( | ) |
X_Srand_Time00
function XG_AddVertexToAABB | ( | vMins | , |
vMaxs | , | ||
vPoint | |||
) |
用 vPoint 数据更新 AABB 包围盒的数据。例如,如果 vPoint 的 x 分量小于 AABB 包围盒 vMins的 x 分量, 则将 AABB 包围盒 vMins 顶点的 x 分量更新为 vPoint 的 x 分量,对于 y , z 分量执行一样的操作.
vMins | XVECTOR3 AABB包围盒“最小”点 |
vMaxs | XVECTOR3 AABB包围盒“最大”点 |
vPoint | XVECTOR3 用于更新AABB包围盒边界点的向量 |
function XG_BuildAABB | ( | pAABB | , |
obb | |||
) |
function XG_CastRay | ( | pViewport | , |
vecScreenPoint | , | ||
vecStart | , | ||
vecDir | |||
) |
XG_CastRay00
pViewport | XViewport |
vecScreenPoint | XVECTOR3 |
vecStart | XVECTOR3 |
vecDir | XVECTOR3 |
function XG_CastRay | ( | pViewport | , |
vecScreenPoint | |||
) |
function XG_ClearAABB | ( | vMins | , |
vMaxs | |||
) |
XG_ClearAABB00
vMins | XVECTOR3 |
vMaxs | XVECTOR3 |
function XG_ColorRGBAToColorValue | ( | colorRGBA | ) |
XCOLOR格式转换为XCOLORBASE格式
colorRGBA | number XCOLOR(一个xuint32)格式颜色信息 |
function XG_ColorValueToColorRGBA | ( | colorValue | ) |
XCOLORBASE格式转换为XCOLOR格式
colorValue | XCOLORBASE XCOLORBASE(4个xfloat32颜色分量r,g,b,a)格式颜色信息 |
function XG_CompleteAABB | ( | pAABB | ) |
function XG_CompleteOBB | ( | pOBB | ) |
function XG_CompressDir | ( | v | , |
b1 | , | ||
b2 | |||
) |
XG_CompressDir00
v | XVECTOR3 |
b1 | number |
b2 | number |
function XG_CompressDir | ( | v | ) |
XG_CompressDir01
v | XVECTOR3 |
function XG_DecomposeMatrix | ( | mat | , |
scale | , | ||
orient | , | ||
pos | |||
) |
XG_DecomposeMatrix00
mat | XMATRIX4 |
scale | XVECTOR3 |
orient | XQUATERNION |
pos | XVECTOR3 |
function XG_DecomposeMatrix | ( | mat | ) |
XG_DecomposeMatrix01
mat | XMATRIX4 |
function XG_DecomposeStrechedMatrixDiscardScale | ( | mat | , |
rotate | , | ||
pos | , | ||
sign | |||
) |
XG_DecomposeStrechedMatrixDiscardScale00
mat | XMATRIX4 |
rotate | XQUATERNION |
pos | XVECTOR3 |
sign | number |
function XG_DecomposeStrechedMatrixDiscardScale | ( | mat | ) |
XG_DecomposeStrechedMatrixDiscardScale01
mat | XMATRIX4 |
function XG_DecompressColor | ( | rgbColor | , |
pR | , | ||
pG | , | ||
pB | , | ||
pA | |||
) |
XG_DecompressColor00
rgbColor | number |
pR | number |
pG | number |
pB | number |
pA | number |
function XG_DecompressColor | ( | rgbColor | ) |
XG_DecompressColor01
rgbColor | number |
function XG_DecompressDir | ( | b1 | , |
b2 | |||
) |
从两个字符中解压出3D向量
b1 | number 压缩输第一个字符 |
b2 | number 压缩输第二个字符 |
function XG_DecompressDirH | ( | byDir | ) |
[引擎内部模块间调用接口]
byDir | number |
function XG_DistSquareToAABB | ( | vPos | , |
aabb | |||
) |
function XG_ExpandAABB | ( | vecMins | , |
vecMaxs | , | ||
obb | |||
) |
将OBB合并到AABB的最大最小值中
vecMins | XVECTOR3 AABB的最小值 |
vecMaxs | XVECTOR3 AABB的最大值 |
obb | XCusOBB 输入OBB信息 |
function XG_ExpandAABB | ( | vecMins | , |
vecMaxs | , | ||
subAABB | |||
) |
将AABB合并到AABB的最大最小值中
vecMins | XVECTOR3 AABB的最小值 |
vecMaxs | XVECTOR3 AABB的最大值 |
subAABB | XCusAABB 输入子AABB信息 |
function XG_GetCubeMapDirAndUp | ( | nFaceIndex | , |
pDir | , | ||
pUp | |||
) |
XG_GetCubeMapDirAndUp00
nFaceIndex | number |
pDir | XVECTOR3 |
pUp | XVECTOR3 |
function XG_GetCubeMapDirAndUp | ( | nFaceIndex | ) |
XG_GetCubeMapDirAndUp01
nFaceIndex | number |
function XG_HSVToRGB | ( | hsvColor | , |
pRgbColor | |||
) |
function XG_HSVToRGB | ( | hsvColor | ) |
function XG_IdentityMatrix | ( | ) |
初始化一个 4 x 4 的单位矩阵并将其返回
function XG_IdentityMatrix3 | ( | ) |
初始化一个 3 x 3 的单位矩阵并将其返回
function XG_InverseAffineMatrix | ( | mat | ) |
[引擎内部模块间调用接口]
mat | XMATRIX4 |
function XG_InverseAffineMatrix | ( | matIn | , |
pmatOut | |||
) |
XG_InverseAffineMatrix01
matIn | XMATRIX4 |
pmatOut | XMATRIX4 |
function XG_InverseAffineMatrix | ( | matIn | ) |
XG_InverseAffineMatrix02
matIn | XMATRIX4 |
function XG_InverseMatrix | ( | mat | ) |
计算矩阵 mat 的逆矩阵并将其返回
mat | XMATRIX4 原始矩阵 |
function XG_InverseMatrix | ( | matIn | , |
pmatOut | |||
) |
XG_InverseMatrix01
matIn | XMATRIX4 |
pmatOut | XMATRIX4 |
function XG_InverseMatrix | ( | matIn | ) |
XG_InverseMatrix02
matIn | XMATRIX4 |
function XG_InverseTM | ( | mat | ) |
计算矩阵 mat 的逆矩阵并将其返回,只有平移、旋转、缩放的矩阵求逆
mat | XMATRIX4 原始矩阵 |
function XG_InverseTM | ( | matIn | , |
pmatOut | |||
) |
XG_InverseTM01
matIn | XMATRIX4 |
pmatOut | XMATRIX4 |
function XG_InverseTM | ( | matIn | ) |
XG_InverseTM02
matIn | XMATRIX4 |
function XG_InvSqrt | ( | v | ) |
计算 v 的平方根的倒数,并返回
v | number 待计算的浮点数 |
function XG_IsZeroLength | ( | vecIn | ) |
判断给定的向量是否是零向量
vecIn | XVECTOR3 |
function XG_LineLineDistance | ( | vecPoint0 | , |
vecDir0 | , | ||
vecPoint1 | , | ||
vecDir1 | , | ||
pFractions | |||
) |
@manual xelua_XEngine_XG_LineLineDistance_manual XG_LineLineDistance_manual
vecPoint0 | XVECTOR3 |
vecDir0 | XVECTOR3 |
vecPoint1 | XVECTOR3 |
vecDir1 | XVECTOR3 |
pFractions | number |
function XG_LineLineDistance | ( | vecPoint0 | , |
vecDir0 | , | ||
vecPoint1 | , | ||
vecDir1 | |||
) |
@manual xelua_XEngine_XG_LineLineDistance_manual XG_LineLineDistance_manual
vecPoint0 | XVECTOR3 |
vecDir0 | XVECTOR3 |
vecPoint1 | XVECTOR3 |
vecDir1 | XVECTOR3 |
function XG_LinePlaneIntersection | ( | vecLinePoint | , |
vecLineDir | , | ||
vecPlanePoint | , | ||
vecPlaneNormal | |||
) |
计算空间中线与面的交点并返回,此处 vecLineDir 和 vecPlaneNormal 要求单位化
vecLinePoint | XVECTOR3 空间中的直线上的一个坐标点 |
vecLineDir | XVECTOR3 空间直线的方向向量(单位化) |
vecPlanePoint | XVECTOR3 空间中平面上的一个坐标点 |
vecPlaneNormal | XVECTOR3 平面法向量(单位化) |
function XG_LineSphereIntersection | ( | vecLinePoint | , |
vecLineDir | , | ||
vecSphereCenter | , | ||
fRadius | |||
) |
计算空间中线与球的交点并返回,此处 vecLineDir 要求单位化
vecLinePoint | XVECTOR3 空间中的直线上的一个坐标点 |
vecLineDir | XVECTOR3 空间直线的方向向量(单位化) |
vecSphereCenter | XVECTOR3 空间中球的中心点坐标 |
fRadius | number 球的半径 |
function XG_LookAtMatrix | ( | from | , |
to | , | ||
vecUp | , | ||
roll | |||
) |
根据起点位置坐标、“看向的”终点坐标、Up向量构建视图矩阵,如果 roll 不为0 ,还需将构建的视图矩阵绕 z 轴旋转 -roll 弧度
from | XVECTOR3 起点坐标,即相机的位置坐标 |
to | XVECTOR3 终点坐标,即相机“看向”的坐标 |
vecUp | XVECTOR3 UP向量 |
roll | number 绕z轴负方向的旋转角(弧度) |
function XG_Magnitude | ( | v | ) |
计算向量的模
v | XVECTOR3 用于计算的向量 |
function XG_MagnitudeH | ( | v | ) |
计算向量 x 分量和 z 分量平方和的平方根
v | XVECTOR3 用于计算的向量 |
function XG_Matrix3Rotate | ( | fRad | ) |
计算绕 x 轴旋转的三维矩阵并返回
fRad | number |
function XG_Matrix3Rotate | ( | mat | , |
fRad | |||
) |
计算矩阵 mat 绕 x 轴旋转后的新矩阵,并将其返回(三维矩阵)
mat | XMATRIX3 待旋转的原始矩阵 |
fRad | number |
XG_Matrix3Translate00
x | number |
y | number |
XG_Matrix3Translate01
mat | XMATRIX3 |
x | number |
y | number |
function XG_MergeAABB | ( | pAABB | , |
subAABB | |||
) |
function XG_MirrorMatrix | ( | p | , |
n | |||
) |
计算镜像矩阵
p | XVECTOR3 |
n | XVECTOR3 镜像平面方向 |
function XG_Normalize | ( | v | ) |
将2D向量单位化
v | XVECTOR2 用于单位化的向量 |
将3D向量单位化
v | XVECTOR3 用于单位化的向量 |
function XG_NormalizedCrossProduct | ( | vec1 | , |
vec2 | |||
) |
将向量 vec1 和 vec2 叉乘,并将结果单位化
vec1 | XVECTOR3 用于叉乘的第一个向量 |
vec2 | XVECTOR3 用于叉乘的第二个向量 |
function XG_OrthoMatrix | ( | fWidth | , |
fHeight | , | ||
fZNear | , | ||
fZFar | |||
) |
根据宽、高、远近距离构建正交投影矩阵并返回,此时投影平面的中心与屏幕的几何中心点重合
fWidth | number 视口的宽 |
fHeight | number 视口的高 |
fZNear | number 近裁剪平面到相机的距离 |
fZFar | number 远裁剪平面到相机的距离 |
function XG_OrthoMatrixRH | ( | fWidth | , |
fHeight | , | ||
fZNear | , | ||
fZFar | |||
) |
计算右手的正交矩阵
fWidth | number 宽度 |
fHeight | number 高度 |
fZNear | number 近裁剪 |
fZFar | number 远裁剪 |
function XG_OrthoOffCenterMatrix | ( | fLeft | , |
fRight | , | ||
fBottom | , | ||
fTop | , | ||
fZNear | , | ||
fZFar | |||
) |
根据上下左右远近距离构建正交投影矩阵并返回
fLeft | number 视椎体左平面到相机的距离 |
fRight | number 视椎体右平面到相机的距离 |
fBottom | number 视椎体底部平面到相机的距离 |
fTop | number 视椎体顶部平面到相机的距离 |
fZNear | number 近裁剪平面到相机的距离 |
fZFar | number 远裁剪平面到相机的距离 |
function XG_OrthoOffCenterMatrixRH | ( | fLeft | , |
fRight | , | ||
fBottom | , | ||
fTop | , | ||
fZNear | , | ||
fZFar | |||
) |
计算左右,上下不等值的正交矩阵
fLeft | number 左侧值 |
fRight | number 右侧值 |
fBottom | number 下侧值 |
fTop | number 上侧值 |
fZNear | number 近裁剪 |
fZFar | number 远裁剪 |
function XG_PerspectiveFovMatrix | ( | fFovY | , |
fAspect | , | ||
fZNear | , | ||
fZFar | |||
) |
根据竖直方向的视角、近裁剪平面的宽高比、远近距离构建透视投影矩阵并返回
fFovY | number 竖直方向的视角(弧度) |
fAspect | number 视口的宽高比 |
fZNear | number 近裁剪平面到相机的距离 |
fZFar | number 远裁剪平面到相机的距离 |
function XG_PerspectiveFovMatrixRH | ( | fFovY | , |
fAspect | , | ||
fZNear | , | ||
fZFar | |||
) |
由于fov计算一个右手透视矩阵
fFovY | number fov值 |
fAspect | number 宽高比 |
fZNear | number 近裁剪 |
fZFar | number 远裁剪 |
function XG_PerspectiveMatrix | ( | fWidth | , |
fHeight | , | ||
fZNear | , | ||
fZFar | |||
) |
根据宽、高、远近距离构建透视投影矩阵并返回
fWidth | number 视口的宽 |
fHeight | number 视口的高 |
fZNear | number 近裁剪平面到相机的距离 |
fZFar | number 远裁剪平面到相机的距离 |
function XG_PerspectiveMatrixRH | ( | fWidth | , |
fHeight | , | ||
fZNear | , | ||
fZFar | |||
) |
计算一个右手透视矩阵
fWidth | number 宽度 |
fHeight | number 高度 |
fZNear | number 近裁剪 |
fZFar | number 远裁剪 |
function XG_PerspectiveOffCenterMatrix | ( | fLeft | , |
fRight | , | ||
fBottom | , | ||
fTop | , | ||
fZNear | , | ||
fZFar | |||
) |
根据上下左右远近远近距离构建透视投影矩阵并返回
fLeft | number 视椎体左平面到相机的距离 |
fRight | number 视椎体右平面到相机的距离 |
fBottom | number 视椎体底部平面到相机的距离 |
fTop | number 视椎体顶部平面到相机的距离 |
fZNear | number 近裁剪平面到相机的距离 |
fZFar | number 远裁剪平面到相机的距离 |
function XG_PerspectiveOffCenterMatrixRH | ( | fLeft | , |
fRight | , | ||
fBottom | , | ||
fTop | , | ||
fZNear | , | ||
fZFar | |||
) |
计算一个左右,上下不对称的透视矩阵
fLeft | number 左侧值 |
fRight | number 右侧值 |
fBottom | number 下侧值 |
fTop | number 上侧值 |
fZNear | number 近裁剪 |
fZFar | number 远裁剪 |
function XG_PointToLineDistance | ( | vecPoint | , |
vecLinePoint | , | ||
vecLineDirection | , | ||
pFraction | |||
) |
XG_PointToLineDistance00
vecPoint | XVECTOR3 |
vecLinePoint | XVECTOR3 |
vecLineDirection | XVECTOR3 |
pFraction | number |
function XG_PointToLineDistance | ( | vecPoint | , |
vecLinePoint | , | ||
vecLineDirection | |||
) |
XG_PointToLineDistance01
vecPoint | XVECTOR3 |
vecLinePoint | XVECTOR3 |
vecLineDirection | XVECTOR3 |
function XG_RandDirH | ( | ) |
随机生成一个水平向量
function XG_RayToTriangle | ( | vStart | , |
vDelta | , | ||
v0 | , | ||
v1 | , | ||
v2 | , | ||
vPoint | , | ||
bTwoSides | , | ||
pfFraction | |||
) |
XG_RayToTriangle00
vStart | XVECTOR3 |
vDelta | XVECTOR3 |
v0 | XVECTOR3 |
v1 | XVECTOR3 |
v2 | XVECTOR3 |
vPoint | XVECTOR3 |
bTwoSides | boolean |
pfFraction | number |
function XG_RayToTriangle | ( | vStart | , |
vDelta | , | ||
v0 | , | ||
v1 | , | ||
v2 | , | ||
bTwoSides | |||
) |
XG_RayToTriangle01
vStart | XVECTOR3 |
vDelta | XVECTOR3 |
v0 | XVECTOR3 |
v1 | XVECTOR3 |
v2 | XVECTOR3 |
bTwoSides | boolean |
function XG_RGBToHSL | ( | r | , |
g | , | ||
b | , | ||
h | , | ||
s | , | ||
l | |||
) |
XG_RGBToHSL00
r | number |
g | number |
b | number |
h | number |
s | number |
l | number |
function XG_RGBToHSL | ( | r | , |
g | , | ||
b | |||
) |
XG_RGBToHSL01
r | number |
g | number |
b | number |
function XG_RGBToHSV | ( | rgbColor | , |
pHsvColor | |||
) |
function XG_RGBToHSV | ( | rgbColor | ) |
function XG_RotateAxis | ( | vecAxis | , |
vRad | |||
) |
计算绕指定轴(vecAxis)旋转的矩阵并返回。旋转后的矩阵不包含平移和缩放信息
vecAxis | XVECTOR3 表示旋转轴的向量,单位化的向量 |
vRad | number 绕指定轴旋转的弧度角 |
function XG_RotateAxis | ( | vecPos | , |
vecAxis | , | ||
vRad | |||
) |
计算以 vecPos为参考点,绕向量 vecAxis旋转 vRad弧度的矩阵,并将其返回。旋转后的矩阵不包含平移和缩放信息
vecPos | XVECTOR3 参考点 |
vecAxis | XVECTOR3 表示旋转轴的向量,单位化的向量 |
vRad | number 绕指定轴旋转的弧度角 |
function XG_RotateEuler | ( | xRad | , |
yRad | , | ||
zRad | |||
) |
计算欧拉角对应的旋转矩阵并返回。
xRad | number 绕x轴旋转的欧拉角 |
yRad | number 绕y轴旋转的欧拉角 |
zRad | number 绕z轴旋转的欧拉角 |
function XG_RotatePosAroundAxis | ( | vPos | , |
vAxis | , | ||
fRad | |||
) |
计算点 vPos 绕 vAxis 轴旋转 fRad 弧度的坐标值。vAxis 需要是单位化的向量
vPos | XVECTOR3 待旋转的原始坐标点 |
vAxis | XVECTOR3 |
fRad | number 绕vAxis轴旋转的弧度角 |
计算点 vPos 绕直线旋转 fRad 弧度的坐标值。其中可以根据点vOrigin 和方向向量 vDir 确定一条直线,此处的方向向量要求是单位化的
vPos | XVECTOR3 待旋转的原始坐标点 |
vOrigin | XVECTOR3 空间直线上一个点的坐标 |
vDir | XVECTOR3 空间直线的方向向量(单位化) |
fRad | number 绕直线旋转的弧度角 |
function XG_RotatePosAroundX | ( | vPos | , |
fRad | |||
) |
计算点 vPos 绕 x 轴旋转 fRad 弧度的坐标值
vPos | XVECTOR3 待旋转的原始坐标点 |
fRad | number 绕x轴旋转的弧度角 |
function XG_RotatePosAroundY | ( | vPos | , |
fRad | |||
) |
计算点 vPos 绕 y 轴旋转 fRad 弧度的坐标值
vPos | XVECTOR3 待旋转的原始坐标点 |
fRad | number 绕y轴旋转的弧度角 |
function XG_RotatePosAroundZ | ( | vPos | , |
fRad | |||
) |
计算点 vPos 绕 z 轴旋转 fRad 弧度的坐标值
vPos | XVECTOR3 待旋转的原始坐标点 |
fRad | number 绕z轴旋转的弧度角 |
function XG_RotateVecAroundLine | ( | v | , |
vOrigin | , | ||
vDir | , | ||
fRad | |||
) |
计算向量 v 绕直线旋转 fRad 弧度的坐标值。其中可以根据点vOrigin 和方向向量 vDir 确定一条直线,此处的方向向量 vDir 要求是单位化的
v | XVECTOR3 |
vOrigin | XVECTOR3 空间直线上一个点的坐标 |
vDir | XVECTOR3 空间直线的方向向量(单位化) |
fRad | number 绕直线旋转的弧度角 |
function XG_RotateX | ( | vRad | ) |
计算绕 x 轴旋转的矩阵并返回
vRad | number 绕x轴旋转的弧度角 |
function XG_RotateX | ( | mat | , |
vRad | |||
) |
计算矩阵 mat 绕 x 轴旋转后的新矩阵,并将其返回
mat | XMATRIX4 待旋转的原始矩阵 |
vRad | number 绕x轴旋转的弧度角 |
function XG_RotateY | ( | vRad | ) |
计算绕 y 轴旋转的矩阵并返回
vRad | number 绕y轴旋转的弧度角 |
function XG_RotateY | ( | mat | , |
vRad | |||
) |
计算矩阵 mat 绕 y 轴旋转后的新矩阵,并将其返回
mat | XMATRIX4 待旋转的原始矩阵 |
vRad | number 绕y轴旋转的弧度角 |
function XG_RotateZ | ( | vRad | ) |
计算绕 z 轴旋转的矩阵并返回
vRad | number 绕z轴旋转的弧度角 |
function XG_RotateZ | ( | mat | , |
vRad | |||
) |
计算矩阵 mat 绕 z 轴旋转后的新矩阵,并将其返回
mat | XMATRIX4 待旋转的原始矩阵 |
vRad | number 绕z轴旋转的弧度角 |
function XG_ScaleAlongAxis | ( | vAxis | , |
fScale | |||
) |
构建一个沿向量vAxis缩放的矩阵
vAxis | XVECTOR3 |
fScale | number |
function XG_Scaling | ( | sx | , |
sy | , | ||
sz | |||
) |
初始化仅包含缩放信息的矩阵
sx | number x轴上的缩放分量 |
sy | number y轴上的缩放分量 |
sz | number z轴上的缩放分量 |
function XG_Scaling | ( | mat | , |
sx | , | ||
sy | , | ||
sz | |||
) |
在矩阵 mat 的基础上进行缩放,并返回缩放后的变换矩阵
mat | XMATRIX4 原始变换矩阵 |
sx | number x轴上的缩放分量 |
sy | number y轴上的缩放分量 |
sz | number z轴上的缩放分量 |
function XG_ScalingRelative | ( | matRoot | , |
sx | , | ||
sy | , | ||
sz | |||
) |
以matroot为根矩阵进行缩放,并返回缩放后的变换矩阵
matRoot | XMATRIX4 原始变换矩阵 |
sx | number x轴上的缩放分量 |
sy | number y轴上的缩放分量 |
sz | number z轴上的缩放分量 |
function XG_SquareMagnitude | ( | v | ) |
计算向量模的平方
v | XVECTOR3 用于计算的向量 |
function XG_TransformAABB | ( | aabb | , |
mat | |||
) |
function XG_TransformMatrix | ( | vecDir | , |
vecUp | , | ||
vecPos | |||
) |
构建变换矩阵,并将其返回
vecDir | XVECTOR3 |
vecUp | XVECTOR3 上方向 |
vecPos | XVECTOR3 位置坐标 |
function XG_TransformMatrix3 | ( | fRad | , |
vecPos | |||
) |
构建3X3变换矩阵,并将其返回
fRad | number 旋转弧度 |
vecPos | XVECTOR2 位移信息 |
function XG_TransformMatrix3 | ( | fRad | , |
vecPos | , | ||
vecScale | |||
) |
构建3X3变换矩阵,并将其返回
fRad | number |
vecPos | XVECTOR2 位移 |
vecScale | XVECTOR2 缩放 |
function XG_TransformMatrix3 | ( | vecXDir | , |
vecPos | |||
) |
XG_TransformMatrix302
vecXDir | XVECTOR2 |
vecPos | XVECTOR2 |
function XG_TransformMatrix3 | ( | vecXDir | , |
vecPos | , | ||
vecScale | |||
) |
XG_TransformMatrix303
vecXDir | XVECTOR2 |
vecPos | XVECTOR2 |
vecScale | XVECTOR2 |
构建平移矩阵并将其返回,返回的矩阵不包含旋转和缩放信息
x | number x轴上的平移量 |
y | number y轴上的平移量 |
z | number z轴上的平移量 |
function XG_Transpose | ( | mat | ) |
计算矩阵 mat 的转置矩阵并将其返回
mat | XMATRIX4 原始矩阵 |
function XG_Transpose | ( | matIn | , |
pmatOut | |||
) |
XG_Transpose01
matIn | XMATRIX4 |
pmatOut | XMATRIX4 |
function XG_Transpose | ( | matIn | ) |
XG_Transpose02
matIn | XMATRIX4 |
function XG_VecMax | ( | v1 | , |
v2 | |||
) |
比较两个向量的各分量大小,返回每个分量取最大值组成的向量
v1 | XVECTOR3 用于比较的向量1 |
v2 | XVECTOR3 用于比较的向量2 |
function XG_VecMin | ( | v1 | , |
v2 | |||
) |
比较两个向量的各分量大小,返回每个分量取最小值组成的向量
v1 | XVECTOR3 用于比较的向量1 |
v2 | XVECTOR3 用于比较的向量2 |
function XG_Vector423 | ( | v | ) |
XG_Vector42300
v | XVECTOR4 |
function XG_VectorMatrix3x3 | ( | v | , |
mat | |||
) |
XG_VectorMatrix3x300
v | XVECTOR3 |
mat | XMATRIX4 |
function XG_ViewMatrix | ( | from | , |
dir | , | ||
vecUp | , | ||
roll | |||
) |
根据观察点坐标、视线方向、Up向量构建视图矩阵,如果 roll 不为0 ,还需将构建的视图矩阵绕 z 轴旋转 -roll 弧度
from | XVECTOR3 观察点坐标,即相机的目标点 |
dir | XVECTOR3 视线方向向量 |
vecUp | XVECTOR3 UP向量 |
roll | number 绕z轴负方向的旋转角(弧度) |
function XG_ViewToWorld | ( | vIn | , |
matView | |||
) |
将3D向量从相机空间转到世界空间
vIn | XVECTOR3 1 |
matView | XMATRIX4 2 |
function XG_ZeroMatrix | ( | ) |
初始化一个 4 x 4 ,且元素全为 0 的矩阵并将其返回
function XRT_PlaneAABBOverlap | ( | Plane | , |
_vMins | , | ||
_vMaxs | |||
) |
检测平面是否与AABB包围盒碰撞(或重叠)
Plane | XCusSPlane 引擎中封装的代表平面的对象 |
_vMins | XVECTOR3 AABB包围盒“最小”点 |
_vMaxs | XVECTOR3 AABB包围盒“最大”点 |
检测平面是否与球体碰撞(或重叠)
Plane | XCusSPlane 引擎中封装的代表平面的对象 |
vCenter | XVECTOR3 空间中球的中心坐标 |
fRadius | number 球的半径 |
检测平面是否与球体碰撞(或重叠)
vNormal | XVECTOR3 空间中平面的法向量(单位化后的) |
fDist | number 标准平面方程的常量值d(ax+by+cz+d=0) |
vCenter | XVECTOR3 空间中球的中心坐标 |
fRadius | number 球的半径 |
function XRT_RayToAABB3 | ( | vStart | , |
vDelta | , | ||
vMins | , | ||
vMaxs | , | ||
vPoint | , | ||
pfFraction | , | ||
vNormal | |||
) |
XRT_RayToAABB300
vStart | XVECTOR3 |
vDelta | XVECTOR3 |
vMins | XVECTOR3 |
vMaxs | XVECTOR3 |
vPoint | XVECTOR3 |
pfFraction | number |
vNormal | XVECTOR3 |
function XRT_RayToAABB3 | ( | vStart | , |
vDelta | , | ||
vMins | , | ||
vMaxs | |||
) |
XRT_RayToAABB301
vStart | XVECTOR3 |
vDelta | XVECTOR3 |
vMins | XVECTOR3 |
vMaxs | XVECTOR3 |
DEFAULTFOVDEGREE = 0 |
@type number @readonly
DEFAULTRADIO = 0 |
@type number @readonly
DEFAULTZFAR = 0 |
@type number @readonly
DEFAULTZNEAR = 0 |
@type number @readonly