Exemplo n.º 1
0
        public void AddTranslate(Vector3 Vect)
        {
            Matrix4X4 Temp = new Matrix4X4();

            Temp.Translate(Vect.x, Vect.y, Vect.z);

            Multiply(Temp);
        }
Exemplo n.º 2
0
        public void PrepareInvMatrix(double Tx, double Ty, double Tz,
                                     double Rx, double Ry, double Rz,
                                     double Sx, double Sy, double Sz)
        {
            Matrix4X4 M0 = new Matrix4X4();
            Matrix4X4 M1 = new Matrix4X4();
            Matrix4X4 M2 = new Matrix4X4();
            Matrix4X4 M3 = new Matrix4X4();
            Matrix4X4 M4 = new Matrix4X4();
            Matrix4X4 M5 = new Matrix4X4();
            Matrix4X4 M6 = new Matrix4X4();
            Matrix4X4 M7 = new Matrix4X4();

            M0.Scale(Sx, Sy, Sz);
            M1.Rotate(0, Rx);
            M2.Rotate(1, Ry);
            M3.Rotate(2, Rz);
            M4.Translate(Tx, Ty, Tz);
            // 4 * 3 * 2 * 1 * 0
            M5.Multiply(M4, M3);
            M6.Multiply(M5, M2);
            M7.Multiply(M6, M1);
            Multiply(M7, M0);
        }
Exemplo n.º 3
0
        public void PrepareMatrix(double Tx, double Ty, double Tz,
                                  double Rx, double Ry, double Rz,
                                  double Sx, double Sy, double Sz)
        {
            bool Initialized = false;

            if (Sx != 1.0f || Sy != 1.0f || Sz != 1.0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Scale(Sx, Sy, Sz);
                    Multiply(Temp);
                }
                else
                {
                    Scale(Sx, Sy, Sz);
                    Initialized = true;
                }
            }
            if (Rx != .0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Rotate(0, Rx);
                    Multiply(Temp);
                }
                else
                {
                    Rotate(0, Rx);
                    Initialized = true;
                }
            }
            if (Ry != .0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Rotate(1, Ry);
                    Multiply(Temp);
                }
                else
                {
                    Rotate(1, Ry);
                    Initialized = true;
                }
            }
            if (Rz != .0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Rotate(2, Rz);
                    Multiply(Temp);
                }
                else
                {
                    Rotate(2, Rz);
                    Initialized = true;
                }
            }
            if (Tx != 0.0f || Ty != 0.0f || Tz != 0.0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Translate(Tx, Ty, Tz);
                    Multiply(Temp);
                }
                else
                {
                    Translate(Tx, Ty, Tz);
                    Initialized = true;
                }

                if (!Initialized)
                {
                    Identity();
                }
            }
        }
Exemplo n.º 4
0
        public void PrepareInvMatrix(double Tx, double Ty, double Tz,
                                          double Rx, double Ry, double Rz,
                                          double Sx, double Sy, double Sz)
        {
	        Matrix4X4 M0 = new Matrix4X4();
            Matrix4X4 M1 = new Matrix4X4();
            Matrix4X4 M2 = new Matrix4X4();
            Matrix4X4 M3 = new Matrix4X4();
            Matrix4X4 M4 = new Matrix4X4();
            Matrix4X4 M5 = new Matrix4X4();
            Matrix4X4 M6 = new Matrix4X4();
            Matrix4X4 M7 = new Matrix4X4();

	        M0.Scale(Sx, Sy, Sz);
	        M1.Rotate(0, Rx);
	        M2.Rotate(1, Ry);
	        M3.Rotate(2, Rz);
	        M4.Translate(Tx, Ty, Tz);
	        // 4 * 3 * 2 * 1 * 0
	        M5.Multiply(M4, M3);
	        M6.Multiply(M5, M2);
	        M7.Multiply(M6, M1);
	        Multiply(M7, M0);
        }
Exemplo n.º 5
0
        public void PrepareMatrix(double Tx, double Ty, double Tz,
                                       double Rx, double Ry, double Rz,
                                       double Sx, double Sy, double Sz)
        {
            bool Initialized = false;

            if (Sx != 1.0f || Sy != 1.0f || Sz != 1.0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Scale(Sx, Sy, Sz);
                    Multiply(Temp);
                }
                else
                {
                    Scale(Sx, Sy, Sz);
                    Initialized = true;
                }
            }
            if (Rx != .0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Rotate(0, Rx);
                    Multiply(Temp);
                }
                else
                {
                    Rotate(0, Rx);
                    Initialized = true;
                }
            }
            if (Ry != .0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Rotate(1, Ry);
                    Multiply(Temp);
                }
                else
                {
                    Rotate(1, Ry);
                    Initialized = true;
                }
            }
            if (Rz != .0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Rotate(2, Rz);
                    Multiply(Temp);
                }
                else
                {
                    Rotate(2, Rz);
                    Initialized = true;
                }
            }
            if (Tx != 0.0f || Ty != 0.0f || Tz != 0.0f)
            {
                if (Initialized)
                {
                    Matrix4X4 Temp = new Matrix4X4();
                    Temp.Translate(Tx, Ty, Tz);
                    Multiply(Temp);
                }
                else
                {
                    Translate(Tx, Ty, Tz);
                    Initialized = true;
                }

                if (!Initialized)
                {
                    Identity();
                }
            }
        }
Exemplo n.º 6
0
        public void AddTranslate(Vector3 Vect)
        {
            Matrix4X4 Temp = new Matrix4X4();
            Temp.Translate(Vect.x, Vect.y, Vect.z);

            Multiply(Temp);
        }