Răsfoiți Sursa

Make everything compile

Panagiotis Christopoulos Charitos 6 ani în urmă
părinte
comite
321558563c

+ 8 - 2
src/anki/Math.h

@@ -5,8 +5,14 @@
 
 #pragma once
 
-#include <anki/math/CommonIncludes.h>
-#include <anki/math/CommonSrc.h>
+#include <anki/math/Vec.h>
+#include <anki/math/Mat.h>
+#include <anki/math/Quat.h>
+#include <anki/math/Euler.h>
+#include <anki/math/Axisang.h>
+#include <anki/math/Transform.h>
+#include <anki/math/F16.h>
+
 #include <anki/math/Functions.h>
 
 /// @defgroup math Math library

+ 1 - 1
src/anki/collision/FunctionsTestPlane.cpp

@@ -94,7 +94,7 @@ F32 testPlane(const Plane& plane, const Obb& obb)
 
 	// maximum extent in direction of plane normal
 	const Vec4 rv = obb.getExtend() * xNormal;
-	const Vec4 rvabs = rv.getAbs();
+	const Vec4 rvabs = rv.abs();
 	const F32 r = rvabs.x() + rvabs.y() + rvabs.z();
 
 	// signed distance between box center and plane

+ 13 - 24
src/anki/math/Axisang.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include <anki/math/CommonIncludes.h>
+#include <anki/math/Common.h>
 
 namespace anki
 {
@@ -21,8 +21,6 @@ public:
 	/// @name Constructors
 	/// @{
 	TAxisang()
-		: m_ang(0.0)
-		, m_axis(0.0)
 	{
 	}
 
@@ -32,7 +30,7 @@ public:
 	{
 	}
 
-	TAxisang(const T rad, const TVec3<T>& axis)
+	TAxisang(const T rad, const TVec<T, 3>& axis)
 		: m_ang(rad)
 		, m_axis(axis)
 	{
@@ -45,15 +43,15 @@ public:
 		if(!isZero<T>(length))
 		{
 			length = 1.0 / length;
-			m_axis = TVec3<T>(q.x() * length, q.y() * length, q.z() * length);
+			m_axis = TVec<T, 3>(q.x() * length, q.y() * length, q.z() * length);
 		}
 		else
 		{
-			m_axis = TVec3<T>(0.0);
+			m_axis = TVec<T, 3>(0.0);
 		}
 	}
 
-	explicit TAxisang(const TMat3<T>& m3)
+	explicit TAxisang(const TMat<T, 3, 3>& m3)
 	{
 		if(isZero<T>(m3(0, 1) - m3(1, 0)) && isZero<T>(m3(0, 2) - m3(2, 0)) && isZero<T>(m3(1, 2) - m3(2, 1)))
 		{
@@ -61,7 +59,7 @@ public:
 			if((absolute<T>(m3(0, 1) + m3(1, 0)) < 0.1) && (absolute<T>(m3(0, 2) + m3(2, 0)) < 0.1)
 				&& (absolute<T>(m3(1, 2) + m3(2, 1)) < 0.1) && (absolute<T>(m3(0, 0) + m3(1, 1) + m3(2, 2)) - 3) < 0.1)
 			{
-				m_axis = TVec3<T>(1.0, 0.0, 0.0);
+				m_axis = TVec<T, 3>(1.0, 0.0, 0.0);
 				m_ang = 0.0;
 				return;
 			}
@@ -159,17 +157,17 @@ public:
 		m_ang = a;
 	}
 
-	const TVec3<T>& getAxis() const
+	const TVec<T, 3>& getAxis() const
 	{
 		return m_axis;
 	}
 
-	TVec3<T>& getAxis()
+	TVec<T, 3>& getAxis()
 	{
 		return m_axis;
 	}
 
-	void setAxis(const TVec3<T>& a)
+	void setAxis(const TVec<T, 3>& a)
 	{
 		m_axis = a;
 	}
@@ -185,28 +183,19 @@ public:
 	}
 	/// @}
 
-	/// @name Other
-	/// @{
-	template<typename TAlloc>
-	String toString(TAlloc alloc) const
-	{
-		String s;
-		Error err = s.sprintf("axis: %f %f %f, angle: %f", m_axis[0], m_axis[1], m_axis[2], m_ang);
-		(void)err;
-		return s;
-	}
-	/// @}
-
 private:
 	/// @name Data
 	/// @{
 	T m_ang;
-	TVec3<T> m_axis;
+	TVec<T, 3> m_axis;
 	/// @}
 };
 
 /// F32 Axisang
 using Axisang = TAxisang<F32>;
+
+/// F64 Axisang
+using DAxisang = TAxisang<F64>;
 /// @}
 
 } // end namespace anki

+ 0 - 12
src/anki/math/CommonIncludes.h

@@ -1,12 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <anki/math/Forward.h>
-#include <anki/math/Functions.h>
-#include <anki/math/Simd.h>
-#include <anki/util/StdTypes.h>
-#include <anki/util/Array.h>
-#include <anki/util/Assert.h>
-#include <anki/util/String.h>

+ 6 - 16
src/anki/math/Euler.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include <anki/math/CommonIncludes.h>
+#include <anki/math/Common.h>
 
 namespace anki
 {
@@ -22,7 +22,6 @@ public:
 	/// @{
 	TEuler()
 	{
-		x() = y() = z() = 0.0;
 	}
 
 	TEuler(const T x_, const T y_, const T z_)
@@ -41,7 +40,7 @@ public:
 
 	explicit TEuler(const TQuat<T>& q)
 	{
-		T test = q.x() * q.y() + q.z() * q.w();
+		const T test = q.x() * q.y() + q.z() * q.w();
 		if(test > 0.499)
 		{
 			y() = 2.0 * atan2<T>(q.x(), q.w());
@@ -65,7 +64,7 @@ public:
 		x() = atan2<T>(2.0 * q.x() * q.w() - 2.0 * q.y() * q.z(), 1.0 - 2.0 * sqx - 2.0 * sqz);
 	}
 
-	explicit TEuler(const TMat3<T>& m3)
+	explicit TEuler(const TMat<T, 3, 3>& m3)
 	{
 		T cx, sx;
 		T cy, sy;
@@ -151,18 +150,6 @@ public:
 	}
 	/// @}
 
-	/// @name Other
-	/// @{
-	template<typename TAlloc>
-	String toString(TAlloc alloc) const
-	{
-		String s;
-		Error err = s.sprintf("%f %f %f", x(), y(), z());
-		(void)err;
-		return s;
-	}
-	/// @}
-
 private:
 	/// @name Data
 	/// @{
@@ -181,6 +168,9 @@ private:
 
 /// F32 Euler angles
 using Euler = TEuler<F32>;
+
+/// F64 Euler angles
+using DEuler = TEuler<F64>;
 /// @}
 
 } // end namespace anki

+ 6 - 6
src/anki/math/F16.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include <anki/math/CommonIncludes.h>
+#include <anki/math/Common.h>
 
 namespace anki
 {
@@ -29,6 +29,7 @@ public:
 	/// @{
 	F16()
 	{
+		static_assert(sizeof(F16) == 2, "Incorrect size");
 	}
 
 	F16(const F16& b)
@@ -193,30 +194,29 @@ private:
 	static F16 toF16(F32 f);
 };
 
-/// @name F16 friends
-/// @{
+/// @memberof F16
 inline F32 operator+(const F32 f, const F16 h)
 {
 	return f + h.toF32();
 }
 
+/// @memberof F16
 inline F32 operator-(const F32 f, const F16 h)
 {
 	return f - h.toF32();
 }
 
+/// @memberof F16
 inline F32 operator*(const F32 f, const F16 h)
 {
 	return f * h.toF32();
 }
 
+/// @memberof F16
 inline F32 operator/(const F32 f, const F16 h)
 {
 	return f / h.toF32();
 }
 /// @}
-/// @}
-
-static_assert(sizeof(F16) == 2, "Incorrect size");
 
 } // end namespace anki

+ 2 - 16
src/anki/math/Forward.h

@@ -12,24 +12,10 @@ namespace anki
 
 class F16;
 
-template<typename T, U N, typename TV>
+template<typename T, U N>
 class TVec;
-template<typename T>
-class TVec2;
-template<typename T>
-class TVec3;
-template<typename T>
-class TVec4;
-
-template<typename T, U J, U I, typename TM, typename TVJ, typename TVI>
+template<typename T, U J, U I>
 class TMat;
-template<typename T>
-class TMat3;
-template<typename T>
-class TMat3x4;
-template<typename T>
-class TMat4;
-
 template<typename T>
 class TQuat;
 template<typename T>

Fișier diff suprimat deoarece este prea mare
+ 411 - 99
src/anki/math/Mat.h


+ 0 - 136
src/anki/math/Mat3.h

@@ -1,136 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/math/CommonIncludes.h>
-#include <anki/math/Mat.h>
-
-namespace anki
-{
-
-/// @addtogroup math
-/// @{
-
-/// 3x3 Matrix. Mainly used for rotations. It includes many helpful member functions. Its row major. The columns are
-/// the x,y,z axis @note TMat3*TMat3: 27 muls 18 adds
-template<typename T>
-class TMat3 : public TMat<T, 3, 3, TMat3<T>, TVec3<T>, TVec3<T>>
-{
-	/// @name Friends
-	/// @{
-	template<typename Y>
-	friend TMat3<Y> operator+(Y f, const TMat3<Y>& m3);
-	template<typename Y>
-	friend TMat3<Y> operator-(Y f, const TMat3<Y>& m3);
-	template<typename Y>
-	friend TMat3<Y> operator*(Y f, const TMat3<Y>& m3);
-	template<typename Y>
-	friend TMat3<Y> operator/(Y f, const TMat3<Y>& m3);
-	/// @}
-
-public:
-	using Base = TMat<T, 3, 3, TMat3<T>, TVec3<T>, TVec3<T>>;
-
-	using Base::setRotationPart;
-	using Base::Base;
-
-	/// @name Other
-	/// @{
-	T getDet() const
-	{
-		const TMat3& m = *this;
-		// For the accurate method see < r664
-		return m(0, 0) * (m(1, 1) * m(2, 2) - m(1, 2) * m(2, 1)) - m(0, 1) * (m(1, 0) * m(2, 2) - m(1, 2) * m(2, 0))
-			   + m(0, 2) * (m(0, 1) * m(2, 1) - m(1, 1) * m(2, 0));
-	}
-
-	TMat3 getInverse() const
-	{
-		// Using Gramer's method Inv(A) = (1 / getDet(A)) * Adj(A)
-		const TMat3& m = *this;
-		TMat3 r;
-
-		// compute determinant
-		T cofactor0 = m(1, 1) * m(2, 2) - m(1, 2) * m(2, 1);
-		T cofactor3 = m(0, 2) * m(2, 1) - m(0, 1) * m(2, 2);
-		T cofactor6 = m(0, 1) * m(1, 2) - m(0, 2) * m(1, 1);
-		T det = m(0, 0) * cofactor0 + m(1, 0) * cofactor3 + m(2, 0) * cofactor6;
-
-		ANKI_ASSERT(!isZero<T>(det)); // Cannot invert det == 0
-
-		// create adjoint matrix and multiply by 1/det to get inverse
-		T invDet = 1.0 / det;
-		r(0, 0) = invDet * cofactor0;
-		r(0, 1) = invDet * cofactor3;
-		r(0, 2) = invDet * cofactor6;
-
-		r(1, 0) = invDet * (m(1, 2) * m(2, 0) - m(1, 0) * m(2, 2));
-		r(1, 1) = invDet * (m(0, 0) * m(2, 2) - m(0, 2) * m(2, 0));
-		r(1, 2) = invDet * (m(0, 2) * m(1, 0) - m(0, 0) * m(1, 2));
-
-		r(2, 0) = invDet * (m(1, 0) * m(2, 1) - m(1, 1) * m(2, 0));
-		r(2, 1) = invDet * (m(0, 1) * m(2, 0) - m(0, 0) * m(2, 1));
-		r(2, 2) = invDet * (m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0));
-
-		return r;
-	}
-
-	void invert()
-	{
-		(*this) = getInverse();
-	}
-	/// @}
-};
-
-/// @memberof TMat3
-template<typename T>
-TMat3<T> operator+(T f, const TMat3<T>& m3)
-{
-	return m3 + f;
-}
-
-/// @memberof TMat3
-template<typename T>
-TMat3<T> operator-(T f, const TMat3<T>& m3)
-{
-	TMat3<T> out;
-	for(U i = 0; i < 9; i++)
-	{
-		out[i] = f - m3[i];
-	}
-	return out;
-}
-
-/// @memberof TMat3
-template<typename T>
-TMat3<T> operator*(T f, const TMat3<T>& m3)
-{
-	return m3 * f;
-}
-
-/// @memberof TMat3
-template<typename T>
-TMat3<T> operator/(T f, const TMat3<T>& m3)
-{
-	TMat3<T> out;
-	for(U i = 0; i < 9; i++)
-	{
-		ANKI_ASSERT(m3[i] != T(0));
-		out[i] = f / m3[i];
-	}
-	return out;
-}
-
-/// F32 3x3 matrix
-using Mat3 = TMat3<F32>;
-static_assert(sizeof(Mat3) == sizeof(F32) * 3 * 3, "Incorrect size");
-
-/// F64 3x3 matrix
-using DMat3 = TMat3<F64>;
-static_assert(sizeof(DMat3) == sizeof(F64) * 3 * 3, "Incorrect size");
-/// @}
-
-} // end namespace anki

+ 0 - 147
src/anki/math/Mat3x4.h

@@ -1,147 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/math/CommonIncludes.h>
-#include <anki/math/Mat.h>
-
-namespace anki
-{
-
-/// @addtogroup math
-/// @{
-
-/// 3x4 Matrix. Mainly used for transformations. It includes many helpful member functions. Its row major. The columns
-/// are the x,y,z axis
-template<typename T>
-class alignas(16) TMat3x4 : public TMat<T, 3, 4, TMat3x4<T>, TVec4<T>, TVec3<T>>
-{
-public:
-	using Base = TMat<T, 3, 4, TMat3x4<T>, TVec4<T>, TVec3<T>>;
-
-	using Base::Base;
-
-	/// @name Constructors
-	/// @{
-	explicit TMat3x4(const TMat3<T>& m3)
-	{
-		TMat3x4& m = *this;
-		m(0, 0) = m3(0, 0);
-		m(0, 1) = m3(0, 1);
-		m(0, 2) = m3(0, 2);
-		m(0, 3) = static_cast<T>(0);
-		m(1, 0) = m3(1, 0);
-		m(1, 1) = m3(1, 1);
-		m(1, 2) = m3(1, 2);
-		m(1, 3) = static_cast<T>(0);
-		m(2, 0) = m3(2, 0);
-		m(2, 1) = m3(2, 1);
-		m(2, 2) = m3(2, 2);
-		m(2, 3) = static_cast<T>(0);
-	}
-
-	explicit TMat3x4(const TMat4<T>& m3)
-	{
-		TMat3x4& m = *this;
-		m(0, 0) = m3(0, 0);
-		m(0, 1) = m3(0, 1);
-		m(0, 2) = m3(0, 2);
-		m(0, 3) = m3(0, 3);
-		m(1, 0) = m3(1, 0);
-		m(1, 1) = m3(1, 1);
-		m(1, 2) = m3(1, 2);
-		m(1, 3) = m3(1, 3);
-		m(2, 0) = m3(2, 0);
-		m(2, 1) = m3(2, 1);
-		m(2, 2) = m3(2, 2);
-		m(2, 3) = m3(2, 3);
-	}
-
-	explicit TMat3x4(const TVec3<T>& v)
-	{
-		TMat3x4& m = *this;
-		m(0, 0) = static_cast<T>(1);
-		m(0, 1) = static_cast<T>(0);
-		m(0, 2) = static_cast<T>(0);
-		m(0, 3) = v.x();
-		m(1, 0) = static_cast<T>(0);
-		m(1, 1) = static_cast<T>(1);
-		m(1, 2) = static_cast<T>(0);
-		m(1, 3) = v.y();
-		m(2, 0) = static_cast<T>(0);
-		m(2, 1) = static_cast<T>(0);
-		m(2, 2) = static_cast<T>(1);
-		m(2, 3) = v.z();
-	}
-
-	explicit TMat3x4(const TQuat<T>& q)
-	{
-		Base::setRotationPart(TMat3<T>(q));
-		Base::setTranslationPart(TVec3<T>(static_cast<T>(0)));
-	}
-
-	explicit TMat3x4(const TEuler<T>& b)
-	{
-		Base::setRotationPart(TMat3<T>(b));
-		Base::setTranslationPart(TVec3<T>(static_cast<T>(0)));
-	}
-
-	explicit TMat3x4(const TAxisang<T>& b)
-	{
-		Base::setRotationPart(TAxisang<T>(b));
-		Base::setTranslationPart(TVec3<T>(static_cast<T>(0)));
-	}
-
-	TMat3x4(const TVec3<T>& transl, const TMat3<T>& rot)
-	{
-		Base::setRotationPart(rot);
-		Base::setTranslationPart(transl);
-	}
-
-	TMat3x4(const TVec3<T>& transl, const TMat3<T>& rot, const T scale)
-	{
-		if(isZero<T>(scale - static_cast<T>(1)))
-		{
-			Base::setRotationPart(rot);
-		}
-		else
-		{
-			setRotationPart(rot * scale);
-		}
-
-		Base::setTranslationPart(transl);
-	}
-
-	explicit TMat3x4(const TTransform<T>& t)
-	{
-		(*this) = TMat3x4(t.getOrigin(), t.getRotation(), t.getScale());
-	}
-	/// @}
-};
-
-#if ANKI_SIMD == ANKI_SIMD_SSE
-
-// Forward declare specializations
-
-using TMat3x4F32Base = TMat3x4<F32>::Base;
-
-template<>
-inline TVec3<F32> TMat3x4F32Base::operator*(const TVec4<F32>& b) const;
-
-#elif ANKI_SIMD == ANKI_SIMD_NEON
-
-#	error "TODO"
-
-#endif
-
-/// F32 4x4 matrix
-using Mat3x4 = TMat3x4<F32>;
-static_assert(sizeof(Mat3x4) == sizeof(F32) * 3 * 4, "Incorrect size");
-/// @}
-
-} // end namespace anki
-
-#include <anki/math/Mat3x4.inl.h>

+ 0 - 28
src/anki/math/Mat3x4.inl.h

@@ -1,28 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <anki/math/CommonSrc.h>
-
-namespace anki
-{
-
-#if ANKI_SIMD == ANKI_SIMD_SSE
-
-template<>
-inline TVec3<F32> TMat3x4F32Base::operator*(const TVec4<F32>& b) const
-{
-	TVec3<F32> v;
-
-	for(U i = 0; i < 3; i++)
-	{
-		_mm_store_ss(&v[i], _mm_dp_ps(m_simd[i], b.getSimd(), 0xF1));
-	}
-
-	return v;
-}
-
-#endif
-
-} // end namespace anki

+ 0 - 235
src/anki/math/Mat4.h

@@ -1,235 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/math/CommonIncludes.h>
-
-namespace anki
-{
-
-/// @addtogroup math
-/// @{
-
-/// 4x4 Matrix. Used mainly for transformations but not necessarily. It's row major. SSE optimized
-/// @note TMat4*TMat4: 64 muls 48 adds
-template<typename T>
-class alignas(16) TMat4 : public TMat<T, 4, 4, TMat4<T>, TVec4<T>, TVec4<T>>
-{
-	/// @name Friends
-	/// @{
-	template<typename Y>
-	friend TMat4<Y> operator+(const Y f, const TMat4<Y>& m4);
-	template<typename Y>
-	friend TMat4<Y> operator-(const Y f, const TMat4<Y>& m4);
-	template<typename Y>
-	friend TMat4<Y> operator*(const Y f, const TMat4<Y>& m4);
-	template<typename Y>
-	friend TMat4<Y> operator/(const Y f, const TMat4<Y>& m4);
-	/// @}
-
-public:
-	using Base = TMat<T, 4, 4, TMat4<T>, TVec4<T>, TVec4<T>>;
-
-	using Base::getTranslationPart;
-	using Base::setTranslationPart;
-	using Base::getRotationPart;
-	using Base::setRotationPart;
-	using Base::Base;
-
-	/// @name Constructors
-	/// @{
-	explicit TMat4(const TMat3<T>& m3)
-	{
-		TMat4& m = *this;
-		m(0, 0) = m3(0, 0);
-		m(0, 1) = m3(0, 1);
-		m(0, 2) = m3(0, 2);
-		m(0, 3) = 0.0;
-		m(1, 0) = m3(1, 0);
-		m(1, 1) = m3(1, 1);
-		m(1, 2) = m3(1, 2);
-		m(1, 3) = 0.0;
-		m(2, 0) = m3(2, 0);
-		m(2, 1) = m3(2, 1);
-		m(2, 2) = m3(2, 2);
-		m(2, 3) = 0.0;
-		m(3, 0) = 0.0;
-		m(3, 1) = 0.0;
-		m(3, 2) = 0.0;
-		m(3, 3) = 1.0;
-	}
-
-	explicit TMat4(const TVec3<T>& v)
-	{
-		TMat4& m = *this;
-		m(0, 0) = 1.0;
-		m(0, 1) = 0.0;
-		m(0, 2) = 0.0;
-		m(0, 3) = v.x();
-		m(1, 0) = 0.0;
-		m(1, 1) = 1.0;
-		m(1, 2) = 0.0;
-		m(1, 3) = v.y();
-		m(2, 0) = 0.0;
-		m(2, 1) = 0.0;
-		m(2, 2) = 1.0;
-		m(2, 3) = v.z();
-		m(3, 0) = 0.0;
-		m(3, 1) = 0.0;
-		m(3, 2) = 0.0;
-		m(3, 3) = 1.0;
-	}
-
-	explicit TMat4(const TVec4<T>& v)
-	{
-		TMat4& m = *this;
-		m(0, 0) = 1.0;
-		m(0, 1) = 0.0;
-		m(0, 2) = 0.0;
-		m(0, 3) = v.x();
-		m(1, 0) = 0.0;
-		m(1, 1) = 1.0;
-		m(1, 2) = 0.0;
-		m(1, 3) = v.y();
-		m(2, 0) = 0.0;
-		m(2, 1) = 0.0;
-		m(2, 2) = 1.0;
-		m(2, 3) = v.z();
-		m(3, 0) = 0.0;
-		m(3, 1) = 0.0;
-		m(3, 2) = 0.0;
-		m(3, 3) = v.w();
-	}
-
-	TMat4(const TVec4<T>& transl, const TMat3<T>& rot)
-	{
-		setRotationPart(rot);
-		setTranslationPart(transl);
-		TMat4& m = *this;
-		m(3, 0) = m(3, 1) = m(3, 2) = 0.0;
-	}
-
-	TMat4(const TVec4<T>& transl, const TMat3<T>& rot, const T scale)
-	{
-		if(isZero<T>(scale - 1.0))
-		{
-			setRotationPart(rot);
-		}
-		else
-		{
-			setRotationPart(rot * scale);
-		}
-
-		setTranslationPart(transl);
-
-		TMat4& m = *this;
-		m(3, 0) = m(3, 1) = m(3, 2) = 0.0;
-	}
-
-	explicit TMat4(const TTransform<T>& t)
-		: TMat4(TVec4<T>(t.getOrigin().xyz(), 1.0), t.getRotation().getRotationPart(), t.getScale())
-	{
-	}
-	/// @}
-
-	/// @name Other
-	/// @{
-
-	/// If we suppose this matrix represents a transformation, return the inverted transformation
-	TMat4 getInverseTransformation() const
-	{
-		TMat3<T> invertedRot = getRotationPart().getTransposed();
-		TVec3<T> invertedTsl = getTranslationPart().xyz();
-		invertedTsl = -(invertedRot * invertedTsl);
-		return TMat4(invertedTsl.xyz0(), invertedRot);
-	}
-
-	/// @note 9 muls, 9 adds
-	TVec3<T> transform(const TVec3<T>& v) const
-	{
-		const TMat4& m = *this;
-
-		return TVec3<T>(m(0, 0) * v.x() + m(0, 1) * v.y() + m(0, 2) * v.z() + m(0, 3),
-			m(1, 0) * v.x() + m(1, 1) * v.y() + m(1, 2) * v.z() + m(1, 3),
-			m(2, 0) * v.x() + m(2, 1) * v.y() + m(2, 2) * v.z() + m(2, 3));
-	}
-
-	/// Given the parameters that construct a projection matrix extract 4 values that can be used to unproject a point
-	/// from NDC to view space.
-	/// @code
-	/// Vec4 unprojParams = calculatePerspectiveUnprojectionParams(...);
-	/// F32 z = unprojParams.z() / (unprojParams.w() + depth);
-	/// Vec2 xy = ndc.xy() * unprojParams.xy() * z;
-	/// Vec3 posViewSpace(xy, z);
-	/// @endcode
-	static TVec4<T> calculatePerspectiveUnprojectionParams(T fovX, T fovY, T near, T far)
-	{
-		TVec4<T> out;
-		T g = near - far;
-		T f = T(1) / tan(fovY / T(2)); // f = cot(fovY/2)
-
-		T m00 = f * (fovY / fovX);
-		T m11 = f;
-		T m22 = far / g;
-		T m23 = (far * near) / g;
-
-		// First, clip = (m * Pv) where Pv is the view space position.
-		// ndc.z = clip.z / clip.w = (m22 * Pv.z + m23) / -Pv.z. Note that ndc.z == depth in zero_to_one projection.
-		// Solving that for Pv.z we get
-		// Pv.z = A / (depth + B)
-		// where A = -m23 and B = m22
-		// so we save the A and B in the projection params vector
-		out.z() = -m23;
-		out.w() = m22;
-
-		// Using the same logic the Pv.x = x' * w / m00
-		// so Pv.x = x' * Pv.z * (-1 / m00)
-		out.x() = -T(1.0) / m00;
-
-		// Same for y
-		out.y() = -T(1.0) / m11;
-
-		return out;
-	}
-
-	/// Assuming this is a projection matrix extract the unprojection parameters. See
-	/// calculatePerspectiveUnprojectionParams for more info.
-	TVec4<T> extractPerspectiveUnprojectionParams() const
-	{
-		TVec4<T> out;
-		const TMat4& m = *this;
-		out.z() = -m(2, 3);
-		out.w() = m(2, 2);
-		out.x() = -T(1.0) / m(0, 0);
-		out.y() = -T(1.0) / m(1, 1);
-		return out;
-	}
-	/// @}
-};
-
-#if ANKI_SIMD == ANKI_SIMD_SSE
-
-// Forward declare specializations
-
-using TMat4F32Base = TMat4<F32>::Base;
-
-template<>
-TVec4<F32> TMat4F32Base::operator*(const TVec4<F32>& b) const;
-
-#elif ANKI_SIMD == ANKI_SIMD_NEON
-
-#	error "TODO"
-
-#endif
-
-/// F32 4x4 matrix
-using Mat4 = TMat4<F32>;
-static_assert(sizeof(Mat4) == sizeof(F32) * 4 * 4, "Incorrect size");
-/// @}
-
-} // end namespace anki
-
-#include <anki/math/Mat4.inl.h>

+ 0 - 70
src/anki/math/Mat4.inl.h

@@ -1,70 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <anki/math/CommonSrc.h>
-
-namespace anki
-{
-
-/// @memberof TMat4
-template<typename T>
-TMat4<T> operator+(const T f, const TMat4<T>& m4)
-{
-	return m4 + f;
-}
-
-/// @memberof TMat4
-template<typename T>
-TMat4<T> operator-(const T f, const TMat4<T>& m4)
-{
-	TMat4<T> out;
-	for(U i = 0; i < 16; i++)
-	{
-		out[i] = f - m4[i];
-	}
-	return out;
-}
-
-/// @memberof TMat4
-template<typename T>
-TMat4<T> operator*(const T f, const TMat4<T>& m4)
-{
-	return m4 * f;
-}
-
-/// @memberof TMat4
-template<typename T>
-TMat4<T> operator/(const T f, const TMat4<T>& m4)
-{
-	TMat4<T> out;
-	for(U i = 0; i < 16; i++)
-	{
-		out[i] = f / m4[i];
-	}
-	return out;
-}
-
-#if ANKI_SIMD == ANKI_SIMD_SSE
-
-template<>
-inline TVec4<F32> TMat4F32Base::operator*(const TVec4<F32>& b) const
-{
-	TVec4<F32> v;
-
-	for(U i = 0; i < 4; i++)
-	{
-		_mm_store_ss(&v[i], _mm_dp_ps(m_simd[i], b.getSimd(), 0xF1));
-	}
-
-	return v;
-}
-
-#elif ANKI_SIMD == ANKI_SIMD_NEON
-
-#	error "TODO"
-
-#endif
-
-} // end namespace anki

+ 24 - 19
src/anki/math/Quat.h

@@ -5,8 +5,8 @@
 
 #pragma once
 
-#include <anki/math/CommonIncludes.h>
-#include <anki/math/Vec4.h>
+#include <anki/math/Common.h>
+#include <anki/math/Vec.h>
 
 namespace anki
 {
@@ -16,10 +16,10 @@ namespace anki
 
 /// Quaternion. Used in rotations
 template<typename T>
-class alignas(16) TQuat : public TVec<T, 4, TQuat<T>>
+class alignas(16) TQuat : public TVec<T, 4>
 {
 public:
-	using Base = TVec<T, 4, TQuat<T>>;
+	using Base = TVec<T, 4>;
 
 	using Base::x;
 	using Base::y;
@@ -27,6 +27,8 @@ public:
 	using Base::w;
 	using Base::normalize; // Shortcut
 	using Base::getLengthSquared; // Shortcut
+	using Base::operator-;
+	using Base::operator=;
 
 	/// @name Constructors
 	/// @{
@@ -60,24 +62,24 @@ public:
 	{
 	}
 
-	TQuat(const TVec2<T>& v, const T z_, const T w_)
+	TQuat(const TVec<T, 2>& v, const T z_, const T w_)
 		: Base(v, z_, w_)
 	{
 	}
 
-	TQuat(const TVec3<T>& v, const T w_)
+	TQuat(const TVec<T, 3>& v, const T w_)
 		: Base(v, w_)
 	{
 	}
 
-	explicit TQuat(const TVec4<T>& v)
+	explicit TQuat(const TVec<T, 4>& v)
 		: Base(v.x(), v.y(), v.z(), v.w())
 	{
 	}
 
-	explicit TQuat(const TMat3<T>& m3)
+	explicit TQuat(const TMat<T, 3, 3>& m3)
 	{
-		T trace = m3(0, 0) + m3(1, 1) + m3(2, 2) + 1.0;
+		const T trace = m3(0, 0) + m3(1, 1) + m3(2, 2) + 1.0;
 		if(trace > EPSILON)
 		{
 			T s = 0.5 / sqrt<T>(trace);
@@ -115,7 +117,7 @@ public:
 		}
 	}
 
-	explicit TQuat(const TMat3x4<T>& m)
+	explicit TQuat(const TMat<T, 3, 4>& m)
 		: TQuat(m.getRotationPart())
 	{
 		ANKI_ASSERT(isZero<T>(m(0, 3)) && isZero<T>(m(1, 3)) && isZero<T>(m(2, 3)));
@@ -142,7 +144,7 @@ public:
 
 	explicit TQuat(const TAxisang<T>& axisang)
 	{
-		T lengthsq = axisang.getAxis().getLengthSquared();
+		const T lengthsq = axisang.getAxis().getLengthSquared();
 		if(isZero<T>(lengthsq))
 		{
 			(*this) = getIdentity();
@@ -167,9 +169,9 @@ public:
 	/// @{
 
 	/// Calculates the rotation from TVec3 "from" to "to"
-	void setFrom2Vec3(const TVec3<T>& from, const TVec3<T>& to)
+	void setFrom2Vec3(const TVec<T, 3>& from, const TVec<T, 3>& to)
 	{
-		TVec3<T> axis(from.cross(to));
+		TVec<T, 3> axis(from.cross(to));
 		*this = TQuat(axis.x(), axis.y(), axis.z(), from.dot(to));
 		normalize();
 		w() += 1.0;
@@ -232,16 +234,16 @@ public:
 			return TQuat(q0);
 		}
 
-		T halfTheta = acos<T>(cosHalfTheta);
-		T sinHalfTheta = sqrt<T>(1.0 - cosHalfTheta * cosHalfTheta);
+		const T halfTheta = acos<T>(cosHalfTheta);
+		const T sinHalfTheta = sqrt<T>(1.0 - cosHalfTheta * cosHalfTheta);
 
 		if(absolute<T>(sinHalfTheta) < 0.001)
 		{
 			return TQuat((q0 + q1) * 0.5);
 		}
 
-		T ratioA = sin<T>((1.0 - t) * halfTheta) / sinHalfTheta;
-		T ratioB = sin<T>(t * halfTheta) / sinHalfTheta;
+		const T ratioA = sin<T>((1.0 - t) * halfTheta) / sinHalfTheta;
+		const T ratioB = sin<T>(t * halfTheta) / sinHalfTheta;
 		TQuat tmp, tmp1, sum;
 		tmp = q0 * ratioA;
 		tmp1 = q1 * ratioB;
@@ -263,10 +265,10 @@ public:
 	}
 
 	/// Returns q * this * q.Conjucated() aka returns a rotated this. 18 muls, 12 adds
-	TVec3<T> rotate(const TVec3<T>& v) const
+	TVec<T, 3> rotate(const TVec<T, 3>& v) const
 	{
 		ANKI_ASSERT(isZero<T>(1.0 - Base::getLength())); // Not normalized quat
-		TVec3<T> qXyz(Base::xyz());
+		TVec<T, 3> qXyz(Base::xyz());
 		return v + qXyz.cross(qXyz.cross(v) + v * Base::w()) * 2.0;
 	}
 
@@ -284,6 +286,9 @@ public:
 
 /// F32 quaternion
 using Quat = TQuat<F32>;
+
+/// F64 quaternion
+using DQuat = TQuat<F64>;
 /// @}
 
 } // end namespace anki

+ 26 - 30
src/anki/math/Transform.h

@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include <anki/math/CommonIncludes.h>
+#include <anki/math/Common.h>
 
 namespace anki
 {
@@ -32,15 +32,15 @@ public:
 		checkW();
 	}
 
-	explicit TTransform(const TMat4<T>& m4)
+	explicit TTransform(const TMat<T, 4, 4>& m4)
 	{
-		m_rotation = TMat3x4<T>(m4.getRotationPart());
+		m_rotation = TMat<T, 3, 4>(m4.getRotationPart());
 		m_origin = m4.getTranslationPart().xyz0();
 		m_scale = 1.0;
 		checkW();
 	}
 
-	TTransform(const TVec4<T>& origin, const TMat3x4<T>& rotation, const T scale)
+	TTransform(const TVec<T, 4>& origin, const TMat<T, 3, 4>& rotation, const T scale)
 		: m_origin(origin)
 		, m_rotation(rotation)
 		, m_scale(scale)
@@ -48,24 +48,24 @@ public:
 		checkW();
 	}
 
-	explicit TTransform(const TVec4<T>& origin)
+	explicit TTransform(const TVec<T, 4>& origin)
 		: m_origin(origin)
 		, m_rotation(Mat3x4::getIdentity())
-		, m_scale(1.0f)
+		, m_scale(1.0)
 	{
 		checkW();
 	}
 
-	explicit TTransform(const TMat3x4<T>& rotation)
-		: m_origin(Vec4(0.0f))
+	explicit TTransform(const TMat<T, 3, 4>& rotation)
+		: m_origin(Vec4(0.0))
 		, m_rotation(rotation)
-		, m_scale(1.0f)
+		, m_scale(1.0)
 	{
 		checkW();
 	}
 
 	TTransform(const T scale)
-		: m_origin(Vec4(0.0f))
+		: m_origin(Vec4(0.0))
 		, m_rotation(Mat3x4::getIdentity())
 		, m_scale(scale)
 	{
@@ -75,33 +75,33 @@ public:
 
 	/// @name Accessors
 	/// @{
-	const TVec4<T>& getOrigin() const
+	const TVec<T, 4>& getOrigin() const
 	{
 		return m_origin;
 	}
 
-	TVec4<T>& getOrigin()
+	TVec<T, 4>& getOrigin()
 	{
 		return m_origin;
 	}
 
-	void setOrigin(const TVec4<T>& o)
+	void setOrigin(const TVec<T, 4>& o)
 	{
 		m_origin = o;
 		checkW();
 	}
 
-	const TMat3x4<T>& getRotation() const
+	const TMat<T, 3, 4>& getRotation() const
 	{
 		return m_rotation;
 	}
 
-	TMat3x4<T>& getRotation()
+	TMat<T, 3, 4>& getRotation()
 	{
 		return m_rotation;
 	}
 
-	void setRotation(const TMat3x4<T>& r)
+	void setRotation(const TMat<T, 3, 4>& r)
 	{
 		m_rotation = r;
 	}
@@ -153,7 +153,7 @@ public:
 
 	static const TTransform& getIdentity()
 	{
-		static const TTransform ident(TVec4<T>(0.0), TMat3x4<T>::getIdentity(), 1.0);
+		static const TTransform ident(TVec<T, 4>(0.0), TMat<T, 3, 4>::getIdentity(), 1.0);
 		return ident;
 	}
 
@@ -164,7 +164,7 @@ public:
 		const TTransform& a = *this;
 		TTransform out;
 
-		out.m_origin = TVec4<T>(a.m_rotation * (b.m_origin * a.m_scale), 0.0) + a.m_origin;
+		out.m_origin = TVec<T, 4>(a.m_rotation * (b.m_origin * a.m_scale), 0.0) + a.m_origin;
 
 		out.m_rotation = a.m_rotation.combineTransformations(b.m_rotation);
 		out.m_scale = a.m_scale * b.m_scale;
@@ -192,33 +192,26 @@ public:
 	}
 
 	/// Transform a TVec3
-	ANKI_USE_RESULT TVec3<T> transform(const TVec3<T>& b) const
+	TVec<T, 3> transform(const TVec<T, 3>& b) const
 	{
 		checkW();
 		return (m_rotation.getRotationPart() * (b * m_scale)) + m_origin.xyz();
 	}
 
 	/// Transform a TVec4. SIMD optimized
-	ANKI_USE_RESULT TVec4<T> transform(const TVec4<T>& b) const
+	TVec<T, 4> transform(const TVec<T, 4>& b) const
 	{
 		checkW();
-		TVec4<T> out = TVec4<T>(m_rotation * (b * m_scale), T(0)) + m_origin;
+		TVec<T, 4> out = TVec<T, 4>(m_rotation * (b * m_scale), T(0)) + m_origin;
 		return out;
 	}
-
-	template<typename TAlloc>
-	String toString(TAlloc alloc) const
-	{
-		ANKI_ASSERT(0 && "TODO");
-		return String();
-	}
 	/// @}
 
 private:
 	/// @name Data
 	/// @{
-	TVec4<T> m_origin; ///< The rotation
-	TMat3x4<T> m_rotation; ///< The translation
+	TVec<T, 4> m_origin; ///< The rotation
+	TMat<T, 3, 4> m_rotation; ///< The translation
 	T m_scale; ///< The uniform scaling
 	/// @}
 
@@ -230,6 +223,9 @@ private:
 
 /// F32 transformation
 using Transform = TTransform<F32>;
+
+/// F64 transformation
+using DTransform = TTransform<F64>;
 /// @}
 
 } // end namespace anki

Fișier diff suprimat deoarece este prea mare
+ 1279 - 911
src/anki/math/Vec.h


+ 0 - 113
src/anki/math/Vec2.h

@@ -1,113 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/math/CommonIncludes.h>
-#include <anki/math/Vec.h>
-
-namespace anki
-{
-
-/// @addtogroup math
-/// @{
-
-/// 2D vector
-template<typename T>
-class TVec2 : public TVec<T, 2, TVec2<T>>
-{
-	/// @name Friends
-	/// @{
-	template<typename Y>
-	friend TVec2<Y> operator+(const Y f, const TVec2<Y>& b);
-	template<typename Y>
-	friend TVec2<Y> operator-(const Y f, const TVec2<Y>& b);
-	template<typename Y>
-	friend TVec2<Y> operator*(const Y f, const TVec2<Y>& b);
-	template<typename Y>
-	friend TVec2<Y> operator/(const Y f, const TVec2<Y>& b);
-	///@}
-
-public:
-	using Base = TVec<T, 2, TVec2<T>>;
-
-	/// @name Constructors
-	/// @{
-	TVec2()
-		: Base()
-	{
-	}
-
-	TVec2(const TVec2& b)
-		: Base(b)
-	{
-	}
-
-	TVec2(const T x_, const T y_)
-		: Base(x_, y_)
-	{
-	}
-
-	explicit TVec2(const T f)
-		: Base(f)
-	{
-	}
-
-	explicit TVec2(const T arr[])
-		: Base(arr)
-	{
-	}
-
-	template<typename Y>
-	TVec2(const TVec2<Y>& b)
-		: Base(b.x(), b.y())
-	{
-	}
-	/// @}
-};
-
-/// @memberof TVec2
-template<typename T>
-TVec2<T> operator+(const T f, const TVec2<T>& b)
-{
-	return b + f;
-}
-
-/// @memberof TVec2
-template<typename T>
-TVec2<T> operator-(const T f, const TVec2<T>& b)
-{
-	return TVec2<T>(f - b.x(), f - b.y());
-}
-
-/// @memberof TVec2
-template<typename T>
-TVec2<T> operator*(const T f, const TVec2<T>& b)
-{
-	return b * f;
-}
-
-/// @memberof TVec2
-template<typename T>
-TVec2<T> operator/(const T f, const TVec2<T>& b)
-{
-	return TVec2<T>(f / b.x(), f / b.y());
-}
-
-/// F32 2D vector
-using Vec2 = TVec2<F32>;
-static_assert(sizeof(Vec2) == sizeof(F32) * 2, "Incorrect size");
-
-/// Half float 2D vector
-using HVec2 = TVec2<F16>;
-
-/// 32bit signed integer 2D vector
-using IVec2 = TVec2<I32>;
-
-/// 32bit unsigned integer 2D vector
-using UVec2 = TVec2<U32>;
-/// @}
-
-} // end namespace anki

+ 0 - 120
src/anki/math/Vec3.h

@@ -1,120 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/math/CommonIncludes.h>
-#include <anki/math/Vec.h>
-
-namespace anki
-{
-
-/// @addtogroup math
-/// @{
-
-/// 3D vector template. One of the most used classes
-template<typename T>
-class TVec3 : public TVec<T, 3, TVec3<T>>
-{
-	/// @name Friends
-	/// @{
-	template<typename Y>
-	friend TVec3<Y> operator+(const Y f, const TVec3<Y>& v);
-	template<typename Y>
-	friend TVec3<Y> operator-(const Y f, const TVec3<Y>& v);
-	template<typename Y>
-	friend TVec3<Y> operator*(const Y f, const TVec3<Y>& v);
-	template<typename Y>
-	friend TVec3<Y> operator/(const Y f, const TVec3<Y>& v);
-	/// @}
-
-public:
-	using Base = TVec<T, 3, TVec3<T>>;
-
-	using Base::x;
-	using Base::y;
-	using Base::z;
-	using Base::operator*;
-
-	/// @name Constructors
-	/// @{
-	TVec3()
-		: Base()
-	{
-	}
-
-	TVec3(const TVec3& b)
-		: Base(b)
-	{
-	}
-
-	TVec3(const T x_, const T y_, const T z_)
-		: Base(x_, y_, z_)
-	{
-	}
-
-	explicit TVec3(const T f)
-		: Base(f)
-	{
-	}
-
-	explicit TVec3(const T arr[])
-		: Base(arr)
-	{
-	}
-
-	TVec3(const TVec2<T>& v, const T z_)
-		: Base(v.x(), v.y(), z_)
-	{
-	}
-	/// @}
-};
-
-/// @memberof TVec3
-template<typename T>
-TVec3<T> operator+(const T f, const TVec3<T>& v)
-{
-	return v + f;
-}
-
-/// @memberof TVec3
-template<typename T>
-TVec3<T> operator-(const T f, const TVec3<T>& v)
-{
-	return TVec3<T>(f) - v;
-}
-
-/// @memberof TVec3
-template<typename T>
-TVec3<T> operator*(const T f, const TVec3<T>& v)
-{
-	return v * f;
-}
-
-/// @memberof TVec3
-template<typename T>
-TVec3<T> operator/(const T f, const TVec3<T>& v)
-{
-	return TVec3<T>(f) / v;
-}
-
-/// F32 3D vector
-using Vec3 = TVec3<F32>;
-static_assert(sizeof(Vec3) == sizeof(F32) * 3, "Incorrect size");
-
-/// Half float 3D vector
-using HVec3 = TVec3<F16>;
-
-/// 32bit signed integer 3D vector
-using IVec3 = TVec3<I32>;
-
-/// 32bit unsigned integer 3D vector
-using UVec3 = TVec3<U32>;
-
-/// 64bit float 3D vector
-using DVec3 = TVec3<F64>;
-/// @}
-
-} // end namespace anki

+ 0 - 120
src/anki/math/Vec4.h

@@ -1,120 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma once
-
-#include <anki/math/CommonIncludes.h>
-#include <anki/math/Vec.h>
-
-namespace anki
-{
-
-/// @addtogroup math
-/// @{
-
-/// 4D vector. SIMD optimized
-template<typename T>
-class alignas(16) TVec4 : public TVec<T, 4, TVec4<T>>
-{
-	/// @name Friends
-	/// @{
-	template<typename Y>
-	friend TVec4<Y> operator+(const Y f, const TVec4<Y>& v4);
-	template<typename Y>
-	friend TVec4<Y> operator-(const Y f, const TVec4<Y>& v4);
-	template<typename Y>
-	friend TVec4<Y> operator*(const Y f, const TVec4<Y>& v4);
-	template<typename Y>
-	friend TVec4<Y> operator/(const Y f, const TVec4<Y>& v4);
-	/// @}
-
-public:
-	using Base = TVec<T, 4, TVec4<T>>;
-
-	using Base::w;
-	using Base::x;
-	using Base::y;
-	using Base::z;
-	using Base::operator*;
-
-	/// @name Constructors
-	/// @{
-	TVec4()
-		: Base()
-	{
-	}
-
-	TVec4(const TVec4& b)
-		: Base(b)
-	{
-	}
-
-	TVec4(const T x_, const T y_, const T z_, const T w_)
-		: Base(x_, y_, z_, w_)
-	{
-	}
-
-	explicit TVec4(const T f)
-		: Base(f)
-	{
-	}
-
-	explicit TVec4(const T arr[])
-		: Base(arr)
-	{
-	}
-
-	explicit TVec4(const typename Base::Simd& simd)
-		: Base(simd)
-	{
-	}
-
-	TVec4(const TVec2<T>& v, const T z_, const T w_)
-		: Base(v.x(), v.y(), z_, w_)
-	{
-	}
-
-	TVec4(const TVec2<T>& v, const TVec2<T>& v2)
-		: Base(v.x(), v.y(), v2.x(), v2.y())
-	{
-	}
-
-	TVec4(const TVec3<T>& v, const T w_)
-		: Base(v.x(), v.y(), v.z(), w_)
-	{
-	}
-	/// @}
-
-	/// @name Operators with other
-	/// @{
-
-	/// @note 16 muls 12 adds
-	ANKI_USE_RESULT TVec4 operator*(const TMat4<T>& m4) const
-	{
-		return TVec4(x() * m4(0, 0) + y() * m4(1, 0) + z() * m4(2, 0) + w() * m4(3, 0),
-			x() * m4(0, 1) + y() * m4(1, 1) + z() * m4(2, 1) + w() * m4(3, 1),
-			x() * m4(0, 2) + y() * m4(1, 2) + z() * m4(2, 2) + w() * m4(3, 2),
-			x() * m4(0, 3) + y() * m4(1, 3) + z() * m4(2, 3) + w() * m4(3, 3));
-	}
-	/// @}
-};
-
-/// F32 4D vector
-using Vec4 = TVec4<F32>;
-static_assert(sizeof(Vec4) == sizeof(F32) * 4, "Incorrect size");
-
-/// Half float 4D vector
-using HVec4 = TVec4<F16>;
-
-/// 32bit signed integer 4D vector
-using IVec4 = TVec4<I32>;
-
-/// 32bit unsigned integer 4D vector
-using UVec4 = TVec4<U32>;
-/// @}
-
-} // end namespace anki
-
-#include <anki/math/Vec4.inl.h>

+ 0 - 39
src/anki/math/Vec4.inl.h

@@ -1,39 +0,0 @@
-// Copyright (C) 2009-2019, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <anki/math/CommonSrc.h>
-
-namespace anki
-{
-
-/// @memberof TVec4
-template<typename T>
-TVec4<T> operator+(const T f, const TVec4<T>& v4)
-{
-	return v4 + f;
-}
-
-/// @memberof TVec4
-template<typename T>
-TVec4<T> operator-(const T f, const TVec4<T>& v4)
-{
-	return TVec4<T>(f) - v4;
-}
-
-/// @memberof TVec4
-template<typename T>
-TVec4<T> operator*(const T f, const TVec4<T>& v4)
-{
-	return v4 * f;
-}
-
-/// @memberof TVec4
-template<typename T>
-TVec4<T> operator/(const T f, const TVec4<T>& v4)
-{
-	return TVec4<T>(f) / v4;
-}
-
-} // end namespace anki

+ 1 - 1
tools/gltf_exporter/Exporter.cpp

@@ -470,7 +470,7 @@ Error Exporter::exportMesh(const tinygltf::Mesh& mesh)
 	MeshBinaryFile::Header header = {};
 	{
 		// Positions
-		Vec3 dist3d = aabbMin.getAbs().max(aabbMax.getAbs());
+		Vec3 dist3d = aabbMin.abs().max(aabbMax.abs());
 		const F32 maxPositionDistance = max(max(dist3d.x(), dist3d.y()), dist3d.z());
 		auto& posa = header.m_vertexAttributes[VertexAttributeLocation::POSITION];
 		posa.m_bufferBinding = 0;

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff