mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-19 04:10:54 +00:00
ISA backends float3 and float4 - cleanup history squash
working for both neon32 and neon64 Update math_backend.cpp further sse simd additions avx2 float3 added added normalize_magnitude added divide fast to float3 may copy to float4 move static spheremesh to drawSphere (initialize on first use) so platform has a chance to load the math backend all float3 and float4 functions and isas completed all options of float3 and float4 functions in isas and math_c neon still to be done but that will be on mac. Update math_backend.cpp mac isa neon update added float3 restructured the classes to look more like the final version of the x86 classes linux required changes Update build-macos-clang.yml Update build-macos-clang.yml Revert "Update build-macos-clang.yml" This reverts commit29dfc567f4. Revert "Update build-macos-clang.yml" This reverts commit2abad2b4ca. Update CMakeLists.txt fix macs stupid build remove god awful rolling average from frame time tracker.... use intrinsic headers instead each isa implementation now uses a header for that isa's intrinsic functions these are then used in the impl files. This will make it easier for matrix functions when those are implemented. fixed comment saying 256 when it should be 512 for avx512 consolidated initializers for function tables Update neon_intrinsics.h fixes for some neon intrinsics no idea if this is the best way to do these but they work at least v_cross is especially messy at the moment we basically just do it as a c math function need to look into getting this done correctly
This commit is contained in:
parent
73ed502ac9
commit
67f12311d4
36 changed files with 1481 additions and 419 deletions
|
|
@ -29,6 +29,11 @@
|
|||
#ifndef _MPOINT2_H_
|
||||
#include "math/mPoint2.h"
|
||||
#endif
|
||||
#ifndef _MATH_BACKEND_H_
|
||||
#include "math/public/math_backend.h"
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// 3D integer point
|
||||
|
|
@ -97,6 +102,7 @@ public:
|
|||
class Point3D;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
using math_backend::float3::dispatch::gFloat3;
|
||||
class Point3F
|
||||
{
|
||||
//-------------------------------------- Public data
|
||||
|
|
@ -497,7 +503,8 @@ inline void Point3F::setMax(const Point3F& _test)
|
|||
inline void Point3F::interpolate(const Point3F& _from, const Point3F& _to, F32 _factor)
|
||||
{
|
||||
AssertFatal(_factor >= 0.0f && _factor <= 1.0f, "Out of bound interpolation factor");
|
||||
m_point3F_interpolate( _from, _to, _factor, *this);
|
||||
|
||||
gFloat3.lerp(_from, _to, _factor, *this);
|
||||
}
|
||||
|
||||
inline void Point3F::zero()
|
||||
|
|
@ -599,17 +606,17 @@ inline void Point3F::convolveInverse(const Point3F& c)
|
|||
|
||||
inline F32 Point3F::lenSquared() const
|
||||
{
|
||||
return (x * x) + (y * y) + (z * z);
|
||||
return gFloat3.lengthSquared(*this);
|
||||
}
|
||||
|
||||
inline F32 Point3F::len() const
|
||||
{
|
||||
return mSqrt(x*x + y*y + z*z);
|
||||
return gFloat3.length(*this);
|
||||
}
|
||||
|
||||
inline void Point3F::normalize()
|
||||
{
|
||||
m_point3F_normalize(*this);
|
||||
gFloat3.normalize(*this);
|
||||
}
|
||||
|
||||
inline F32 Point3F::magnitudeSafe() const
|
||||
|
|
@ -626,18 +633,13 @@ inline F32 Point3F::magnitudeSafe() const
|
|||
|
||||
inline void Point3F::normalizeSafe()
|
||||
{
|
||||
F32 vmag = magnitudeSafe();
|
||||
|
||||
if( vmag > POINT_EPSILON )
|
||||
{
|
||||
*this *= F32(1.0 / vmag);
|
||||
}
|
||||
gFloat3.normalize(*this);
|
||||
}
|
||||
|
||||
|
||||
inline void Point3F::normalize(F32 val)
|
||||
{
|
||||
m_point3F_normalize_f(*this, val);
|
||||
gFloat3.normalize_mag(*this, val);
|
||||
}
|
||||
|
||||
inline bool Point3F::operator==(const Point3F& _test) const
|
||||
|
|
@ -652,52 +654,49 @@ inline bool Point3F::operator!=(const Point3F& _test) const
|
|||
|
||||
inline Point3F Point3F::operator+(const Point3F& _add) const
|
||||
{
|
||||
return Point3F(x + _add.x, y + _add.y, z + _add.z);
|
||||
Point3F temp;
|
||||
gFloat3.add(*this, _add, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline Point3F Point3F::operator-(const Point3F& _rSub) const
|
||||
{
|
||||
return Point3F(x - _rSub.x, y - _rSub.y, z - _rSub.z);
|
||||
Point3F temp;
|
||||
gFloat3.sub(*this, _rSub, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline Point3F& Point3F::operator+=(const Point3F& _add)
|
||||
{
|
||||
x += _add.x;
|
||||
y += _add.y;
|
||||
z += _add.z;
|
||||
|
||||
gFloat3.add(*this, _add, *this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Point3F& Point3F::operator-=(const Point3F& _rSub)
|
||||
{
|
||||
x -= _rSub.x;
|
||||
y -= _rSub.y;
|
||||
z -= _rSub.z;
|
||||
|
||||
gFloat3.sub(*this, _rSub, *this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Point3F Point3F::operator*(F32 _mul) const
|
||||
{
|
||||
return Point3F(x * _mul, y * _mul, z * _mul);
|
||||
Point3F temp;
|
||||
gFloat3.mul_scalar(*this, _mul, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline Point3F Point3F::operator/(F32 _div) const
|
||||
{
|
||||
AssertFatal(_div != 0.0f, "Error, div by zero attempted");
|
||||
|
||||
F32 inv = 1.0f / _div;
|
||||
|
||||
return Point3F(x * inv, y * inv, z * inv);
|
||||
Point3F temp;
|
||||
gFloat3.div_scalar(*this, _div, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline Point3F& Point3F::operator*=(F32 _mul)
|
||||
{
|
||||
x *= _mul;
|
||||
y *= _mul;
|
||||
z *= _mul;
|
||||
|
||||
gFloat3.mul_scalar(*this, _mul, *this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -705,39 +704,35 @@ inline Point3F& Point3F::operator/=(F32 _div)
|
|||
{
|
||||
AssertFatal(_div != 0.0f, "Error, div by zero attempted");
|
||||
|
||||
F32 inv = 1.0f / _div;
|
||||
x *= inv;
|
||||
y *= inv;
|
||||
z *= inv;
|
||||
|
||||
gFloat3.div_scalar(*this, _div, *this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Point3F Point3F::operator*(const Point3F &_vec) const
|
||||
{
|
||||
return Point3F(x * _vec.x, y * _vec.y, z * _vec.z);
|
||||
Point3F temp;
|
||||
gFloat3.mul(*this, _vec, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline Point3F& Point3F::operator*=(const Point3F &_vec)
|
||||
{
|
||||
x *= _vec.x;
|
||||
y *= _vec.y;
|
||||
z *= _vec.z;
|
||||
gFloat3.mul(*this, _vec, *this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Point3F Point3F::operator/(const Point3F &_vec) const
|
||||
{
|
||||
AssertFatal(_vec.x != 0.0f && _vec.y != 0.0f && _vec.z != 0.0f, "Error, div by zero attempted");
|
||||
return Point3F(x / _vec.x, y / _vec.y, z / _vec.z);
|
||||
Point3F temp;
|
||||
gFloat3.div(*this, _vec, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline Point3F& Point3F::operator/=(const Point3F &_vec)
|
||||
{
|
||||
AssertFatal(_vec.x != 0.0f && _vec.y != 0.0f && _vec.z != 0.0f, "Error, div by zero attempted");
|
||||
x /= _vec.x;
|
||||
y /= _vec.y;
|
||||
z /= _vec.z;
|
||||
gFloat3.div(*this, _vec, *this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -989,7 +984,9 @@ inline Point3I operator*(S32 mul, const Point3I& multiplicand)
|
|||
|
||||
inline Point3F operator*(F32 mul, const Point3F& multiplicand)
|
||||
{
|
||||
return multiplicand * mul;
|
||||
Point3F temp;
|
||||
gFloat3.mul_scalar(multiplicand, mul, temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
inline Point3D operator*(F64 mul, const Point3D& multiplicand)
|
||||
|
|
@ -999,7 +996,7 @@ inline Point3D operator*(F64 mul, const Point3D& multiplicand)
|
|||
|
||||
inline F32 mDot(const Point3F &p1, const Point3F &p2)
|
||||
{
|
||||
return (p1.x*p2.x + p1.y*p2.y + p1.z*p2.z);
|
||||
return gFloat3.dot(p1, p2);
|
||||
}
|
||||
|
||||
inline F64 mDot(const Point3D &p1, const Point3D &p2)
|
||||
|
|
@ -1009,9 +1006,7 @@ inline F64 mDot(const Point3D &p1, const Point3D &p2)
|
|||
|
||||
inline void mCross(const Point3F &a, const Point3F &b, Point3F *res)
|
||||
{
|
||||
res->x = (a.y * b.z) - (a.z * b.y);
|
||||
res->y = (a.z * b.x) - (a.x * b.z);
|
||||
res->z = (a.x * b.y) - (a.y * b.x);
|
||||
gFloat3.cross(a, b, *res);
|
||||
}
|
||||
|
||||
inline void mCross(const Point3D &a, const Point3D &b, Point3D *res)
|
||||
|
|
@ -1024,7 +1019,7 @@ inline void mCross(const Point3D &a, const Point3D &b, Point3D *res)
|
|||
inline Point3F mCross(const Point3F &a, const Point3F &b)
|
||||
{
|
||||
Point3F r;
|
||||
mCross( a, b, &r );
|
||||
gFloat3.cross(a, b, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue