Beispiel #1
0
        /**
         * Gets the result of adding a matrix to this.
         *
         * @param Other The Matrix to add.
         * @return The result of addition.
         */
        public static FMatrix operator+(FMatrix This, FMatrix Other)
        {
            FMatrix ResultMat = new FMatrix();

            for (int X = 0; X < 4; X++)
            {
                for (int Y = 0; Y < 4; Y++)
                {
                    ResultMat[X, Y] = This[X, Y] + Other[X, Y];
                }
            }

            return(ResultMat);
        }
Beispiel #2
0
        /**
         * This isn't applying SCALE, just multiplying float to all members - i.e. weighting
         */
        public static FMatrix operator*(FMatrix This, float Other)
        {
            FMatrix ResultMat = new FMatrix();

            for (int X = 0; X < 4; X++)
            {
                for (int Y = 0; Y < 4; Y++)
                {
                    ResultMat[X, Y] = This[X, Y] * Other;
                }
            }

            return(ResultMat);
        }
Beispiel #3
0
        /**
         * Checks whether another Matrix is equal to this, within specified tolerance.
         *
         * @param Other The other Matrix.
         * @param Tolerance Error Tolerance.
         * @return true if two Matrix are equal, within specified tolerance, otherwise false.
         */
        public override bool Equals(object Obj)
        {
            FMatrix Other     = (FMatrix)Obj;
            float   Tolerance = Const.KINDA_SMALL_NUMBER;

            for (int X = 0; X < 4; X++)
            {
                for (int Y = 0; Y < 4; Y++)
                {
                    if (FMath.Abs(this[X, Y] - Other[X, Y]) > Tolerance)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Beispiel #4
0
        public void SetFromMatrix(FMatrix InMatrix)
        {
            FMatrix M = InMatrix;

            // Get the 3D scale from the matrix
            Scale3D = M.ExtractScaling();

            // If there is negative scaling going on, we handle that here
            if (InMatrix.Determinant() < 0.0f)
            {
                // Assume it is along X and modify transform accordingly.
                // It doesn't actually matter which axis we choose, the 'appearance' will be the same
                Scale3D.X *= -1.0f;
                M.SetAxis(0, -M.GetScaledAxis(EAxis.X));
            }

            Rotation    = new FQuat(M);
            Translation = InMatrix.GetOrigin();

            // Normalize rotation
            Rotation.Normalize();
        }
Beispiel #5
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix TransposeAdjoint(ref FMatrix This);
Beispiel #6
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix Inverse(ref FMatrix This);
Beispiel #7
0
        /**
         *	Transform a direction vector by the inverse of this matrix - will not take into account translation part.
         *	If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT with adjoint of matrix inverse.
         */
        public FVector InverseTransformVector(FVector V)
        {
            FMatrix InvSelf = this.InverseFast();

            return(InvSelf.TransformVector(V));
        }
Beispiel #8
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FVector4 TransformFVector4(ref FMatrix This, ref FVector4 V);
Beispiel #9
0
 public void SetFromMatrix(FMatrix inMatrix)
 => E_FTransform_SetFromMatrix(this, inMatrix);
Beispiel #10
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FRotator Rotator(ref FMatrix This);
Beispiel #11
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix ConcatTranslation(ref FMatrix This, ref FVector Translation);
Beispiel #12
0
 public FQuat(FMatrix M)
 {
     this = MakeFromMatrix(M);
 }
Beispiel #13
0
 public static FQuat MakeFromMatrix(FMatrix Matrix)
 {
     return(MakeFromMatrix(ref Matrix));
 }
Beispiel #14
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FQuat MakeFromMatrix(ref FMatrix Matrix);
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="srcProjMat">source projection matrix to premultiply with the clip matrix</param>
 /// <param name="plane">clipping plane used to build the clip matrix (assumed to be in camera space)</param>
 public FClipProjectionMatrix(FMatrix srcProjMat, FPlane plane) :
     base(E_CreateStruct_FClipProjectionMatrix_FMatrix_FPlane(srcProjMat, plane), false)
 {
 }
Beispiel #16
0
 /// <summary>
 /// Constructor for converting a Matrix (including scale) into a FTransform.
 /// </summary>
 public FTransform(FMatrix inMatrix) :
     base(E_CreateStruct_FTransform_FMatrix(inMatrix), false)
 {
 }
Beispiel #17
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static void RemoveScaling(ref FMatrix This, float Tolerance);
 public FInstancedStaticMeshInstanceData(FMatrix inTransform) :
     base(E_CreateStruct_FInstancedStaticMeshInstanceData_FMatrix(inTransform), false)
 {
 }
Beispiel #19
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FVector ExtractScaling(ref FMatrix This, float Tolerance);
Beispiel #20
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static void Mirror(ref FMatrix This, int MirrorAxis, int FlipAxis);
Beispiel #21
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix ApplyScale(ref FMatrix This, float Scale);
Beispiel #22
0
 static extern bool GetFrustumTopPlane(ref FMatrix This, out FPlane OutPlane);
Beispiel #23
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static bool GetFrustumBottomPlane(ref FMatrix This, out FPlane OutPlane);
Beispiel #24
0
 /// <summary>
 /// Creates and initializes a new quaternion from the given matrix.
 /// </summary>
 /// <param name="m">The rotation matrix to initialize from.</param>
 public FQuat(FMatrix m) :
     base(E_CreateStruct_FQuat_FMatrix(m), false)
 {
 }
Beispiel #25
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix Multiply(ref FMatrix This, ref FMatrix Other);
Beispiel #26
0
 static extern FMatrix InverseFast(ref FMatrix This);