Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 5
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix TransposeAdjoint(ref FMatrix This);
Ejemplo n.º 6
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix Inverse(ref FMatrix This);
Ejemplo n.º 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));
        }
Ejemplo n.º 8
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FVector4 TransformFVector4(ref FMatrix This, ref FVector4 V);
Ejemplo n.º 9
0
 public void SetFromMatrix(FMatrix inMatrix)
 => E_FTransform_SetFromMatrix(this, inMatrix);
Ejemplo n.º 10
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FRotator Rotator(ref FMatrix This);
Ejemplo n.º 11
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix ConcatTranslation(ref FMatrix This, ref FVector Translation);
Ejemplo n.º 12
0
 public FQuat(FMatrix M)
 {
     this = MakeFromMatrix(M);
 }
Ejemplo n.º 13
0
 public static FQuat MakeFromMatrix(FMatrix Matrix)
 {
     return(MakeFromMatrix(ref Matrix));
 }
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 19
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FVector ExtractScaling(ref FMatrix This, float Tolerance);
Ejemplo n.º 20
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static void Mirror(ref FMatrix This, int MirrorAxis, int FlipAxis);
Ejemplo n.º 21
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix ApplyScale(ref FMatrix This, float Scale);
Ejemplo n.º 22
0
 static extern bool GetFrustumTopPlane(ref FMatrix This, out FPlane OutPlane);
Ejemplo n.º 23
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static bool GetFrustumBottomPlane(ref FMatrix This, out FPlane OutPlane);
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 25
0
 //[MethodImplAttribute(MethodImplOptions.InternalCall)]
 extern static FMatrix Multiply(ref FMatrix This, ref FMatrix Other);
Ejemplo n.º 26
0
 static extern FMatrix InverseFast(ref FMatrix This);