Exemple #1
0
 public static void UpsizeAnyPartials(CubemapImages cubemap)
 {
     if (CheckPartial(cubemap.Back))
     {
         cubemap.Back = Upsize(cubemap.Back);
     }
     if (CheckPartial(cubemap.Bottom))
     {
         cubemap.Bottom = Upsize(cubemap.Bottom);
     }
     if (CheckPartial(cubemap.Front))
     {
         cubemap.Front = Upsize(cubemap.Front);
     }
     if (CheckPartial(cubemap.Left))
     {
         cubemap.Left = Upsize(cubemap.Left);
     }
     if (CheckPartial(cubemap.Right))
     {
         cubemap.Right = Upsize(cubemap.Right);
     }
     if (CheckPartial(cubemap.Top))
     {
         cubemap.Top = Upsize(cubemap.Top);
     }
 }
Exemple #2
0
        public static void FillAnyNullWithBlanks(CubemapImages cubemap)
        {
            Bitmap   empty = new Bitmap(768, 768); // HACK
            Graphics g     = Graphics.FromImage(empty);

            g.Clear(Color.Black);
            if (cubemap.Back == null)
            {
                cubemap.Back = empty;
            }
            if (cubemap.Bottom == null)
            {
                cubemap.Bottom = empty;
            }
            if (cubemap.Front == null)
            {
                cubemap.Front = empty;
            }
            if (cubemap.Left == null)
            {
                cubemap.Left = empty;
            }
            if (cubemap.Right == null)
            {
                cubemap.Right = empty;
            }
            if (cubemap.Top == null)
            {
                cubemap.Top = empty;
            }
        }
Exemple #3
0
 private Bitmap GetOneValidImage(CubemapImages images)
 {
     if (images.Back != null)
     {
         return(images.Back);
     }
     else if (images.Bottom != null)
     {
         return(images.Bottom);
     }
     else if (images.Front != null)
     {
         return(images.Front);
     }
     else if (images.Left != null)
     {
         return(images.Left);
     }
     else if (images.Right != null)
     {
         return(images.Right);
     }
     else if (images.Top != null)
     {
         return(images.Top);
     }
     return(null);
 }
Exemple #4
0
        private Bitmap StichCubeMap(CubemapImages images)
        {
            // grab the image size from first image found in the image set
            var first = GetOneValidImage(images);

            if (first == null)
            {
                return(null);
            }

            var size = first.Size;

            if (size.Height != size.Width)
            {
                throw new Exception("Images must have an aspect ratio of 1:1 to build a cubemap");
            }

            // this is the order the cubemaps's are built in left to right
            List <Bitmap> imagesList = new List <Bitmap>();

            imagesList.Add(CheckNull(images.Left, size.Height));
            imagesList.Add(CheckNull(images.Front, size.Height));
            imagesList.Add(CheckNull(images.Right, size.Height));
            imagesList.Add(CheckNull(images.Back, size.Height));

            // need to flip the bottom/top images so cubemap is in correct format
            Bitmap bottom = CheckNull(images.Bottom, size.Height);

            bottom.RotateFlip(RotateFlipType.Rotate90FlipNone);
            imagesList.Add(bottom);
            Bitmap top = CheckNull(images.Top, size.Height);

            top.RotateFlip(RotateFlipType.Rotate270FlipNone);
            imagesList.Add(top);

            return(MergeImages(imagesList));
        }
Exemple #5
0
 public Bitmap ConstructCubemap(CubemapImages images)
 {
     return(StichCubeMap(images));
 }