Panagiotis Christopoulos Charitos hace 14 años
padre
commit
cce194858b

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
build/debug/Makefile


+ 5 - 0
src/Math/Axisang.h

@@ -31,6 +31,11 @@ class Axisang
 		void setAxis(const Vec3& a);
 		/// @}
 		
+		/// @name Operators with same
+		/// @{
+		Axisang& operator=(const Axisang& b);
+		/// @}
+
 	private:
 		/// @name Data
 		/// @{

+ 13 - 0
src/Math/Axisang.inl.h

@@ -167,4 +167,17 @@ inline void Axisang::setAxis(const Vec3& a)
 }
 
 
+//======================================================================================================================
+// Operators with same                                                                                                 =
+//======================================================================================================================
+
+// =
+inline Axisang& Axisang::operator=(const Axisang& b)
+{
+	ang = b.ang;
+	axis = b.axis;
+	return SELF;
+}
+
+
 } // end namaspace

+ 26 - 12
src/Math/Euler.h

@@ -11,12 +11,7 @@ namespace M {
 class Euler
 {
 	public:
-		/// @name Data
-		/// @{
-		float x, y, z;
-		/// @}
-
-		/// @name Constructors & distructors
+		/// @name Constructors
 		/// @{
 		explicit Euler();
 		explicit Euler(float x, float y, float z);
@@ -29,12 +24,31 @@ class Euler
 		/// @{
 		float& operator [](uint i);
 		float operator [](uint i) const;
-		float& getBank();
-		float getBank() const;
-		float& getHeading();
-		float getHeading() const;
-		float& getAttitude();
-		float getAttitude() const;
+		float& x();
+		float x() const;
+		float& y();
+		float y() const;
+		float& z();
+		float z() const;
+		/// @}
+
+		/// @name Operators with same
+		/// @{
+		Euler& operator=(const Euler& b);
+		/// @}
+
+	private:
+		/// @name Data
+		/// @{
+		union
+		{
+			struct
+			{
+				float x, y, z;
+			} vec;
+
+			boost::array<float, 3> arr;
+		};
 		/// @}
 };
 

+ 96 - 62
src/Math/Euler.inl.h

@@ -4,90 +4,60 @@
 namespace M {
 
 
-// accessors
-inline float& Euler::operator [](uint i)
-{
-	return (&x)[i];
-}
-
-inline float Euler::operator [](uint i) const
-{
-	return (&x)[i];
-}
-
-inline float& Euler::getBank()
-{
-	return x;
-}
-
-inline float Euler::getBank() const
-{
-	return x;
-}
-
-inline float& Euler::getHeading()
-{
-	return y;
-}
+//======================================================================================================================
+// Constructors                                                                                                        =
+//======================================================================================================================
 
-inline float Euler::getHeading() const
+// Default
+inline Euler::Euler()
 {
-	return y;
+	x() = y() = z() = 0.0;
 }
 
-inline float& Euler::getAttitude()
+// float, float, float
+inline Euler::Euler(float x_, float y_, float z_)
 {
-	return z;
+	x() = x_;
+	y() = y_;
+	z() = z_;
 }
 
-inline float Euler::getAttitude() const
+// Copy
+inline Euler::Euler(const Euler& b)
 {
-	return z;
+	x() = b.x();
+	y() = b.y();
+	z() = b.z();
 }
 
-// constructor []
-inline Euler::Euler()
-	: x(0.0), y(0.0), z(0.0)
-{}
-
-// constructor [float, float, float]
-inline Euler::Euler(float x_, float y_, float z_)
-	: x(x_), y(y_), z(z_)
-{}
-
-// constructor [euler]
-inline Euler::Euler(const Euler& b)
-	: x(b.x), y(b.y), z(b.z)
-{}
-
-// constructor [quat]
+// Quat
 inline Euler::Euler(const Quat& q)
 {
 	float test = q.x() * q.y() + q.z() * q.w();
 	if(test > 0.499)
 	{
-		getHeading() = 2.0 * atan2(q.x(), q.w());
-		getAttitude() = PI / 2.0;
-		getBank() = 0.0;
+		y() = 2.0 * atan2(q.x(), q.w());
+		z() = PI / 2.0;
+		x() = 0.0;
 		return;
 	}
 	if(test < -0.499)
 	{
-		getHeading() = -2.0 * atan2(q.x(), q.w());
-		getAttitude() = -PI / 2.0;
-		getBank() = 0.0;
+		y() = -2.0 * atan2(q.x(), q.w());
+		z() = -PI / 2.0;
+		x() = 0.0;
 		return;
 	}
 
 	float sqx = q.x() * q.x();
 	float sqy = q.y() * q.y();
 	float sqz = q.z() * q.z();
-	getHeading() = atan2(2.0 * q.y() * q.w() - 2.0 * q.x() * q.z(), 1.0 - 2.0 * sqy - 2.0 * sqz);
-	getAttitude() = asin(2.0f * test);
-	getBank() = atan2(2.0 * q.x() * q.w() - 2.0 * q.y() * q.z(), 1.0 - 2.0 * sqx - 2.0 * sqz);
+	y() = atan2(2.0 * q.y() * q.w() - 2.0 * q.x() * q.z(), 1.0 - 2.0 * sqy - 2.0 * sqz);
+	z() = asin(2.0 * test);
+	x() = atan2(2.0 * q.x() * q.w() - 2.0 * q.y() * q.z(), 1.0 - 2.0 * sqx - 2.0 * sqz);
 }
 
-// constructor [mat3]
+// mat3
 inline Euler::Euler(const Mat3& m3)
 {
 	float cx, sx;
@@ -114,16 +84,80 @@ inline Euler::Euler(const Mat3& m3)
 		cx = m3(1, 1);
 	}
 
-	z = atan2f(sz, cz);
-	y = atan2f(sy, cy);
-	x = atan2f(sx, cx);
+	z() = atan2f(sz, cz);
+	y() = atan2f(sy, cy);
+	x() = atan2f(sx, cx);
+}
+
+
+//======================================================================================================================
+// Accessors                                                                                                           =
+//======================================================================================================================
+
+inline float& Euler::operator [](uint i)
+{
+	return arr[i];
 }
 
-// print
+inline float Euler::operator [](uint i) const
+{
+	return arr[i];
+}
+
+inline float& Euler::x()
+{
+	return vec.x;
+}
+
+inline float Euler::x() const
+{
+	return vec.x;
+}
+
+inline float& Euler::y()
+{
+	return vec.y;
+}
+
+inline float Euler::y() const
+{
+	return vec.y;
+}
+
+inline float& Euler::z()
+{
+	return vec.z;
+}
+
+inline float Euler::z() const
+{
+	return vec.z;
+}
+
+
+//======================================================================================================================
+// Operators with same                                                                                                 =
+//======================================================================================================================
+
+// =
+inline Euler& Euler::operator=(const Euler& b)
+{
+	x() = b.x();
+	y() = b.y();
+	z() = b.z();
+	return SELF;
+}
+
+
+//======================================================================================================================
+// Print                                                                                                               =
+//======================================================================================================================
+
 inline std::ostream& operator<<(std::ostream& s, const Euler& e)
 {
-	s << e.x << ' ' << e.y << ' ' << e.z;
+	s << e.x() << ' ' << e.y() << ' ' << e.z();
 	return s;
 }
 
+
 } // end namespace

+ 2 - 1
src/Math/Mat3.h

@@ -31,8 +31,9 @@ class Mat3
 		const float& operator[](const uint i) const;
 		/// @}
 
-		/// @name Operators with Mat3
+		/// @name Operators with same
 		/// @{
+		Mat3& operator=(const Mat3& b);
 		Mat3 operator+(const Mat3& b) const;
 		Mat3& operator+=(const Mat3& b);
 		Mat3 operator-(const Mat3& b) const;

+ 22 - 12
src/Math/Mat3.inl.h

@@ -89,19 +89,19 @@ inline Mat3::Mat3(const Quat& q)
 inline Mat3::Mat3(const Euler& e)
 {
 	float ch, sh, ca, sa, cb, sb;
-  sinCos(e.getHeading(), sh, ch);
-  sinCos(e.getAttitude(), sa, ca);
-  sinCos(e.getBank(), sb, cb);
+	sinCos(e.y(), sh, ch);
+	sinCos(e.z(), sa, ca);
+	sinCos(e.x(), sb, cb);
 
-  SELF(0, 0) = ch * ca;
-  SELF(0, 1) = sh * sb - ch * sa * cb;
-  SELF(0, 2) = ch * sa * sb + sh * cb;
-  SELF(1, 0) = sa;
-  SELF(1, 1) = ca * cb;
-  SELF(1, 2) = -ca * sb;
-  SELF(2, 0) = -sh * ca;
-  SELF(2, 1) = sh * sa * cb + ch * sb;
-  SELF(2, 2) = -sh * sa * sb + ch * cb;
+	SELF(0, 0) = ch * ca;
+	SELF(0, 1) = sh * sb - ch * sa * cb;
+	SELF(0, 2) = ch * sa * sb + sh * cb;
+	SELF(1, 0) = sa;
+	SELF(1, 1) = ca * cb;
+	SELF(1, 2) = -ca * sb;
+	SELF(2, 0) = -sh * ca;
+	SELF(2, 1) = sh * sa * cb + ch * sb;
+	SELF(2, 2) = -sh * sa * sb + ch * cb;
 }
 
 // Axisang
@@ -161,6 +161,16 @@ inline const float& Mat3::operator[](const uint i) const
 // Operators with same                                                                                                 =
 //======================================================================================================================
 
+// =
+inline Mat3& Mat3::operator=(const Mat3& b)
+{
+	for(int i = 0; i < 9; i++)
+	{
+		SELF[i] = b[i];
+	}
+	return SELF;
+}
+
 // +
 inline Mat3 Mat3::operator+(const Mat3& b) const
 {

+ 1 - 0
src/Math/Mat4.h

@@ -42,6 +42,7 @@ class Mat4
 
 		/// @name Operators with same type
 		/// @{
+		Mat4& operator=(const Mat4& b);
 		Mat4 operator+(const Mat4& b) const;
 		Mat4& operator+=(const Mat4& b);
 		Mat4 operator-(const Mat4& b) const;

+ 17 - 0
src/Math/Mat4.inl.h

@@ -195,6 +195,23 @@ inline const float& Mat4::operator[](const uint i) const
 // Operators with same                                                                                                 =
 //======================================================================================================================
 
+// =
+inline Mat4& Mat4::operator=(const Mat4& b)
+{
+	#if defined(MATH_INTEL_SIMD)
+		for(int i = 0; i < 4; i++)
+		{
+			arrMm[i] = b.arrMm[i];
+		}
+	#else
+		for(int i = 0; i < 16; i++)
+		{
+			SELF[i] = b[i];
+		}
+	#endif
+	return SELF;
+}
+
 // +
 inline Mat4 Mat4::operator+(const Mat4& b) const
 {

+ 1 - 0
src/Math/MathCommon.h

@@ -7,6 +7,7 @@
 #include <iostream>
 #include <boost/array.hpp>
 #include "StdTypes.h"
+#include "Properties.h"
 #if defined(MATH_INTEL_SIMD)
 	#include <smmintrin.h>
 #endif

+ 5 - 4
src/Math/Quat.h

@@ -39,10 +39,11 @@ class Quat
 
 		/// Operators with same
 		/// @{
-		Quat operator *(const Quat& b) const; ///< 16 muls, 12 adds
-		Quat& operator *=(const Quat& b);
-		bool operator ==(const Quat& b) const;
-		bool operator !=(const Quat& b) const;
+		Quat& operator=(const Quat& b);
+		Quat operator*(const Quat& b) const; ///< 16 muls, 12 adds
+		Quat& operator*=(const Quat& b);
+		bool operator==(const Quat& b) const;
+		bool operator!=(const Quat& b) const;
 		/// @}
 
 		/// @name Other

+ 13 - 3
src/Math/Quat.inl.h

@@ -112,13 +112,13 @@ inline Quat::Quat(const Mat3& m3)
 inline Quat::Quat(const Euler& eu)
 {
 	float cx, sx;
-	sinCos(eu.getHeading() * 0.5, sx, cx);
+	sinCos(eu.y() * 0.5, sx, cx);
 
 	float cy, sy;
-	sinCos(eu.getAttitude() * 0.5, sy, cy);
+	sinCos(eu.z() * 0.5, sy, cy);
 
 	float cz, sz;
-	sinCos(eu.getBank() * 0.5, sz, cz);
+	sinCos(eu.x() * 0.5, sz, cz);
 
 	float cxcy = cx * cy;
 	float sxsy = sx * sy;
@@ -202,6 +202,16 @@ inline float& Quat::w()
 // Operators with same                                                                                                 =
 //======================================================================================================================
 
+// =
+inline Quat& Quat::operator=(const Quat& b)
+{
+	x() = b.x();
+	y() = b.y();
+	z() = b.z();
+	w() = b.w();
+	return SELF;
+}
+
 // *
 inline Quat Quat::operator *(const Quat& b) const
 {

+ 5 - 0
src/Math/Transform.h

@@ -34,6 +34,11 @@ class Transform
 		void setScale(float s);
 		/// @}
 
+		/// @name Operators with same
+		/// @{
+		Transform& operator=(const Transform& b);
+		/// @}
+
 		/// @name Other
 		/// @{
 		void setIdentity();

+ 14 - 0
src/Math/Transform.inl.h

@@ -88,6 +88,20 @@ inline void Transform::setScale(float s)
 }
 
 
+//======================================================================================================================
+// Operators with same                                                                                                 =
+//======================================================================================================================
+
+// =
+inline Transform& Transform::operator=(const Transform& b)
+{
+	origin = b.origin;
+	rotation = b.rotation;
+	scale = b.scale;
+	return *this;
+}
+
+
 //======================================================================================================================
 // Other                                                                                                               =
 //======================================================================================================================

+ 1 - 0
src/Math/Vec2.h

@@ -34,6 +34,7 @@ class Vec2
 
 		/// @name Operators with same type
 		/// @{
+		Vec2& operator=(const Vec2& b);
 		Vec2 operator+(const Vec2& b) const;
 		Vec2& operator+=(const Vec2& b);
 		Vec2 operator-(const Vec2& b) const;

+ 9 - 1
src/Math/Vec2.inl.h

@@ -37,7 +37,7 @@ inline Vec2::Vec2(float arr[])
 	y() = arr[1];
 }
 
-// vec2
+// Copy
 inline Vec2::Vec2(const Vec2& b)
 {
 	x() = b.x();
@@ -98,6 +98,14 @@ inline float Vec2::operator[](uint i) const
 // Operators with same                                                                                                 =
 //======================================================================================================================
 
+// =
+inline Vec2& Vec2::operator=(const Vec2& b)
+{
+	x() = b.x();
+	y() = b.y();
+	return SELF;
+}
+
 // +
 inline Vec2 Vec2::operator+(const Vec2& b) const
 {

+ 1 - 0
src/Math/Vec3.h

@@ -37,6 +37,7 @@ class Vec3
 
 		/// @name Operators with same type
 		/// @{
+		Vec3& operator=(const Vec3& b);
 		Vec3 operator+(const Vec3& b) const;
 		Vec3& operator+=(const Vec3& b);
 		Vec3 operator-(const Vec3& b) const;

+ 9 - 0
src/Math/Vec3.inl.h

@@ -120,6 +120,15 @@ inline float Vec3::operator[](uint i) const
 // Operators with same type                                                                                            =
 //======================================================================================================================
 
+// =
+inline Vec3& Vec3::operator=(const Vec3& b)
+{
+	arr[0] = b.arr[0];
+	arr[1] = b.arr[1];
+	arr[2] = b.arr[2];
+	return SELF;
+}
+
 // +
 inline Vec3 Vec3::operator+(const Vec3& b) const
 {

+ 2 - 1
src/Math/Vec4.h

@@ -11,7 +11,7 @@ namespace M {
 class Vec4
 {
 	public:
-		/// @name Constructors & distructors
+		/// @name Constructors
 		/// @{
 		explicit Vec4();
 		explicit Vec4(float x, float y, float z, float w);
@@ -46,6 +46,7 @@ class Vec4
 
 		/// @name Operators with same
 		/// @{
+		Vec4& operator=(const Vec4& b);
 		Vec4 operator+(const Vec4& b) const;
 		Vec4& operator+=(const Vec4& b);
 		Vec4 operator-(const Vec4& b) const;

+ 15 - 1
src/Math/Vec4.inl.h

@@ -75,7 +75,7 @@ inline Vec4::Vec4(const Vec3& v3, float w_)
 	w() = w_;
 }
 
-// copy
+// Copy
 inline Vec4::Vec4(const Vec4& b)
 {
 	#if defined(MATH_INTEL_SIMD)
@@ -177,6 +177,20 @@ inline float Vec4::w() const
 // Operators with same                                                                                                 =
 //======================================================================================================================
 
+// =
+inline Vec4& Vec4::operator=(const Vec4& b)
+{
+	#if defined(MATH_INTEL_SIMD)
+		mm = b.mm;
+	#else
+		x() = b.x();
+		y() = b.y();
+		z() = b.z();
+		w() = b.w();
+	#endif
+	return SELF;
+}
+
 // +
 inline Vec4 Vec4::operator+(const Vec4& b) const
 {

+ 6 - 3
src/Scripting/Scene/MaterialRuntime/MaterialRuntime.bpi.cpp

@@ -4,12 +4,15 @@
 
 WRAP(MaterialRuntime)
 {
-	WRAP_CONTAINER(MaterialRuntime::MaterialRuntimeUserDefinedVarContainer)
+	/*class_<MaterialRuntime::MaterialRuntimeUserDefinedVarContainer, noncopyable>("MaterialRuntime::MaterialRuntimeUserDefinedVarContainer", no_init)
+		.def(vector_indexing_suite<MaterialRuntime::MaterialRuntimeUserDefinedVarContainer, true>())
+	;*/
+	//WRAP_CONTAINER(MaterialRuntime::MaterialRuntimeUserDefinedVarContainer)
 
 	class_<MaterialRuntime, noncopyable>("MaterialRuntime", no_init)
-		/*.def("getUserDefinedVars",
+		.def("getUserDefinedVars",
 		     (boost::ptr_vector<MaterialRuntimeUserDefinedVar>& (MaterialRuntime::*)())(&MaterialRuntime::getUserDefinedVars),
-		     return_value_policy<reference_existing_object>())*/
+		     return_value_policy<reference_existing_object>())
 
 		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*, const float&))(&MaterialRuntime::setUserDefVarValue))
 		.def("setUserDefVar", (void (MaterialRuntime::*)(const char*, const Vec2&))(&MaterialRuntime::setUserDefVarValue))

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio