summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bx/include
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-06-08 19:50:19 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-06-08 20:42:23 +0200
commita3af73bafcac0f94de44430b6e2b521aac5481a9 (patch)
tree0f46ad9c3575bdfd58dfa6140c24d01da30b787c /3rdparty/bx/include
parente8cb3e06d030cd4a04df0db786081af6436288c2 (diff)
BGFX and BX update (nw)
Diffstat (limited to '3rdparty/bx/include')
-rw-r--r--3rdparty/bx/include/bx/fpumath.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/3rdparty/bx/include/bx/fpumath.h b/3rdparty/bx/include/bx/fpumath.h
index 2335ad4f2f3..5f64564f688 100644
--- a/3rdparty/bx/include/bx/fpumath.h
+++ b/3rdparty/bx/include/bx/fpumath.h
@@ -341,6 +341,30 @@ namespace bx
_result[2] = 1.0f / _a[2];
}
+ inline void vec3TangentFrame(const float* _n, float* _t, float* _b)
+ {
+ const float nx = _n[0];
+ const float ny = _n[1];
+ const float nz = _n[2];
+
+ if (bx::fabsolute(nx) > bx::fabsolute(nz) )
+ {
+ float invLen = 1.0f / bx::fsqrt(nx*nx + nz*nz);
+ _t[0] = -nz * invLen;
+ _t[1] = 0.0f;
+ _t[2] = nx * invLen;
+ }
+ else
+ {
+ float invLen = 1.0f / bx::fsqrt(ny*ny + nz*nz);
+ _t[0] = 0.0f;
+ _t[1] = nz * invLen;
+ _t[2] = -ny * invLen;
+ }
+
+ bx::vec3Cross(_b, _n, _t);
+ }
+
inline void quatIdentity(float* _result)
{
_result[0] = 0.0f;