Przeglądaj źródła

Merge pull request #269 from CIB/cleanup

Functions renamed to comply with naming convention
Ivan Safrin 12 lat temu
rodzic
commit
ff83244f8b

+ 1 - 1
Core/Contents/Include/PolyMatrix4.h

@@ -282,7 +282,7 @@ namespace Polycode {
 			/**
 			/**
 			* Returns the inverse of the matrix.
 			* Returns the inverse of the matrix.
 			*/
 			*/
-			Matrix4 inverse() const;
+			Matrix4 Inverse() const;
 			
 			
 			/**
 			/**
 			* Returns the affine inverse of the matrix.
 			* Returns the affine inverse of the matrix.

+ 180 - 179
Core/Contents/Include/PolyQuaternion.h

@@ -58,132 +58,133 @@ namespace Polycode {
 			
 			
 		
 		
 			inline void setFromMatrix(const Matrix4 &_mat) {
 			inline void setFromMatrix(const Matrix4 &_mat) {
-			Number fTrace = _mat.m[0][0]+_mat.m[1][1]+_mat.m[2][2];
-			Number fRoot;
-			
-			if ( fTrace > 0.0 ) {
-				fRoot = sqrtf(fTrace + 1.0);  // 2w
-				w = 0.5*fRoot;
-				fRoot = 0.5/fRoot;
-				x = (_mat.m[2][1]-_mat.m[1][2])*fRoot;
-				y = (_mat.m[0][2]-_mat.m[2][0])*fRoot;
-				z = (_mat.m[1][0]-_mat.m[0][1])*fRoot;
-			}
-			else
-			{
-				static size_t s_iNext[3] = { 1, 2, 0 };
-				size_t i = 0;
-				if ( _mat.m[1][1] > _mat.m[0][0] )
-					i = 1;
-				if ( _mat.m[2][2] > _mat.m[i][i] )
-					i = 2;
-				size_t j = s_iNext[i];
-				size_t k = s_iNext[j];
+				Number fTrace = _mat.m[0][0]+_mat.m[1][1]+_mat.m[2][2];
+				Number fRoot;
 				
 				
-				fRoot = sqrtf(_mat.m[i][i]-_mat.m[j][j]-_mat.m[k][k] + 1.0);
-				Number* apkQuat[3] = { &x, &y, &z };
-				*apkQuat[i] = 0.5*fRoot;
-				fRoot = 0.5/fRoot;
-				w = (_mat.m[k][j]-_mat.m[j][k])*fRoot;
-				*apkQuat[j] = (_mat.m[j][i]+_mat.m[i][j])*fRoot;
-				*apkQuat[k] = (_mat.m[k][i]+_mat.m[i][k])*fRoot;
-			}			
-		}
+				if ( fTrace > 0.0 ) {
+					fRoot = sqrtf(fTrace + 1.0);  // 2w
+					w = 0.5*fRoot;
+					fRoot = 0.5/fRoot;
+					x = (_mat.m[2][1]-_mat.m[1][2])*fRoot;
+					y = (_mat.m[0][2]-_mat.m[2][0])*fRoot;
+					z = (_mat.m[1][0]-_mat.m[0][1])*fRoot;
+				}
+				else
+				{
+					static size_t s_iNext[3] = { 1, 2, 0 };
+					size_t i = 0;
+					if ( _mat.m[1][1] > _mat.m[0][0] )
+						i = 1;
+					if ( _mat.m[2][2] > _mat.m[i][i] )
+						i = 2;
+					size_t j = s_iNext[i];
+					size_t k = s_iNext[j];
+					
+					fRoot = sqrtf(_mat.m[i][i]-_mat.m[j][j]-_mat.m[k][k] + 1.0);
+					Number* apkQuat[3] = { &x, &y, &z };
+					*apkQuat[i] = 0.5*fRoot;
+					fRoot = 0.5/fRoot;
+					w = (_mat.m[k][j]-_mat.m[j][k])*fRoot;
+					*apkQuat[j] = (_mat.m[j][i]+_mat.m[i][j])*fRoot;
+					*apkQuat[k] = (_mat.m[k][i]+_mat.m[i][k])*fRoot;
+				}			
+			}
 			
 			
 			static Quaternion Slerp(Number fT, const Quaternion& rkP, const Quaternion& rkQ, bool shortestPath=false);
 			static Quaternion Slerp(Number fT, const Quaternion& rkP, const Quaternion& rkQ, bool shortestPath=false);
 			Number Dot(const Quaternion& rkQ) const;
 			Number Dot(const Quaternion& rkQ) const;
-	Quaternion Log () const;
-    Quaternion Exp () const;	
-    Number Norm () const;
-    Number normalize();	
-    Quaternion operator+ (const Quaternion& rkQ) const;
-    Quaternion operator* (const Quaternion& rkQ) const;
-    Quaternion operator* (Number fScalar) const;
-		
-		inline void lookAt(const Vector3 &D, const Vector3 &upVector) {
-			/*
-			Vector3 D;
-			Vector3 back = D * -1;
-			back.Normalize();
-			
-			Vector3 right = back.crossProduct(upVector) ;
-			right.Normalize();
-			right = right * -1;
-			
-			Vector3 up = back.crossProduct(right);
-			
-			set( y.z - z.y , z.x - x.z, x.y - y.x, tr + 1.0f ); 
-			 */
-		}
-		
-		void createFromMatrix(const Matrix4& matrix) {
-			Number  tr, s, q[4];
-			int    i, j, k;
-			
-			static const int nxt[3] = {1, 2, 0};			
-			
-			tr = matrix.m[0][0] + matrix.m[1][1] + matrix.m[2][2];
-			
-			
-			// check the diagonal
-			if (tr > 0.0f)
-			{
-                s = sqrtf(tr + 1.0f);
-                w = s / 2.0f;
-                s = 0.5f / s;
-                x = (matrix.m[1][2] - matrix.m[2][1]) * s;
-                y = (matrix.m[2][0] - matrix.m[0][2]) * s;
-                z = (matrix.m[0][1] - matrix.m[1][0]) * s;
+			Quaternion Log () const;
+			Quaternion Exp () const;	
+			Number Norm () const;
+			Number Normalize();	
+			Quaternion operator+ (const Quaternion& rkQ) const;
+			Quaternion operator* (const Quaternion& rkQ) const;
+			Quaternion operator* (Number fScalar) const;
+
+			// TODO: implement
+			inline void lookAt(const Vector3 &D, const Vector3 &upVector) {
+				/*
+				Vector3 D;
+				Vector3 back = D * -1;
+				back.Normalize();
+				
+				Vector3 right = back.crossProduct(upVector) ;
+				right.Normalize();
+				right = right * -1;
+				
+				Vector3 up = back.crossProduct(right);
+				
+				set( y.z - z.y , z.x - x.z, x.y - y.x, tr + 1.0f ); 
+				 */
 			}
 			}
-			else
-			{
-                // diagonal is negative
-                i = 0;
-                if (matrix.m[1][1] > matrix.m[0][0]) i = 1;
-                if (matrix.m[2][2] > matrix.m[i][i]) i = 2;
-                j = nxt[i];
-                k = nxt[j];
+			
+			void createFromMatrix(const Matrix4& matrix) {
+				Number  tr, s, q[4];
+				int    i, j, k;
 				
 				
-                s = sqrtf((matrix.m[i][i] - (matrix.m[j][j] + matrix.m[k][k])) + 1.0f);
+				static const int nxt[3] = {1, 2, 0};			
 				
 				
-                q[i] = s * 0.5f;
+				tr = matrix.m[0][0] + matrix.m[1][1] + matrix.m[2][2];
 				
 				
-                if (s != 0.0f) s = 0.5f / s;
 				
 				
-                q[3] = (matrix.m[j][k] - matrix.m[k][j]) * s;
-                q[j] = (matrix.m[i][j] + matrix.m[j][i]) * s;
-                q[k] = (matrix.m[i][k] + matrix.m[k][i]) * s;
+				// check the diagonal
+				if (tr > 0.0f)
+				{
+					s = sqrtf(tr + 1.0f);
+					w = s / 2.0f;
+					s = 0.5f / s;
+					x = (matrix.m[1][2] - matrix.m[2][1]) * s;
+					y = (matrix.m[2][0] - matrix.m[0][2]) * s;
+					z = (matrix.m[0][1] - matrix.m[1][0]) * s;
+				}
+				else
+				{
+					// diagonal is negative
+					i = 0;
+					if (matrix.m[1][1] > matrix.m[0][0]) i = 1;
+					if (matrix.m[2][2] > matrix.m[i][i]) i = 2;
+					j = nxt[i];
+					k = nxt[j];
+					
+					s = sqrtf((matrix.m[i][i] - (matrix.m[j][j] + matrix.m[k][k])) + 1.0f);
+					
+					q[i] = s * 0.5f;
+					
+					if (s != 0.0f) s = 0.5f / s;
+					
+					q[3] = (matrix.m[j][k] - matrix.m[k][j]) * s;
+					q[j] = (matrix.m[i][j] + matrix.m[j][i]) * s;
+					q[k] = (matrix.m[i][k] + matrix.m[k][i]) * s;
+					
+					x = q[0];
+					y = q[1];
+					z = q[2];
+					w = q[3];
+				}
 				
 				
-                x = q[0];
-                y = q[1];
-                z = q[2];
-                w = q[3];
 			}
 			}
-			
-		}
 
 
 
 
-	inline bool operator== (const Quaternion& rhs) const
-	{
-			return (rhs.x == x) && (rhs.y == y) &&
-				(rhs.z == z) && (rhs.w == w);
-	}
+			inline bool operator== (const Quaternion& rhs) const
+			{
+					return (rhs.x == x) && (rhs.y == y) &&
+						(rhs.z == z) && (rhs.w == w);
+			}
 
 
-	inline bool operator!= (const Quaternion& rhs) const
-	{
-			return (rhs.x != x) && (rhs.y != y) &&
-				(rhs.z != z) && (rhs.w != w);
-	}
+			inline bool operator!= (const Quaternion& rhs) const
+			{
+					return (rhs.x != x) && (rhs.y != y) &&
+						(rhs.z != z) && (rhs.w != w);
+			}
 
 
 
 
-    static Quaternion Squad(Number fT, const Quaternion& rkP, const Quaternion& rkA, const Quaternion& rkB, const Quaternion& rkQ, bool shortestPath);
-	Quaternion Inverse () const;
-	
-    Quaternion operator- () const
-    {
-        return Quaternion(-w,-x,-y,-z);
-    }
+			static Quaternion Squad(Number fT, const Quaternion& rkP, const Quaternion& rkA, const Quaternion& rkB, const Quaternion& rkQ, bool shortestPath);
+			Quaternion Inverse() const;
 			
 			
+			Quaternion operator- () const
+			{
+				return Quaternion(-w,-x,-y,-z);
+			}
+					
 			void set(Number w, Number x, Number y, Number z) {
 			void set(Number w, Number x, Number y, Number z) {
 				this->w = w;
 				this->w = w;
 				this->x = x;
 				this->x = x;
@@ -191,86 +192,86 @@ namespace Polycode {
 				this->z = z;												
 				this->z = z;												
 			}
 			}
 			
 			
-			Quaternion inverse() {
+			Quaternion Inverse() {
 				Number fNorm = w*w+x*x+y*y+z*z;
 				Number fNorm = w*w+x*x+y*y+z*z;
 				Number fInvNorm = 1.0/fNorm;
 				Number fInvNorm = 1.0/fNorm;
 				return Quaternion(w*fInvNorm,-x*fInvNorm,-y*fInvNorm,-z*fInvNorm);
 				return Quaternion(w*fInvNorm,-x*fInvNorm,-y*fInvNorm,-z*fInvNorm);
 
 
 			}
 			}
 			
 			
-	Number InvSqrt(Number x){
-   Number xhalf = 0.5f * x;
-   int i = *(int*)&x; // store Numbering-point bits in integer
-   i = 0x5f3759d5 - (i >> 1); // initial guess for Newton's method
-   x = *(Number*)&i; // convert new bits into Number
-   x = x*(1.5f - xhalf*x*x); // One round of Newton's method
-   return x;
-}
-		
-	inline void fromAxes(Number az, Number ay, Number ax) {
-		ax *= TORADIANS;
-		ay *= TORADIANS;
-		az *= TORADIANS;		
-		
-		Number c1 = cos(ay / 2.0f);
-		Number c2 = cos(ax / 2.0f);
-		Number c3 = cos(az / 2.0f);
-		
-		Number s1 = sin(ay / 2.0f);
-		Number s2 = sin(ax / 2.0f);
-		Number s3 = sin(az / 2.0f);
-		
-		w = (c1*c2*c3) - (s1*s2*s3);
-		x = (s1*s2*c3) + (c1*c2*s3);
-		y = (s1*c2*c3) + (c1*s2*s3);
-		z = (c1*s2*c3) - (s1*c2*s3);		
-	}
-			
+			Number InvSqrt(Number x) {
+				Number xhalf = 0.5f * x;
+				int i = *(int*)&x; // store Numbering-point bits in integer
+				i = 0x5f3759d5 - (i >> 1); // initial guess for Newton's method
+				x = *(Number*)&i; // convert new bits into Number
+				x = x*(1.5f - xhalf*x*x); // One round of Newton's method
+				return x;
+			}
+				
+			inline void fromAxes(Number az, Number ay, Number ax) {
+				ax *= TORADIANS;
+				ay *= TORADIANS;
+				az *= TORADIANS;		
+				
+				Number c1 = cos(ay / 2.0f);
+				Number c2 = cos(ax / 2.0f);
+				Number c3 = cos(az / 2.0f);
+				
+				Number s1 = sin(ay / 2.0f);
+				Number s2 = sin(ax / 2.0f);
+				Number s3 = sin(az / 2.0f);
+				
+				w = (c1*c2*c3) - (s1*s2*s3);
+				x = (s1*s2*c3) + (c1*c2*s3);
+				y = (s1*c2*c3) + (c1*s2*s3);
+				z = (c1*s2*c3) - (s1*c2*s3);		
+			}
 			
 			
-    void FromAngleAxis (const Number& rfAngle,
-        const Vector3& rkAxis)
-    {
-        Number fHalfAngle ( 0.5*rfAngle );
-        Number fSin = sin(fHalfAngle);
-        w = cos(fHalfAngle);
-        x = fSin*rkAxis.x;
-        y = fSin*rkAxis.y;
-        z = fSin*rkAxis.z;
-    }
+					
+			void fromAngleAxis(const Number& rfAngle,
+				const Vector3& rkAxis)
+			{
+				Number fHalfAngle ( 0.5*rfAngle );
+				Number fSin = sin(fHalfAngle);
+				w = cos(fHalfAngle);
+				x = fSin*rkAxis.x;
+				y = fSin*rkAxis.y;
+				z = fSin*rkAxis.z;
+			}
 
 
-	void ToEulerAngles (Vector3& eulerAngles) {
-		// See http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
-		// q0 = w, q1 = x, q2 = y, q3 = z
-		eulerAngles.x = atan2( 2 * ( w * x + y * z), 1 - 2 * (x * x + y * y) );
-		eulerAngles.y = asin(2 * ( w * y - z * x));
-		eulerAngles.z = atan2( 2 * ( w * z + x * y), 1 - 2 * (y * y + z * z) );
-	}
+			void toEulerAngles (Vector3& eulerAngles) {
+				// See http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
+				// q0 = w, q1 = x, q2 = y, q3 = z
+				eulerAngles.x = atan2( 2 * ( w * x + y * z), 1 - 2 * (x * x + y * y) );
+				eulerAngles.y = asin(2 * ( w * y - z * x));
+				eulerAngles.z = atan2( 2 * ( w * z + x * y), 1 - 2 * (y * y + z * z) );
+			}
 
 
-    //-----------------------------------------------------------------------
-    void ToAngleAxis (Number& rfAngle, Vector3& rkAxis) 
-    {
-        // The quaternion representing the rotation is
-        //   q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k)
+			//-----------------------------------------------------------------------
+			void toAngleAxis (Number& rfAngle, Vector3& rkAxis) 
+			{
+				// The quaternion representing the rotation is
+				//   q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k)
 
 
-        Number fSqrLength = x*x+y*y+z*z;
-        if ( fSqrLength > 0.0 )
-        {
-            rfAngle = 2.0*acos(w);
-            Number fInvLength = InvSqrt(fSqrLength);
-            rkAxis.x = x*fInvLength;
-            rkAxis.y = y*fInvLength;
-            rkAxis.z = z*fInvLength;
-        }
-        else
-        {
-            // angle is 0 (mod 2*pi), so any axis will do
-            rfAngle = Number(0.0);
-            rkAxis.x = 1.0;
-            rkAxis.y = 0.0;
-            rkAxis.z = 0.0;
-        }
-    }			
-			
+				Number fSqrLength = x*x+y*y+z*z;
+				if ( fSqrLength > 0.0 )
+				{
+					rfAngle = 2.0*acos(w);
+					Number fInvLength = InvSqrt(fSqrLength);
+					rkAxis.x = x*fInvLength;
+					rkAxis.y = y*fInvLength;
+					rkAxis.z = z*fInvLength;
+				}
+				else
+				{
+					// angle is 0 (mod 2*pi), so any axis will do
+					rfAngle = Number(0.0);
+					rkAxis.x = 1.0;
+					rkAxis.y = 0.0;
+					rkAxis.z = 0.0;
+				}
+			}			
+					
 			void createFromAxisAngle(Number x, Number y, Number z, Number degrees);
 			void createFromAxisAngle(Number x, Number y, Number z, Number degrees);
 			Matrix4 createMatrix() const;
 			Matrix4 createMatrix() const;
 			
 			

+ 1 - 1
Core/Contents/Source/PolyCamera.cpp

@@ -399,6 +399,6 @@ void Camera::doCameraTransform() {
 
 
 	Matrix4 camMatrix = getConcatenatedMatrix();
 	Matrix4 camMatrix = getConcatenatedMatrix();
 	CoreServices::getInstance()->getRenderer()->setCameraMatrix(camMatrix);	
 	CoreServices::getInstance()->getRenderer()->setCameraMatrix(camMatrix);	
-	camMatrix = camMatrix.inverse();
+	camMatrix = camMatrix.Inverse();
 	CoreServices::getInstance()->getRenderer()->multModelviewMatrix(camMatrix);		
 	CoreServices::getInstance()->getRenderer()->multModelviewMatrix(camMatrix);		
 }
 }

+ 2 - 2
Core/Contents/Source/PolyEntity.cpp

@@ -434,8 +434,8 @@ void Entity::transformAndRender() {
 		
 		
 	renderer->pushMatrix();
 	renderer->pushMatrix();
 	if(ignoreParentMatrix && parentEntity) {
 	if(ignoreParentMatrix && parentEntity) {
-		renderer->multModelviewMatrix(parentEntity->getConcatenatedMatrix().inverse());
-//		renderer->setCurrentModelMatrix(parentEntity->getConcatenatedMatrix().inverse());
+		renderer->multModelviewMatrix(parentEntity->getConcatenatedMatrix().Inverse());
+//		renderer->setCurrentModelMatrix(parentEntity->getConcatenatedMatrix().Inverse());
 	}
 	}
 
 
 		renderer->multModelviewMatrix(transformMatrix);
 		renderer->multModelviewMatrix(transformMatrix);

+ 1 - 1
Core/Contents/Source/PolyGLES1Renderer.cpp

@@ -132,7 +132,7 @@ bool OpenGLES1Renderer::test2DCoordinate(Number x, Number y, Poly::Polygon *poly
 	GLfloat nearPlane[3],farPlane[3];
 	GLfloat nearPlane[3],farPlane[3];
 	
 	
 	GLfloat mv[16];
 	GLfloat mv[16];
-	Matrix4 camInverse = cameraMatrix.inverse();	
+	Matrix4 camInverse = cameraMatrix.Inverse();	
 	Matrix4 cmv;
 	Matrix4 cmv;
 	cmv.identity();
 	cmv.identity();
 	cmv = cmv * camInverse;
 	cmv = cmv * camInverse;

+ 1 - 1
Core/Contents/Source/PolyGLRenderer.cpp

@@ -243,7 +243,7 @@ Vector3 OpenGLRenderer::projectRayFrom2DCoordinate(Number x, Number y) {
 	GLdouble nearPlane[3],farPlane[3];
 	GLdouble nearPlane[3],farPlane[3];
 	
 	
 	GLdouble mv[16];
 	GLdouble mv[16];
-	Matrix4 camInverse = cameraMatrix.inverse();	
+	Matrix4 camInverse = cameraMatrix.Inverse();	
 	Matrix4 cmv;
 	Matrix4 cmv;
 	cmv.identity();
 	cmv.identity();
 	cmv = cmv * camInverse;
 	cmv = cmv * camInverse;

+ 3 - 3
Core/Contents/Source/PolyGLSLShaderModule.cpp

@@ -269,7 +269,7 @@ bool GLSLShaderModule::applyShaderMaterial(Renderer *renderer, Material *materia
 		LightInfo light;
 		LightInfo light;
 		if(i < numRendererAreaLights) {
 		if(i < numRendererAreaLights) {
 			light = areaLights[i];
 			light = areaLights[i];
-			light.position = renderer->getCameraMatrix().inverse() * light.position;
+			light.position = renderer->getCameraMatrix().Inverse() * light.position;
 			ambientVal[0] = renderer->ambientColor.r;
 			ambientVal[0] = renderer->ambientColor.r;
 			ambientVal[1] = renderer->ambientColor.g;
 			ambientVal[1] = renderer->ambientColor.g;
 			ambientVal[2] = renderer->ambientColor.b;										
 			ambientVal[2] = renderer->ambientColor.b;										
@@ -319,8 +319,8 @@ bool GLSLShaderModule::applyShaderMaterial(Renderer *renderer, Material *materia
 			light = spotLights[i];
 			light = spotLights[i];
 			pos = light.position;
 			pos = light.position;
 			dir = light.dir;						
 			dir = light.dir;						
-			pos = renderer->getCameraMatrix().inverse() * pos;
-			dir = renderer->getCameraMatrix().inverse().rotateVector(dir);
+			pos = renderer->getCameraMatrix().Inverse() * pos;
+			dir = renderer->getCameraMatrix().Inverse().rotateVector(dir);
 			
 			
 			ambientVal[0] = renderer->ambientColor.r;
 			ambientVal[0] = renderer->ambientColor.r;
 			ambientVal[1] = renderer->ambientColor.g;
 			ambientVal[1] = renderer->ambientColor.g;

+ 1 - 1
Core/Contents/Source/PolyMatrix4.cpp

@@ -36,7 +36,7 @@ Matrix4::Matrix4(const Number *m) {
 	memcpy(ml, m, sizeof(Number)*16);
 	memcpy(ml, m, sizeof(Number)*16);
 }
 }
 
 
-Matrix4 Matrix4::inverse() const
+Matrix4 Matrix4::Inverse() const
 {
 {
 	Number m00 = m[0][0], m01 = m[0][1], m02 = m[0][2], m03 = m[0][3];
 	Number m00 = m[0][0], m01 = m[0][1], m02 = m[0][2], m03 = m[0][3];
 	Number m10 = m[1][0], m11 = m[1][1], m12 = m[1][2], m13 = m[1][3];
 	Number m10 = m[1][0], m11 = m[1][1], m12 = m[1][2], m13 = m[1][3];

+ 2 - 2
Core/Contents/Source/PolyQuaternion.cpp

@@ -178,7 +178,7 @@ Matrix4 Quaternion::createMatrix() const
         return w*w+x*x+y*y+z*z;
         return w*w+x*x+y*y+z*z;
     }
     }
 
 
-    Number Quaternion::normalize()
+    Number Quaternion::Normalize()
     {
     {
         Number len = Norm();
         Number len = Norm();
         Number factor = 1.0f / sqrtf(len);
         Number factor = 1.0f / sqrtf(len);
@@ -222,7 +222,7 @@ Matrix4 Quaternion::createMatrix() const
             //    have method to fix this case, so just use linear interpolation here.
             //    have method to fix this case, so just use linear interpolation here.
             Quaternion t = (1.0f - fT) * rkP + fT * rkT;
             Quaternion t = (1.0f - fT) * rkP + fT * rkT;
             // taking the complement requires renormalisation
             // taking the complement requires renormalisation
-            t.normalize();
+            t.Normalize();
             return t;
             return t;
         }
         }
     }
     }

+ 2 - 2
Core/Contents/Source/PolyRenderer.cpp

@@ -103,7 +103,7 @@ bool Renderer::test2DCoordinateInPolygon(Number x, Number y, Polycode::Polygon *
 	Matrix4 fullMatrix = matrix;
 	Matrix4 fullMatrix = matrix;
 	
 	
 	if(billboardMode) {
 	if(billboardMode) {
-		Matrix4 camInverse = cameraMatrix.inverse();
+		Matrix4 camInverse = cameraMatrix.Inverse();
 		fullMatrix = fullMatrix * camInverse;
 		fullMatrix = fullMatrix * camInverse;
 		
 		
 		fullMatrix.m[0][0] = 1;
 		fullMatrix.m[0][0] = 1;
@@ -230,7 +230,7 @@ void Renderer::addShaderModule(PolycodeShaderModule *module) {
 void Renderer::sortLights(){
 void Renderer::sortLights(){
 
 
 	sorter.basePosition = (getModelviewMatrix()).getPosition();
 	sorter.basePosition = (getModelviewMatrix()).getPosition();
-	sorter.cameraMatrix = getCameraMatrix().inverse();	
+	sorter.cameraMatrix = getCameraMatrix().Inverse();	
 	sort (areaLights.begin(), areaLights.end(), sorter);
 	sort (areaLights.begin(), areaLights.end(), sorter);
 	sort (spotLights.begin(), spotLights.end(), sorter);	
 	sort (spotLights.begin(), spotLights.end(), sorter);	
 }
 }

+ 9 - 8
Core/Contents/Source/PolyScreenEntity.cpp

@@ -201,6 +201,7 @@ ScreenEntity::~ScreenEntity() {
 	if(CoreServices::getInstance()->focusedChild == this) {
 	if(CoreServices::getInstance()->focusedChild == this) {
 		CoreServices::getInstance()->focusedChild = NULL;
 		CoreServices::getInstance()->focusedChild = NULL;
 	}
 	}
+	if(dragLimits) delete dragLimits;
 }
 }
 
 
 void ScreenEntity::setBlendingMode(int newBlendingMode) {
 void ScreenEntity::setBlendingMode(int newBlendingMode) {
@@ -368,7 +369,7 @@ MouseEventResult ScreenEntity::_onMouseMove(Number x, Number y, int timestamp, V
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);				
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);				
 				
 				
 		if(parentEntity) {
 		if(parentEntity) {
-			Matrix4 inverse = ((ScreenEntity*)parentEntity)->getScreenConcatenatedMatrix().inverse();
+			Matrix4 inverse = ((ScreenEntity*)parentEntity)->getScreenConcatenatedMatrix().Inverse();
 			localCoordinate = inverse * localCoordinate;		
 			localCoordinate = inverse * localCoordinate;		
 		}
 		}
 	
 	
@@ -396,7 +397,7 @@ MouseEventResult ScreenEntity::_onMouseMove(Number x, Number y, int timestamp, V
 	
 	
 	
 	
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);		
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);		
-		Matrix4 inverse = getConcatenatedMatrix().inverse();
+		Matrix4 inverse = getConcatenatedMatrix().Inverse();
 		localCoordinate = inverse * localCoordinate;
 		localCoordinate = inverse * localCoordinate;
 		if(positionMode == POSITION_TOPLEFT)
 		if(positionMode == POSITION_TOPLEFT)
 			localCoordinate.x += hit.w/2.0;
 			localCoordinate.x += hit.w/2.0;
@@ -425,7 +426,7 @@ MouseEventResult ScreenEntity::_onMouseMove(Number x, Number y, int timestamp, V
 		if(mouseOver) {
 		if(mouseOver) {
 		
 		
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);		
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);		
-		Matrix4 inverse = getConcatenatedMatrix().inverse();
+		Matrix4 inverse = getConcatenatedMatrix().Inverse();
 		localCoordinate = inverse * localCoordinate;
 		localCoordinate = inverse * localCoordinate;
 		if(positionMode == POSITION_TOPLEFT)
 		if(positionMode == POSITION_TOPLEFT)
 			localCoordinate.x += hit.w/2.0;
 			localCoordinate.x += hit.w/2.0;
@@ -466,7 +467,7 @@ MouseEventResult ScreenEntity::_onMouseUp(Number x, Number y, int mouseButton, i
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		
 		
-		Matrix4 inverse = getConcatenatedMatrix().inverse();
+		Matrix4 inverse = getConcatenatedMatrix().Inverse();
 		localCoordinate = inverse * localCoordinate;
 		localCoordinate = inverse * localCoordinate;
 		if(positionMode == POSITION_TOPLEFT)
 		if(positionMode == POSITION_TOPLEFT)
 			localCoordinate.x += hit.w/2.0;
 			localCoordinate.x += hit.w/2.0;
@@ -487,7 +488,7 @@ MouseEventResult ScreenEntity::_onMouseUp(Number x, Number y, int mouseButton, i
 	} else {
 	} else {
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		
 		
-		Matrix4 inverse = getConcatenatedMatrix().inverse();
+		Matrix4 inverse = getConcatenatedMatrix().Inverse();
 		localCoordinate = inverse * localCoordinate;
 		localCoordinate = inverse * localCoordinate;
 		if(positionMode == POSITION_TOPLEFT)
 		if(positionMode == POSITION_TOPLEFT)
 			localCoordinate.x += hit.w/2.0;
 			localCoordinate.x += hit.w/2.0;
@@ -528,7 +529,7 @@ MouseEventResult ScreenEntity::_onMouseWheelUp(Number x, Number y, int timestamp
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		
 		
-		Matrix4 inverse = getConcatenatedMatrix().inverse();
+		Matrix4 inverse = getConcatenatedMatrix().Inverse();
 		localCoordinate = inverse * localCoordinate;
 		localCoordinate = inverse * localCoordinate;
 		if(positionMode == POSITION_TOPLEFT)
 		if(positionMode == POSITION_TOPLEFT)
 			localCoordinate.x += hit.w/2.0;
 			localCoordinate.x += hit.w/2.0;
@@ -573,7 +574,7 @@ MouseEventResult ScreenEntity::_onMouseWheelDown(Number x, Number y, int timesta
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		
 		
-		Matrix4 inverse = getConcatenatedMatrix().inverse();
+		Matrix4 inverse = getConcatenatedMatrix().Inverse();
 		localCoordinate = inverse * localCoordinate;
 		localCoordinate = inverse * localCoordinate;
 		if(positionMode == POSITION_TOPLEFT)
 		if(positionMode == POSITION_TOPLEFT)
 			localCoordinate.x += hit.w/2.0;
 			localCoordinate.x += hit.w/2.0;
@@ -621,7 +622,7 @@ MouseEventResult ScreenEntity::_onMouseDown(Number x, Number y, int mouseButton,
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 	if(hitTest(x+parentAdjust.x,y+parentAdjust.y)) {
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		Vector3 localCoordinate = Vector3(x+(parentAdjust.x*2.0),y+(parentAdjust.y*2.0),0);
 		
 		
-		Matrix4 inverse = getConcatenatedMatrix().inverse();
+		Matrix4 inverse = getConcatenatedMatrix().Inverse();
 		localCoordinate = inverse * localCoordinate;
 		localCoordinate = inverse * localCoordinate;
 		if(positionMode == POSITION_TOPLEFT)
 		if(positionMode == POSITION_TOPLEFT)
 			localCoordinate.x += hit.w/2.0;
 			localCoordinate.x += hit.w/2.0;

+ 3 - 3
IDE/Contents/Source/PolycodeScreenEditor.cpp

@@ -1033,7 +1033,7 @@ void PolycodeScreenEditorMain::handleMouseMove(Vector2 position) {
 					for(int i=0; i < selectedEntities.size(); i++) {
 					for(int i=0; i < selectedEntities.size(); i++) {
 						Vector3 v3Center = Vector3(groupCenterPoint.x,groupCenterPoint.y,0.0);
 						Vector3 v3Center = Vector3(groupCenterPoint.x,groupCenterPoint.y,0.0);
 						
 						
-						Vector3 v3CenterRelative = selectedEntities[i]->getParentEntity()->getConcatenatedMatrixRelativeTo(baseEntity).inverse() * v3Center;	
+						Vector3 v3CenterRelative = selectedEntities[i]->getParentEntity()->getConcatenatedMatrixRelativeTo(baseEntity).Inverse() * v3Center;	
 						
 						
 						selectedEntities[i]->setRotation(baseRotateAngles[i] - (TODEGREES * (newAngle-baseAngle)));						
 						selectedEntities[i]->setRotation(baseRotateAngles[i] - (TODEGREES * (newAngle-baseAngle)));						
 						
 						
@@ -1096,9 +1096,9 @@ void PolycodeScreenEditorMain::handleMouseMove(Vector2 position) {
 					Vector3 trans3 = Vector3(trans.x, trans.y, 0.0);
 					Vector3 trans3 = Vector3(trans.x, trans.y, 0.0);
 				
 				
 					Vector3 trans3_a = baseEntity->getConcatenatedMatrix() * trans3;				
 					Vector3 trans3_a = baseEntity->getConcatenatedMatrix() * trans3;				
-					Vector3 trans3_b = selectedEntities[i]->getParentEntity()->getConcatenatedMatrix().inverse() * trans3_a;
+					Vector3 trans3_b = selectedEntities[i]->getParentEntity()->getConcatenatedMatrix().Inverse() * trans3_a;
 				
 				
-					trans3_b = trans3_b - selectedEntities[i]->getParentEntity()->getConcatenatedMatrixRelativeTo(baseEntity).inverse().getPosition();
+					trans3_b = trans3_b - selectedEntities[i]->getParentEntity()->getConcatenatedMatrixRelativeTo(baseEntity).Inverse().getPosition();
 					
 					
 				
 				
 					Vector2 newPosition = Vector2(baseEntityPositions[i].x + trans3_b.x, baseEntityPositions[i].y + trans3_b.y);
 					Vector2 newPosition = Vector2(baseEntityPositions[i].x + trans3_b.x, baseEntityPositions[i].y + trans3_b.y);

+ 3 - 3
Modules/Contents/CgShading/Source/PolyCGShaderModule.cpp

@@ -124,7 +124,7 @@ void CGShaderModule::setCGAreaLightPositionParameter(Renderer *renderer, CGProgr
 	if(renderer->getNumAreaLights() > lightIndex) {
 	if(renderer->getNumAreaLights() > lightIndex) {
 		vector<LightInfo> areaLights = renderer->getAreaLights();			
 		vector<LightInfo> areaLights = renderer->getAreaLights();			
 		Vector3 lPos(areaLights[lightIndex].position.x,areaLights[lightIndex].position.y,areaLights[lightIndex].position.z);
 		Vector3 lPos(areaLights[lightIndex].position.x,areaLights[lightIndex].position.y,areaLights[lightIndex].position.z);
-		lPos = renderer->getCameraMatrix().inverse() * lPos;
+		lPos = renderer->getCameraMatrix().Inverse() * lPos;
 		cgGLSetParameter4f(param.cgParam, lPos.x,lPos.y,lPos.z, areaLights[lightIndex].distance);
 		cgGLSetParameter4f(param.cgParam, lPos.x,lPos.y,lPos.z, areaLights[lightIndex].distance);
 	} else {
 	} else {
 		cgGLSetParameter4f(param.cgParam, 0,0,0,0);
 		cgGLSetParameter4f(param.cgParam, 0,0,0,0);
@@ -135,7 +135,7 @@ void CGShaderModule::setCGSpotLightPositionParameter(Renderer *renderer, CGProgr
 	if(renderer->getNumSpotLights() > lightIndex) {
 	if(renderer->getNumSpotLights() > lightIndex) {
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		Vector3 lPos(spotLights[lightIndex].position.x,spotLights[lightIndex].position.y,spotLights[lightIndex].position.z);
 		Vector3 lPos(spotLights[lightIndex].position.x,spotLights[lightIndex].position.y,spotLights[lightIndex].position.z);
-		lPos = renderer->getCameraMatrix().inverse() * lPos;
+		lPos = renderer->getCameraMatrix().Inverse() * lPos;
 		cgGLSetParameter4f(param.cgParam, lPos.x,lPos.y,lPos.z, spotLights[lightIndex].distance);
 		cgGLSetParameter4f(param.cgParam, lPos.x,lPos.y,lPos.z, spotLights[lightIndex].distance);
 	} else {
 	} else {
 		cgGLSetParameter4f(param.cgParam, 0,0,0,0);
 		cgGLSetParameter4f(param.cgParam, 0,0,0,0);
@@ -146,7 +146,7 @@ void CGShaderModule::setCGSpotLightDirectionParameter(Renderer *renderer, CGProg
 	if(renderer->getNumSpotLights() > lightIndex) {
 	if(renderer->getNumSpotLights() > lightIndex) {
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		Vector3 lPos(spotLights[lightIndex].dir.x,spotLights[lightIndex].dir.y,spotLights[lightIndex].dir.z);
 		Vector3 lPos(spotLights[lightIndex].dir.x,spotLights[lightIndex].dir.y,spotLights[lightIndex].dir.z);
-		lPos = renderer->getCameraMatrix().inverse().rotateVector(lPos);
+		lPos = renderer->getCameraMatrix().Inverse().rotateVector(lPos);
 		cgGLSetParameter3f(param.cgParam, lPos.x,lPos.y,lPos.z);
 		cgGLSetParameter3f(param.cgParam, lPos.x,lPos.y,lPos.z);
 	} else {
 	} else {
 		cgGLSetParameter3f(param.cgParam, 0.0f,0.0f,0.0f);
 		cgGLSetParameter3f(param.cgParam, 0.0f,0.0f,0.0f);

+ 2 - 2
Modules/Contents/GLSL/Source/PolyGLSLShaderModule.cpp

@@ -145,7 +145,7 @@ void GLSLShaderModule::setGLSLSpotLightPositionParameter(Renderer *renderer, GLS
 	if(renderer->getNumSpotLights() > lightIndex) {
 	if(renderer->getNumSpotLights() > lightIndex) {
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		Vector3 lPos(spotLights[lightIndex].position.x,spotLights[lightIndex].position.y,spotLights[lightIndex].position.z);
 		Vector3 lPos(spotLights[lightIndex].position.x,spotLights[lightIndex].position.y,spotLights[lightIndex].position.z);
-		lPos = renderer->getCameraMatrix().inverse() * lPos;
+		lPos = renderer->getCameraMatrix().Inverse() * lPos;
 //		cgGLSetParameter4f(param.cgParam, lPos.x,lPos.y,lPos.z, spotLights[lightIndex].distance);
 //		cgGLSetParameter4f(param.cgParam, lPos.x,lPos.y,lPos.z, spotLights[lightIndex].distance);
 	} else {
 	} else {
 //		cgGLSetParameter4f(param.cgParam, 0,0,0,0);
 //		cgGLSetParameter4f(param.cgParam, 0,0,0,0);
@@ -156,7 +156,7 @@ void GLSLShaderModule::setGLSLSpotLightDirectionParameter(Renderer *renderer, GL
 	if(renderer->getNumSpotLights() > lightIndex) {
 	if(renderer->getNumSpotLights() > lightIndex) {
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		vector<LightInfo> spotLights = renderer->getSpotLights();		
 		Vector3 lPos(spotLights[lightIndex].dir.x,spotLights[lightIndex].dir.y,spotLights[lightIndex].dir.z);
 		Vector3 lPos(spotLights[lightIndex].dir.x,spotLights[lightIndex].dir.y,spotLights[lightIndex].dir.z);
-		lPos = renderer->getCameraMatrix().inverse().rotateVector(lPos);
+		lPos = renderer->getCameraMatrix().Inverse().rotateVector(lPos);
 //		cgGLSetParameter3f(param.cgParam, lPos.x,lPos.y,lPos.z);
 //		cgGLSetParameter3f(param.cgParam, lPos.x,lPos.y,lPos.z);
 	} else {
 	} else {
 //		cgGLSetParameter3f(param.cgParam, 0.0f,0.0f,0.0f);
 //		cgGLSetParameter3f(param.cgParam, 0.0f,0.0f,0.0f);