Esempio n. 1
0
        public void ViewAngleSet_Rotate(Matrix3DMath.Matrix3D NewMatrix)
        {
            var Flag = default(bool);
            var XYZ_dbl = default(XYZDouble);
            var XYZ_dbl2 = default(XYZDouble);
            //Dim XYZ_lng As sXYZ_lng
            var XY_dbl = default(XYDouble);

            if ( App.ViewMoveType == enumView_Move_Type.RTS & App.RTSOrbit )
            {
                Flag = true;
                //If ScreenXY_Get_TerrainPos(CInt(Int(GLSize.X / 2.0#)), CInt(Int(GLSize.Y / 2.0#)), XYZ_lng) Then
                //    XYZ_dbl.X = XYZ_lng.X
                //    XYZ_dbl.Y = XYZ_lng.Y
                //    XYZ_dbl.Z = XYZ_lng.Z
                //Else
                if ( ScreenXY_Get_ViewPlanePos_ForwardDownOnly((int)((MapViewControl.GLSize.X / 2.0D)), (int)((MapViewControl.GLSize.Y / 2.0D)), 127.5D,
                    ref XY_dbl) )
                {
                    XYZ_dbl.X = XY_dbl.X;
                    XYZ_dbl.Y = 127.5D;
                    XYZ_dbl.Z = Convert.ToDouble(- XY_dbl.Y);
                }
                else
                {
                    Flag = false;
                }
                //End If
            }
            else
            {
                Flag = false;
            }

            Matrix3DMath.MatrixToRPY(NewMatrix, ref ViewAngleRPY);
            if ( Flag )
            {
                if ( ViewAngleRPY.Pitch < MathUtil.RadOf1Deg * 10.0D )
                {
                    ViewAngleRPY.Pitch = MathUtil.RadOf1Deg * 10.0D;
                }
            }
            Matrix3DMath.MatrixSetToRPY(ViewAngleMatrix, ViewAngleRPY);
            Matrix3DMath.MatrixInvert(ViewAngleMatrix, ViewAngleMatrix_Inverted);

            if ( Flag )
            {
                XYZ_dbl2.X = ViewPos.X;
                XYZ_dbl2.Y = ViewPos.Y;
                XYZ_dbl2.Z = Convert.ToDouble(- ViewPos.Z);
                MoveToViewTerrainPosFromDistance(XYZ_dbl, Convert.ToDouble((XYZ_dbl2 - XYZ_dbl).GetMagnitude()));
            }

            MapViewControl.DrawViewLater();
        }
Esempio n. 2
0
        public void ViewAngleSet(Matrix3DMath.Matrix3D newMatrix)
        {
            Matrix3DMath.MatrixCopy(newMatrix, ViewAngleMatrix);
            Matrix3DMath.MatrixNormalize(ViewAngleMatrix);
            Matrix3DMath.MatrixInvert(ViewAngleMatrix, ViewAngleMatrix_Inverted);
            Matrix3DMath.MatrixToRPY(ViewAngleMatrix, ref ViewAngleRPY);

            MapViewControl.DrawViewLater();
        }