Esempio n. 1
0
        public idMat4 InverseFast()
        {
            idMat4 invMat = this;
            bool   r      = invMat.InverseFastSelf();

            Debug.Assert(r);
            return(invMat);
        }
Esempio n. 2
0
 public idMat4 opAdd(ref idMat4 a)
 {
     idVec4[] a_mat = a.mat;
     mat[0].x += a_mat[0].x; mat[0].y += a_mat[0].y; mat[0].z += a_mat[0].z; mat[0].w += a_mat[0].w;
     mat[1].x += a_mat[1].x; mat[1].y += a_mat[1].y; mat[1].z += a_mat[1].z; mat[1].w += a_mat[1].w;
     mat[2].x += a_mat[2].x; mat[2].y += a_mat[2].y; mat[2].z += a_mat[2].z; mat[2].w += a_mat[2].w;
     mat[3].x += a_mat[3].x; mat[3].y += a_mat[3].y; mat[3].z += a_mat[3].z; mat[3].w += a_mat[3].w;
     return(this);
 }
Esempio n. 3
0
 public idMat4 opSub(ref idMat4 a)
 {
     idVec4[] a_mat = a.mat;
     mat[0].x -= a_mat[0].x; mat[0].y -= a_mat[0].y; mat[0].z -= a_mat[0].z; mat[0].w -= a_mat[0].w;
     mat[1].x -= a_mat[1].x; mat[1].y -= a_mat[1].y; mat[1].z -= a_mat[1].z; mat[1].w -= a_mat[1].w;
     mat[2].x -= a_mat[2].x; mat[2].y -= a_mat[2].y; mat[2].z -= a_mat[2].z; mat[2].w -= a_mat[2].w;
     mat[3].x -= a_mat[3].x; mat[3].y -= a_mat[3].y; mat[3].z -= a_mat[3].z; mat[3].w -= a_mat[3].w;
     return(this);
 }
Esempio n. 4
0
        public idMat4 Transpose()
        {
            idMat4 transpose = new idMat4();

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    transpose[i][j] = mat[j][i];
                }
            }
            return(transpose);
        }
Esempio n. 5
0
 public bool Compare(ref idMat4 a, float epsilon)
 {
     float[] ptr1 = mat;
     float[] ptr2 = a.mat;
     for (int i = 0; i < 4 * 4; i++)
     {
         if (idMath.Fabs(ptr1[i] - ptr2[i]) > epsilon)
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 6
0
 public bool Compare(ref idMat4 a)
 {
     float[] ptr1 = mat;
     float[] ptr2 = a.mat;
     for (int i = 0; i < 4 * 4; i++)
     {
         if (ptr1[i] != ptr2[i])
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 7
0
        public static idMat4 operator *(idMat4 a, idMat4 b)
        {
            //    m1Ptr = reinterpret_cast<const float *>(this);
            //    m2Ptr = reinterpret_cast<const float *>(&a);
            //    dstPtr = reinterpret_cast<float *>(&dst);
            idMat4 dst = new idMat4();

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    //            *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 4 + j ]
                    //                    + m1Ptr[1] * m2Ptr[ 1 * 4 + j ]
                    //                    + m1Ptr[2] * m2Ptr[ 2 * 4 + j ]
                    //                    + m1Ptr[3] * m2Ptr[ 3 * 4 + j ];
                    //            dstPtr++;
                }
                //        m1Ptr += 4;
            }
            return(dst);
        }
Esempio n. 8
0
 public idMat4 opMul(ref idMat4 a)
 {
     this = this * a;
     return(this);
 }
Esempio n. 9
0
 public bool Compare(ref idMat4 a, float epsilon)
 {
     float[] ptr1 = mat;
     float[] ptr2 = a.mat;
     for (int i = 0; i < 4 * 4; i++)
         if (idMath.Fabs(ptr1[i] - ptr2[i]) > epsilon)
             return false;
     return true;
 }
Esempio n. 10
0
 public idMat4 Transpose()
 {
     idMat4 transpose = new idMat4();
     for (int i = 0; i < 4; i++)
         for (int j = 0; j < 4; j++)
             transpose[i][j] = mat[j][i];
     return transpose;
 }
Esempio n. 11
0
 public bool Compare(ref idMat4 a)
 {
     float[] ptr1 = mat;
     float[] ptr2 = a.mat;
     for (int i = 0; i < 4 * 4; i++)
         if (ptr1[i] != ptr2[i])
             return false;
     return true;
 }
Esempio n. 12
0
 public idMat4 opSub(ref idMat4 a)
 {
     idVec4[] a_mat = a.mat;
     mat[0].x -= a_mat[0].x; mat[0].y -= a_mat[0].y; mat[0].z -= a_mat[0].z; mat[0].w -= a_mat[0].w;
     mat[1].x -= a_mat[1].x; mat[1].y -= a_mat[1].y; mat[1].z -= a_mat[1].z; mat[1].w -= a_mat[1].w;
     mat[2].x -= a_mat[2].x; mat[2].y -= a_mat[2].y; mat[2].z -= a_mat[2].z; mat[2].w -= a_mat[2].w;
     mat[3].x -= a_mat[3].x; mat[3].y -= a_mat[3].y; mat[3].z -= a_mat[3].z; mat[3].w -= a_mat[3].w;
     return this;
 }
Esempio n. 13
0
 public idMat4 opAdd(ref idMat4 a)
 {
     idVec4[] a_mat = a.mat;
     mat[0].x += a_mat[0].x; mat[0].y += a_mat[0].y; mat[0].z += a_mat[0].z; mat[0].w += a_mat[0].w;
     mat[1].x += a_mat[1].x; mat[1].y += a_mat[1].y; mat[1].z += a_mat[1].z; mat[1].w += a_mat[1].w;
     mat[2].x += a_mat[2].x; mat[2].y += a_mat[2].y; mat[2].z += a_mat[2].z; mat[2].w += a_mat[2].w;
     mat[3].x += a_mat[3].x; mat[3].y += a_mat[3].y; mat[3].z += a_mat[3].z; mat[3].w += a_mat[3].w;
     return this;
 }
Esempio n. 14
0
 public idMat4 opMul(ref idMat4 a)
 {
     this = this * a;
     return this;
 }
Esempio n. 15
0
 public static idMat4 operator *(idMat4 a, idMat4 b)
 {
     //    m1Ptr = reinterpret_cast<const float *>(this);
     //    m2Ptr = reinterpret_cast<const float *>(&a);
     //    dstPtr = reinterpret_cast<float *>(&dst);
     idMat4 dst = new idMat4();
     for (int i = 0; i < 4; i++)
     {
         for (int j = 0; j < 4; j++)
         {
             //            *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 4 + j ]
             //                    + m1Ptr[1] * m2Ptr[ 1 * 4 + j ]
             //                    + m1Ptr[2] * m2Ptr[ 2 * 4 + j ]
             //                    + m1Ptr[3] * m2Ptr[ 3 * 4 + j ];
             //            dstPtr++;
         }
         //        m1Ptr += 4;
     }
     return dst;
 }