|
|
@@ -341,7 +341,7 @@ namespace bx
|
|
|
_result[2] = 1.0f / _a[2];
|
|
|
}
|
|
|
|
|
|
- inline void vec3TangentFrame(const float* _n, float* _t, float* _b)
|
|
|
+ inline void vec3TangentFrame(const float* __restrict _n, float* __restrict _t, float* __restrict _b)
|
|
|
{
|
|
|
const float nx = _n[0];
|
|
|
const float ny = _n[1];
|
|
|
@@ -550,6 +550,25 @@ namespace bx
|
|
|
_result[15] = 1.0f;
|
|
|
}
|
|
|
|
|
|
+ inline void mtxFromNormal(float* __restrict _result, const float* __restrict _normal, float _scale, const float* __restrict _pos)
|
|
|
+ {
|
|
|
+ float tangent[3];
|
|
|
+ float bitangent[3];
|
|
|
+ vec3TangentFrame(_normal, tangent, bitangent);
|
|
|
+
|
|
|
+ vec3Mul(&_result[ 0], bitangent, _scale);
|
|
|
+ vec3Mul(&_result[ 4], _normal, _scale);
|
|
|
+ vec3Mul(&_result[ 8], tangent, _scale);
|
|
|
+
|
|
|
+ _result[ 3] = 0.0f;
|
|
|
+ _result[ 7] = 0.0f;
|
|
|
+ _result[11] = 0.0f;
|
|
|
+ _result[12] = _pos[0];
|
|
|
+ _result[13] = _pos[1];
|
|
|
+ _result[14] = _pos[2];
|
|
|
+ _result[15] = 1.0f;
|
|
|
+ }
|
|
|
+
|
|
|
inline void mtxQuat(float* __restrict _result, const float* __restrict _quat)
|
|
|
{
|
|
|
const float x = _quat[0];
|