mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -44,7 +44,7 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_SIMD_INLINE void float4x4_mul(float4x4_t* __restrict _result, const float4x4_t* __restrict _a, const float4x4_t* __restrict _b)
|
||||
BX_SIMD_INLINE void float4x4_mul(float4x4_t* _result, const float4x4_t* _a, const float4x4_t* _b)
|
||||
{
|
||||
_result->col[0] = simd_mul(_a->col[0], _b);
|
||||
_result->col[1] = simd_mul(_a->col[1], _b);
|
||||
@@ -52,7 +52,7 @@ namespace bx
|
||||
_result->col[3] = simd_mul(_a->col[3], _b);
|
||||
}
|
||||
|
||||
BX_SIMD_FORCE_INLINE void float4x4_transpose(float4x4_t* __restrict _result, const float4x4_t* __restrict _mtx)
|
||||
BX_SIMD_FORCE_INLINE void float4x4_transpose(float4x4_t* _result, const float4x4_t* _mtx)
|
||||
{
|
||||
const simd128_t aibj = simd_shuf_xAyB(_mtx->col[0], _mtx->col[2]); // aibj
|
||||
const simd128_t emfn = simd_shuf_xAyB(_mtx->col[1], _mtx->col[3]); // emfn
|
||||
@@ -64,7 +64,7 @@ namespace bx
|
||||
_result->col[3] = simd_shuf_zCwD(ckdl, gohp); // dhlp
|
||||
}
|
||||
|
||||
BX_SIMD_INLINE void float4x4_inverse(float4x4_t* __restrict _result, const float4x4_t* __restrict _a)
|
||||
BX_SIMD_INLINE void float4x4_inverse(float4x4_t* _result, const float4x4_t* _a)
|
||||
{
|
||||
const simd128_t tmp0 = simd_shuf_xAzC(_a->col[0], _a->col[1]);
|
||||
const simd128_t tmp1 = simd_shuf_xAzC(_a->col[2], _a->col[3]);
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace bx
|
||||
bool fequal(float _a, float _b, float _epsilon);
|
||||
|
||||
///
|
||||
bool fequal(const float* __restrict _a, const float* __restrict _b, uint32_t _num, float _epsilon);
|
||||
bool fequal(const float* _a, const float* _b, uint32_t _num, float _epsilon);
|
||||
|
||||
///
|
||||
float fwrap(float _a, float _wrap);
|
||||
@@ -182,93 +182,93 @@ namespace bx
|
||||
float fgain(float _time, float _gain);
|
||||
|
||||
///
|
||||
void vec3Move(float* __restrict _result, const float* __restrict _a);
|
||||
void vec3Move(float* _result, const float* _a);
|
||||
|
||||
///
|
||||
void vec3Abs(float* __restrict _result, const float* __restrict _a);
|
||||
void vec3Abs(float* _result, const float* _a);
|
||||
|
||||
///
|
||||
void vec3Neg(float* __restrict _result, const float* __restrict _a);
|
||||
void vec3Neg(float* _result, const float* _a);
|
||||
|
||||
///
|
||||
void vec3Add(float* __restrict _result, const float* __restrict _a, const float* __restrict _b);
|
||||
void vec3Add(float* _result, const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void vec3Add(float* __restrict _result, const float* __restrict _a, float _b);
|
||||
void vec3Add(float* _result, const float* _a, float _b);
|
||||
|
||||
///
|
||||
void vec3Sub(float* __restrict _result, const float* __restrict _a, const float* __restrict _b);
|
||||
void vec3Sub(float* _result, const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void vec3Sub(float* __restrict _result, const float* __restrict _a, float _b);
|
||||
void vec3Sub(float* _result, const float* _a, float _b);
|
||||
|
||||
///
|
||||
void vec3Mul(float* __restrict _result, const float* __restrict _a, const float* __restrict _b);
|
||||
void vec3Mul(float* _result, const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void vec3Mul(float* __restrict _result, const float* __restrict _a, float _b);
|
||||
void vec3Mul(float* _result, const float* _a, float _b);
|
||||
|
||||
///
|
||||
float vec3Dot(const float* __restrict _a, const float* __restrict _b);
|
||||
float vec3Dot(const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void vec3Cross(float* __restrict _result, const float* __restrict _a, const float* __restrict _b);
|
||||
void vec3Cross(float* _result, const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
float vec3Length(const float* _a);
|
||||
|
||||
///
|
||||
void vec3Lerp(float* __restrict _result, const float* __restrict _a, const float* __restrict _b, float _t);
|
||||
void vec3Lerp(float* _result, const float* _a, const float* _b, float _t);
|
||||
|
||||
///
|
||||
void vec3Lerp(float* __restrict _result, const float* __restrict _a, const float* __restrict _b, const float* __restrict _c);
|
||||
void vec3Lerp(float* _result, const float* _a, const float* _b, const float* _c);
|
||||
|
||||
///
|
||||
float vec3Norm(float* __restrict _result, const float* __restrict _a);
|
||||
float vec3Norm(float* _result, const float* _a);
|
||||
|
||||
///
|
||||
void vec3Min(float* __restrict _result, const float* __restrict _a, const float* __restrict _b);
|
||||
void vec3Min(float* _result, const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void vec3Max(float* __restrict _result, const float* __restrict _a, const float* __restrict _b);
|
||||
void vec3Max(float* _result, const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void vec3Rcp(float* __restrict _result, const float* __restrict _a);
|
||||
void vec3Rcp(float* _result, const float* _a);
|
||||
|
||||
/// Calculate tangent frame from normal.
|
||||
///
|
||||
void vec3TangentFrame(const float* __restrict _n, float* __restrict _t, float* __restrict _b);
|
||||
void vec3TangentFrame(const float* _n, float* _t, float* _b);
|
||||
|
||||
/// Calculate tangent frame from normal and angle.
|
||||
///
|
||||
void vec3TangentFrame(const float* __restrict _n, float* __restrict _t, float* __restrict _b, float _angle);
|
||||
void vec3TangentFrame(const float* _n, float* _t, float* _b, float _angle);
|
||||
|
||||
///
|
||||
void quatIdentity(float* _result);
|
||||
|
||||
///
|
||||
void quatMove(float* __restrict _result, const float* __restrict _a);
|
||||
void quatMove(float* _result, const float* _a);
|
||||
|
||||
///
|
||||
void quatMulXYZ(float* __restrict _result, const float* __restrict _qa, const float* __restrict _qb);
|
||||
void quatMulXYZ(float* _result, const float* _qa, const float* _qb);
|
||||
|
||||
///
|
||||
void quatMul(float* __restrict _result, const float* __restrict _qa, const float* __restrict _qb);
|
||||
void quatMul(float* _result, const float* _qa, const float* _qb);
|
||||
|
||||
///
|
||||
void quatInvert(float* __restrict _result, const float* __restrict _quat);
|
||||
void quatInvert(float* _result, const float* _quat);
|
||||
|
||||
///
|
||||
float quatDot(const float* __restrict _a, const float* __restrict _b);
|
||||
float quatDot(const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void quatNorm(float* __restrict _result, const float* __restrict _quat);
|
||||
void quatNorm(float* _result, const float* _quat);
|
||||
|
||||
///
|
||||
void quatToEuler(float* __restrict _result, const float* __restrict _quat);
|
||||
void quatToEuler(float* _result, const float* _quat);
|
||||
|
||||
///
|
||||
void quatRotateAxis(float* __restrict _result, const float* _axis, float _angle);
|
||||
void quatRotateAxis(float* _result, const float* _axis, float _angle);
|
||||
|
||||
///
|
||||
void quatRotateX(float* _result, float _ax);
|
||||
@@ -280,7 +280,7 @@ namespace bx
|
||||
void quatRotateZ(float* _result, float _az);
|
||||
|
||||
///
|
||||
void vec3MulQuat(float* __restrict _result, const float* __restrict _vec, const float* __restrict _quat);
|
||||
void vec3MulQuat(float* _result, const float* _vec, const float* _quat);
|
||||
|
||||
///
|
||||
void mtxIdentity(float* _result);
|
||||
@@ -295,28 +295,28 @@ namespace bx
|
||||
void mtxScale(float* _result, float _scale);
|
||||
|
||||
///
|
||||
void mtxFromNormal(float* __restrict _result, const float* __restrict _normal, float _scale, const float* __restrict _pos);
|
||||
void mtxFromNormal(float* _result, const float* _normal, float _scale, const float* _pos);
|
||||
|
||||
///
|
||||
void mtxFromNormal(float* __restrict _result, const float* __restrict _normal, float _scale, const float* __restrict _pos, float _angle);
|
||||
void mtxFromNormal(float* _result, const float* _normal, float _scale, const float* _pos, float _angle);
|
||||
|
||||
///
|
||||
void mtxQuat(float* __restrict _result, const float* __restrict _quat);
|
||||
void mtxQuat(float* _result, const float* _quat);
|
||||
|
||||
///
|
||||
void mtxQuatTranslation(float* __restrict _result, const float* __restrict _quat, const float* __restrict _translation);
|
||||
void mtxQuatTranslation(float* _result, const float* _quat, const float* _translation);
|
||||
|
||||
///
|
||||
void mtxQuatTranslationHMD(float* __restrict _result, const float* __restrict _quat, const float* __restrict _translation);
|
||||
void mtxQuatTranslationHMD(float* _result, const float* _quat, const float* _translation);
|
||||
|
||||
///
|
||||
void mtxLookAtLh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL);;
|
||||
void mtxLookAtLh(float* _result, const float* _eye, const float* _at, const float* _up = NULL);;
|
||||
|
||||
///
|
||||
void mtxLookAtRh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL);
|
||||
void mtxLookAtRh(float* _result, const float* _eye, const float* _at, const float* _up = NULL);
|
||||
|
||||
///
|
||||
void mtxLookAt(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL);
|
||||
void mtxLookAt(float* _result, const float* _eye, const float* _at, const float* _up = NULL);
|
||||
|
||||
///
|
||||
void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false);
|
||||
@@ -421,33 +421,33 @@ namespace bx
|
||||
void mtxSRT(float* _result, float _sx, float _sy, float _sz, float _ax, float _ay, float _az, float _tx, float _ty, float _tz);
|
||||
|
||||
///
|
||||
void vec3MulMtx(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat);
|
||||
void vec3MulMtx(float* _result, const float* _vec, const float* _mat);
|
||||
|
||||
///
|
||||
void vec3MulMtxH(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat);
|
||||
void vec3MulMtxH(float* _result, const float* _vec, const float* _mat);
|
||||
|
||||
///
|
||||
void vec4MulMtx(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat);
|
||||
void vec4MulMtx(float* _result, const float* _vec, const float* _mat);
|
||||
|
||||
///
|
||||
void mtxMul(float* __restrict _result, const float* __restrict _a, const float* __restrict _b);
|
||||
void mtxMul(float* _result, const float* _a, const float* _b);
|
||||
|
||||
///
|
||||
void mtxTranspose(float* __restrict _result, const float* __restrict _a);
|
||||
void mtxTranspose(float* _result, const float* _a);
|
||||
|
||||
///
|
||||
void mtx3Inverse(float* __restrict _result, const float* __restrict _a);
|
||||
void mtx3Inverse(float* _result, const float* _a);
|
||||
|
||||
///
|
||||
void mtxInverse(float* __restrict _result, const float* __restrict _a);
|
||||
void mtxInverse(float* _result, const float* _a);
|
||||
|
||||
/// Convert LH to RH projection matrix and vice versa.
|
||||
///
|
||||
void mtxProjFlipHandedness(float* __restrict _dst, const float* __restrict _src);
|
||||
void mtxProjFlipHandedness(float* _dst, const float* _src);
|
||||
|
||||
/// Convert LH to RH view matrix and vice versa.
|
||||
///
|
||||
void mtxViewFlipHandedness(float* __restrict _dst, const float* __restrict _src);
|
||||
void mtxViewFlipHandedness(float* _dst, const float* _src);
|
||||
|
||||
///
|
||||
void calcNormal(float _result[3], float _va[3], float _vb[3], float _vc[3]);
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace bx
|
||||
return lhs <= rhs;
|
||||
}
|
||||
|
||||
inline bool fequal(const float* __restrict _a, const float* __restrict _b, uint32_t _num, float _epsilon)
|
||||
inline bool fequal(const float* _a, const float* _b, uint32_t _num, float _epsilon)
|
||||
{
|
||||
bool equal = fequal(_a[0], _b[0], _epsilon);
|
||||
for (uint32_t ii = 1; equal && ii < _num; ++ii)
|
||||
@@ -266,75 +266,75 @@ namespace bx
|
||||
return fbias(_time * 2.0f - 1.0f, 1.0f - _gain) * 0.5f + 0.5f;
|
||||
}
|
||||
|
||||
inline void vec3Move(float* __restrict _result, const float* __restrict _a)
|
||||
inline void vec3Move(float* _result, const float* _a)
|
||||
{
|
||||
_result[0] = _a[0];
|
||||
_result[1] = _a[1];
|
||||
_result[2] = _a[2];
|
||||
}
|
||||
|
||||
inline void vec3Abs(float* __restrict _result, const float* __restrict _a)
|
||||
inline void vec3Abs(float* _result, const float* _a)
|
||||
{
|
||||
_result[0] = fabsolute(_a[0]);
|
||||
_result[1] = fabsolute(_a[1]);
|
||||
_result[2] = fabsolute(_a[2]);
|
||||
}
|
||||
|
||||
inline void vec3Neg(float* __restrict _result, const float* __restrict _a)
|
||||
inline void vec3Neg(float* _result, const float* _a)
|
||||
{
|
||||
_result[0] = -_a[0];
|
||||
_result[1] = -_a[1];
|
||||
_result[2] = -_a[2];
|
||||
}
|
||||
|
||||
inline void vec3Add(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
inline void vec3Add(float* _result, const float* _a, const float* _b)
|
||||
{
|
||||
_result[0] = _a[0] + _b[0];
|
||||
_result[1] = _a[1] + _b[1];
|
||||
_result[2] = _a[2] + _b[2];
|
||||
}
|
||||
|
||||
inline void vec3Add(float* __restrict _result, const float* __restrict _a, float _b)
|
||||
inline void vec3Add(float* _result, const float* _a, float _b)
|
||||
{
|
||||
_result[0] = _a[0] + _b;
|
||||
_result[1] = _a[1] + _b;
|
||||
_result[2] = _a[2] + _b;
|
||||
}
|
||||
|
||||
inline void vec3Sub(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
inline void vec3Sub(float* _result, const float* _a, const float* _b)
|
||||
{
|
||||
_result[0] = _a[0] - _b[0];
|
||||
_result[1] = _a[1] - _b[1];
|
||||
_result[2] = _a[2] - _b[2];
|
||||
}
|
||||
|
||||
inline void vec3Sub(float* __restrict _result, const float* __restrict _a, float _b)
|
||||
inline void vec3Sub(float* _result, const float* _a, float _b)
|
||||
{
|
||||
_result[0] = _a[0] - _b;
|
||||
_result[1] = _a[1] - _b;
|
||||
_result[2] = _a[2] - _b;
|
||||
}
|
||||
|
||||
inline void vec3Mul(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
inline void vec3Mul(float* _result, const float* _a, const float* _b)
|
||||
{
|
||||
_result[0] = _a[0] * _b[0];
|
||||
_result[1] = _a[1] * _b[1];
|
||||
_result[2] = _a[2] * _b[2];
|
||||
}
|
||||
|
||||
inline void vec3Mul(float* __restrict _result, const float* __restrict _a, float _b)
|
||||
inline void vec3Mul(float* _result, const float* _a, float _b)
|
||||
{
|
||||
_result[0] = _a[0] * _b;
|
||||
_result[1] = _a[1] * _b;
|
||||
_result[2] = _a[2] * _b;
|
||||
}
|
||||
|
||||
inline float vec3Dot(const float* __restrict _a, const float* __restrict _b)
|
||||
inline float vec3Dot(const float* _a, const float* _b)
|
||||
{
|
||||
return _a[0]*_b[0] + _a[1]*_b[1] + _a[2]*_b[2];
|
||||
}
|
||||
|
||||
inline void vec3Cross(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
inline void vec3Cross(float* _result, const float* _a, const float* _b)
|
||||
{
|
||||
_result[0] = _a[1]*_b[2] - _a[2]*_b[1];
|
||||
_result[1] = _a[2]*_b[0] - _a[0]*_b[2];
|
||||
@@ -346,21 +346,21 @@ namespace bx
|
||||
return fsqrt(vec3Dot(_a, _a) );
|
||||
}
|
||||
|
||||
inline void vec3Lerp(float* __restrict _result, const float* __restrict _a, const float* __restrict _b, float _t)
|
||||
inline void vec3Lerp(float* _result, const float* _a, const float* _b, float _t)
|
||||
{
|
||||
_result[0] = flerp(_a[0], _b[0], _t);
|
||||
_result[1] = flerp(_a[1], _b[1], _t);
|
||||
_result[2] = flerp(_a[2], _b[2], _t);
|
||||
}
|
||||
|
||||
inline void vec3Lerp(float* __restrict _result, const float* __restrict _a, const float* __restrict _b, const float* __restrict _c)
|
||||
inline void vec3Lerp(float* _result, const float* _a, const float* _b, const float* _c)
|
||||
{
|
||||
_result[0] = flerp(_a[0], _b[0], _c[0]);
|
||||
_result[1] = flerp(_a[1], _b[1], _c[1]);
|
||||
_result[2] = flerp(_a[2], _b[2], _c[2]);
|
||||
}
|
||||
|
||||
inline float vec3Norm(float* __restrict _result, const float* __restrict _a)
|
||||
inline float vec3Norm(float* _result, const float* _a)
|
||||
{
|
||||
const float len = vec3Length(_a);
|
||||
const float invLen = 1.0f/len;
|
||||
@@ -370,28 +370,28 @@ namespace bx
|
||||
return len;
|
||||
}
|
||||
|
||||
inline void vec3Min(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
inline void vec3Min(float* _result, const float* _a, const float* _b)
|
||||
{
|
||||
_result[0] = fmin(_a[0], _b[0]);
|
||||
_result[1] = fmin(_a[1], _b[1]);
|
||||
_result[2] = fmin(_a[2], _b[2]);
|
||||
}
|
||||
|
||||
inline void vec3Max(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
inline void vec3Max(float* _result, const float* _a, const float* _b)
|
||||
{
|
||||
_result[0] = fmax(_a[0], _b[0]);
|
||||
_result[1] = fmax(_a[1], _b[1]);
|
||||
_result[2] = fmax(_a[2], _b[2]);
|
||||
}
|
||||
|
||||
inline void vec3Rcp(float* __restrict _result, const float* __restrict _a)
|
||||
inline void vec3Rcp(float* _result, const float* _a)
|
||||
{
|
||||
_result[0] = 1.0f / _a[0];
|
||||
_result[1] = 1.0f / _a[1];
|
||||
_result[2] = 1.0f / _a[2];
|
||||
}
|
||||
|
||||
inline void vec3TangentFrame(const float* __restrict _n, float* __restrict _t, float* __restrict _b)
|
||||
inline void vec3TangentFrame(const float* _n, float* _t, float* _b)
|
||||
{
|
||||
const float nx = _n[0];
|
||||
const float ny = _n[1];
|
||||
@@ -415,7 +415,7 @@ namespace bx
|
||||
bx::vec3Cross(_b, _n, _t);
|
||||
}
|
||||
|
||||
inline void vec3TangentFrame(const float* __restrict _n, float* __restrict _t, float* __restrict _b, float _angle)
|
||||
inline void vec3TangentFrame(const float* _n, float* _t, float* _b, float _angle)
|
||||
{
|
||||
vec3TangentFrame(_n, _t, _b);
|
||||
|
||||
@@ -437,7 +437,7 @@ namespace bx
|
||||
_result[3] = 1.0f;
|
||||
}
|
||||
|
||||
inline void quatMove(float* __restrict _result, const float* __restrict _a)
|
||||
inline void quatMove(float* _result, const float* _a)
|
||||
{
|
||||
_result[0] = _a[0];
|
||||
_result[1] = _a[1];
|
||||
@@ -445,7 +445,7 @@ namespace bx
|
||||
_result[3] = _a[3];
|
||||
}
|
||||
|
||||
inline void quatMulXYZ(float* __restrict _result, const float* __restrict _qa, const float* __restrict _qb)
|
||||
inline void quatMulXYZ(float* _result, const float* _qa, const float* _qb)
|
||||
{
|
||||
const float ax = _qa[0];
|
||||
const float ay = _qa[1];
|
||||
@@ -462,7 +462,7 @@ namespace bx
|
||||
_result[2] = aw * bz + ax * by - ay * bx + az * bw;
|
||||
}
|
||||
|
||||
inline void quatMul(float* __restrict _result, const float* __restrict _qa, const float* __restrict _qb)
|
||||
inline void quatMul(float* _result, const float* _qa, const float* _qb)
|
||||
{
|
||||
const float ax = _qa[0];
|
||||
const float ay = _qa[1];
|
||||
@@ -480,7 +480,7 @@ namespace bx
|
||||
_result[3] = aw * bw - ax * bx - ay * by - az * bz;
|
||||
}
|
||||
|
||||
inline void quatInvert(float* __restrict _result, const float* __restrict _quat)
|
||||
inline void quatInvert(float* _result, const float* _quat)
|
||||
{
|
||||
_result[0] = -_quat[0];
|
||||
_result[1] = -_quat[1];
|
||||
@@ -488,7 +488,7 @@ namespace bx
|
||||
_result[3] = _quat[3];
|
||||
}
|
||||
|
||||
inline float quatDot(const float* __restrict _a, const float* __restrict _b)
|
||||
inline float quatDot(const float* _a, const float* _b)
|
||||
{
|
||||
return _a[0]*_b[0]
|
||||
+ _a[1]*_b[1]
|
||||
@@ -497,7 +497,7 @@ namespace bx
|
||||
;
|
||||
}
|
||||
|
||||
inline void quatNorm(float* __restrict _result, const float* __restrict _quat)
|
||||
inline void quatNorm(float* _result, const float* _quat)
|
||||
{
|
||||
const float norm = quatDot(_quat, _quat);
|
||||
if (0.0f < norm)
|
||||
@@ -514,7 +514,7 @@ namespace bx
|
||||
}
|
||||
}
|
||||
|
||||
inline void quatToEuler(float* __restrict _result, const float* __restrict _quat)
|
||||
inline void quatToEuler(float* _result, const float* _quat)
|
||||
{
|
||||
const float x = _quat[0];
|
||||
const float y = _quat[1];
|
||||
@@ -530,7 +530,7 @@ namespace bx
|
||||
_result[2] = fasin (2.0f * (x * y + z * w) );
|
||||
}
|
||||
|
||||
inline void quatRotateAxis(float* __restrict _result, const float* _axis, float _angle)
|
||||
inline void quatRotateAxis(float* _result, const float* _axis, float _angle)
|
||||
{
|
||||
const float ha = _angle * 0.5f;
|
||||
const float ca = fcos(ha);
|
||||
@@ -574,7 +574,7 @@ namespace bx
|
||||
_result[3] = cz;
|
||||
}
|
||||
|
||||
inline void vec3MulQuat(float* __restrict _result, const float* __restrict _vec, const float* __restrict _quat)
|
||||
inline void vec3MulQuat(float* _result, const float* _vec, const float* _quat)
|
||||
{
|
||||
float tmp0[4];
|
||||
quatInvert(tmp0, _quat);
|
||||
@@ -619,7 +619,7 @@ namespace bx
|
||||
mtxScale(_result, _scale, _scale, _scale);
|
||||
}
|
||||
|
||||
inline void mtxFromNormal(float* __restrict _result, const float* __restrict _normal, float _scale, const float* __restrict _pos)
|
||||
inline void mtxFromNormal(float* _result, const float* _normal, float _scale, const float* _pos)
|
||||
{
|
||||
float tangent[3];
|
||||
float bitangent[3];
|
||||
@@ -638,7 +638,7 @@ namespace bx
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxFromNormal(float* __restrict _result, const float* __restrict _normal, float _scale, const float* __restrict _pos, float _angle)
|
||||
inline void mtxFromNormal(float* _result, const float* _normal, float _scale, const float* _pos, float _angle)
|
||||
{
|
||||
float tangent[3];
|
||||
float bitangent[3];
|
||||
@@ -657,7 +657,7 @@ namespace bx
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxQuat(float* __restrict _result, const float* __restrict _quat)
|
||||
inline void mtxQuat(float* _result, const float* _quat)
|
||||
{
|
||||
const float x = _quat[0];
|
||||
const float y = _quat[1];
|
||||
@@ -698,7 +698,7 @@ namespace bx
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxQuatTranslation(float* __restrict _result, const float* __restrict _quat, const float* __restrict _translation)
|
||||
inline void mtxQuatTranslation(float* _result, const float* _quat, const float* _translation)
|
||||
{
|
||||
mtxQuat(_result, _quat);
|
||||
_result[12] = -(_result[0]*_translation[0] + _result[4]*_translation[1] + _result[ 8]*_translation[2]);
|
||||
@@ -706,7 +706,7 @@ namespace bx
|
||||
_result[14] = -(_result[2]*_translation[0] + _result[6]*_translation[1] + _result[10]*_translation[2]);
|
||||
}
|
||||
|
||||
inline void mtxQuatTranslationHMD(float* __restrict _result, const float* __restrict _quat, const float* __restrict _translation)
|
||||
inline void mtxQuatTranslationHMD(float* _result, const float* _quat, const float* _translation)
|
||||
{
|
||||
float quat[4];
|
||||
quat[0] = -_quat[0];
|
||||
@@ -716,7 +716,7 @@ namespace bx
|
||||
mtxQuatTranslation(_result, quat, _translation);
|
||||
}
|
||||
|
||||
inline void mtxLookAt_Impl(float* __restrict _result, const float* __restrict _eye, const float* __restrict _view, const float* __restrict _up)
|
||||
inline void mtxLookAt_Impl(float* _result, const float* _eye, const float* _view, const float* _up)
|
||||
{
|
||||
float up[3] = { 0.0f, 1.0f, 0.0f };
|
||||
if (NULL != _up)
|
||||
@@ -753,7 +753,7 @@ namespace bx
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxLookAtLh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up)
|
||||
inline void mtxLookAtLh(float* _result, const float* _eye, const float* _at, const float* _up)
|
||||
{
|
||||
float tmp[4];
|
||||
vec3Sub(tmp, _at, _eye);
|
||||
@@ -764,7 +764,7 @@ namespace bx
|
||||
mtxLookAt_Impl(_result, _eye, view, _up);
|
||||
}
|
||||
|
||||
inline void mtxLookAtRh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up)
|
||||
inline void mtxLookAtRh(float* _result, const float* _eye, const float* _at, const float* _up)
|
||||
{
|
||||
float tmp[4];
|
||||
vec3Sub(tmp, _eye, _at);
|
||||
@@ -775,7 +775,7 @@ namespace bx
|
||||
mtxLookAt_Impl(_result, _eye, view, _up);
|
||||
}
|
||||
|
||||
inline void mtxLookAt(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up)
|
||||
inline void mtxLookAt(float* _result, const float* _eye, const float* _at, const float* _up)
|
||||
{
|
||||
mtxLookAtLh(_result, _eye, _at, _up);
|
||||
}
|
||||
@@ -1168,14 +1168,14 @@ namespace bx
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void vec3MulMtx(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat)
|
||||
inline void vec3MulMtx(float* _result, const float* _vec, const float* _mat)
|
||||
{
|
||||
_result[0] = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _mat[12];
|
||||
_result[1] = _vec[0] * _mat[ 1] + _vec[1] * _mat[5] + _vec[2] * _mat[ 9] + _mat[13];
|
||||
_result[2] = _vec[0] * _mat[ 2] + _vec[1] * _mat[6] + _vec[2] * _mat[10] + _mat[14];
|
||||
}
|
||||
|
||||
inline void vec3MulMtxH(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat)
|
||||
inline void vec3MulMtxH(float* _result, const float* _vec, const float* _mat)
|
||||
{
|
||||
float xx = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _mat[12];
|
||||
float yy = _vec[0] * _mat[ 1] + _vec[1] * _mat[5] + _vec[2] * _mat[ 9] + _mat[13];
|
||||
@@ -1187,7 +1187,7 @@ namespace bx
|
||||
_result[2] = zz*invW;
|
||||
}
|
||||
|
||||
inline void vec4MulMtx(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat)
|
||||
inline void vec4MulMtx(float* _result, const float* _vec, const float* _mat)
|
||||
{
|
||||
_result[0] = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _vec[3] * _mat[12];
|
||||
_result[1] = _vec[0] * _mat[ 1] + _vec[1] * _mat[5] + _vec[2] * _mat[ 9] + _vec[3] * _mat[13];
|
||||
@@ -1195,7 +1195,7 @@ namespace bx
|
||||
_result[3] = _vec[0] * _mat[ 3] + _vec[1] * _mat[7] + _vec[2] * _mat[11] + _vec[3] * _mat[15];
|
||||
}
|
||||
|
||||
inline void mtxMul(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
inline void mtxMul(float* _result, const float* _a, const float* _b)
|
||||
{
|
||||
vec4MulMtx(&_result[ 0], &_a[ 0], _b);
|
||||
vec4MulMtx(&_result[ 4], &_a[ 4], _b);
|
||||
@@ -1203,7 +1203,7 @@ namespace bx
|
||||
vec4MulMtx(&_result[12], &_a[12], _b);
|
||||
}
|
||||
|
||||
inline void mtxTranspose(float* __restrict _result, const float* __restrict _a)
|
||||
inline void mtxTranspose(float* _result, const float* _a)
|
||||
{
|
||||
_result[ 0] = _a[ 0];
|
||||
_result[ 4] = _a[ 1];
|
||||
@@ -1224,7 +1224,7 @@ namespace bx
|
||||
}
|
||||
|
||||
/// Convert LH to RH projection matrix and vice versa.
|
||||
inline void mtxProjFlipHandedness(float* __restrict _dst, const float* __restrict _src)
|
||||
inline void mtxProjFlipHandedness(float* _dst, const float* _src)
|
||||
{
|
||||
_dst[ 0] = -_src[ 0];
|
||||
_dst[ 1] = -_src[ 1];
|
||||
@@ -1245,7 +1245,7 @@ namespace bx
|
||||
}
|
||||
|
||||
/// Convert LH to RH view matrix and vice versa.
|
||||
inline void mtxViewFlipHandedness(float* __restrict _dst, const float* __restrict _src)
|
||||
inline void mtxViewFlipHandedness(float* _dst, const float* _src)
|
||||
{
|
||||
_dst[ 0] = -_src[ 0];
|
||||
_dst[ 1] = _src[ 1];
|
||||
|
||||
@@ -23,35 +23,35 @@ namespace bx
|
||||
|
||||
///
|
||||
void radixSort(
|
||||
uint32_t* __restrict _keys
|
||||
, uint32_t* __restrict _tempKeys
|
||||
uint32_t* _keys
|
||||
, uint32_t* _tempKeys
|
||||
, uint32_t _size
|
||||
);
|
||||
|
||||
///
|
||||
template <typename Ty>
|
||||
void radixSort(
|
||||
uint32_t* __restrict _keys
|
||||
, uint32_t* __restrict _tempKeys
|
||||
, Ty* __restrict _values
|
||||
, Ty* __restrict _tempValues
|
||||
uint32_t* _keys
|
||||
, uint32_t* _tempKeys
|
||||
, Ty* _values
|
||||
, Ty* _tempValues
|
||||
, uint32_t _size
|
||||
);
|
||||
|
||||
///
|
||||
void radixSort(
|
||||
uint64_t* __restrict _keys
|
||||
, uint64_t* __restrict _tempKeys
|
||||
uint64_t* _keys
|
||||
, uint64_t* _tempKeys
|
||||
, uint32_t _size
|
||||
);
|
||||
|
||||
///
|
||||
template <typename Ty>
|
||||
void radixSort(
|
||||
uint64_t* __restrict _keys
|
||||
, uint64_t* __restrict _tempKeys
|
||||
, Ty* __restrict _values
|
||||
, Ty* __restrict _tempValues
|
||||
uint64_t* _keys
|
||||
, uint64_t* _tempKeys
|
||||
, Ty* _values
|
||||
, Ty* _tempValues
|
||||
, uint32_t _size
|
||||
);
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace bx
|
||||
#define BX_RADIXSORT_HISTOGRAM_SIZE (1<<BX_RADIXSORT_BITS)
|
||||
#define BX_RADIXSORT_BIT_MASK (BX_RADIXSORT_HISTOGRAM_SIZE-1)
|
||||
|
||||
inline void radixSort(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, uint32_t _size)
|
||||
inline void radixSort(uint32_t* _keys, uint32_t* _tempKeys, uint32_t _size)
|
||||
{
|
||||
uint32_t* __restrict keys = _keys;
|
||||
uint32_t* __restrict tempKeys = _tempKeys;
|
||||
uint32_t* keys = _keys;
|
||||
uint32_t* tempKeys = _tempKeys;
|
||||
|
||||
uint32_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE];
|
||||
uint16_t shift = 0;
|
||||
@@ -75,12 +75,12 @@ done:
|
||||
}
|
||||
|
||||
template <typename Ty>
|
||||
inline void radixSort(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size)
|
||||
inline void radixSort(uint32_t* _keys, uint32_t* _tempKeys, Ty* _values, Ty* _tempValues, uint32_t _size)
|
||||
{
|
||||
uint32_t* __restrict keys = _keys;
|
||||
uint32_t* __restrict tempKeys = _tempKeys;
|
||||
Ty* __restrict values = _values;
|
||||
Ty* __restrict tempValues = _tempValues;
|
||||
uint32_t* keys = _keys;
|
||||
uint32_t* tempKeys = _tempKeys;
|
||||
Ty* values = _values;
|
||||
Ty* tempValues = _tempValues;
|
||||
|
||||
uint32_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE];
|
||||
uint16_t shift = 0;
|
||||
@@ -147,10 +147,10 @@ done:
|
||||
}
|
||||
}
|
||||
|
||||
inline void radixSort(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, uint32_t _size)
|
||||
inline void radixSort(uint64_t* _keys, uint64_t* _tempKeys, uint32_t _size)
|
||||
{
|
||||
uint64_t* __restrict keys = _keys;
|
||||
uint64_t* __restrict tempKeys = _tempKeys;
|
||||
uint64_t* keys = _keys;
|
||||
uint64_t* tempKeys = _tempKeys;
|
||||
|
||||
uint32_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE];
|
||||
uint16_t shift = 0;
|
||||
@@ -209,12 +209,12 @@ done:
|
||||
}
|
||||
|
||||
template <typename Ty>
|
||||
inline void radixSort(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size)
|
||||
inline void radixSort(uint64_t* _keys, uint64_t* _tempKeys, Ty* _values, Ty* _tempValues, uint32_t _size)
|
||||
{
|
||||
uint64_t* __restrict keys = _keys;
|
||||
uint64_t* __restrict tempKeys = _tempKeys;
|
||||
Ty* __restrict values = _values;
|
||||
Ty* __restrict tempValues = _tempValues;
|
||||
uint64_t* keys = _keys;
|
||||
uint64_t* tempKeys = _tempKeys;
|
||||
Ty* values = _values;
|
||||
Ty* tempValues = _tempValues;
|
||||
|
||||
uint32_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE];
|
||||
uint16_t shift = 0;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace bx
|
||||
const float huge = HUGE_VALF;
|
||||
#endif // BX_COMPILER_MSVC
|
||||
|
||||
void mtx3Inverse(float* __restrict _result, const float* __restrict _a)
|
||||
void mtx3Inverse(float* _result, const float* _a)
|
||||
{
|
||||
float xx = _a[0];
|
||||
float xy = _a[1];
|
||||
@@ -49,7 +49,7 @@ namespace bx
|
||||
_result[8] = +(xx*yy - xy*yx) * invDet;
|
||||
}
|
||||
|
||||
void mtxInverse(float* __restrict _result, const float* __restrict _a)
|
||||
void mtxInverse(float* _result, const float* _a)
|
||||
{
|
||||
float xx = _a[ 0];
|
||||
float xy = _a[ 1];
|
||||
|
||||
Reference in New Issue
Block a user