예제 #1
0
 public static void OldOrientation_To_TileOrientation(byte oldRotation, bool oldFlipX, bool oldFlipZ, ref TileOrientation result)
 {
     if (oldRotation == 0)
     {
         result.SwitchedAxes = false;
         result.ResultXFlip  = false;
         result.ResultYFlip  = false;
     }
     else if (oldRotation == 1)
     {
         result.SwitchedAxes = true;
         result.ResultXFlip  = true;
         result.ResultYFlip  = false;
     }
     else if (oldRotation == 2)
     {
         result.SwitchedAxes = false;
         result.ResultXFlip  = true;
         result.ResultYFlip  = true;
     }
     else if (oldRotation == 3)
     {
         result.SwitchedAxes = true;
         result.ResultXFlip  = false;
         result.ResultYFlip  = true;
     }
     if (oldFlipX)
     {
         if (result.SwitchedAxes)
         {
             result.ResultYFlip = !result.ResultYFlip;
         }
         else
         {
             result.ResultXFlip = !result.ResultXFlip;
         }
     }
     if (oldFlipZ)
     {
         if (result.SwitchedAxes)
         {
             result.ResultXFlip = !result.ResultXFlip;
         }
         else
         {
             result.ResultYFlip = !result.ResultYFlip;
         }
     }
 }
예제 #2
0
        public static void GetTileRotatedTexCoords(TileOrientation tileOrientation, ref XYDouble coordA, ref XYDouble coordB,
                                                   ref XYDouble coordC, ref XYDouble coordD)
        {
            var reverseOrientation = new TileOrientation();

            reverseOrientation = tileOrientation;
            reverseOrientation.Reverse();

            if (reverseOrientation.SwitchedAxes)
            {
                if (reverseOrientation.ResultXFlip)
                {
                    coordA.X = 1f;
                    coordB.X = 1f;
                    coordC.X = 0f;
                    coordD.X = 0f;
                }
                else
                {
                    coordA.X = 0f;
                    coordB.X = 0f;
                    coordC.X = 1f;
                    coordD.X = 1f;
                }
                if (reverseOrientation.ResultYFlip)
                {
                    coordA.Y = 1f;
                    coordB.Y = 0f;
                    coordC.Y = 1f;
                    coordD.Y = 0f;
                }
                else
                {
                    coordA.Y = 0f;
                    coordB.Y = 1f;
                    coordC.Y = 0f;
                    coordD.Y = 1f;
                }
            }
            else
            {
                if (reverseOrientation.ResultXFlip)
                {
                    coordA.X = 1f;
                    coordB.X = 0f;
                    coordC.X = 1f;
                    coordD.X = 0f;
                }
                else
                {
                    coordA.X = 0f;
                    coordB.X = 1F;
                    coordC.X = 0f;
                    coordD.X = 1f;
                }
                if (reverseOrientation.ResultYFlip)
                {
                    coordA.Y = 1f;
                    coordB.Y = 1f;
                    coordC.Y = 0f;
                    coordD.Y = 0f;
                }
                else
                {
                    coordA.Y = 0f;
                    coordB.Y = 0f;
                    coordC.Y = 1f;
                    coordD.Y = 1f;
                }
            }
        }