Explorar el Código

Added Matrix multiplyWithPerspective method, as opposed to the
default affine multiplication

Bill Robinson hace 11 años
padre
commit
f4b9dbfe73
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      Core/Contents/Include/PolyMatrix4.h

+ 6 - 0
Core/Contents/Include/PolyMatrix4.h

@@ -108,6 +108,12 @@ namespace Polycode {
 				return pos;
 			}
 
+			inline Vector3 multiplyWithPerspective(const Vector3 &v2) const
+			{
+				Number divisor = v2.x*m[0][3] + v2.y*m[1][3] + v2.z*m[2][3] + m[3][3];
+				return (*this * v2) / divisor;
+			}
+
 			// ----------------------------------------------------------------------------------------------------------------
 			/** @name Operators
 			*  Available vector operators.