예제 #1
0
 public CubeMapTextureFace this[DDSImageCubeMapFace face]
 {
     get
     {
         switch (face)
         {
             case DDSImageCubeMapFace.NegativeX:
                 return NegativeX;
             case DDSImageCubeMapFace.NegativeY:
                 return NegativeY;
             case DDSImageCubeMapFace.NegativeZ:
                 return NegativeZ;
             case DDSImageCubeMapFace.PositiveX:
                 return PositiveX;
             case DDSImageCubeMapFace.PositiveY:
                 return PositiveY;
             case DDSImageCubeMapFace.PositiveZ:
                 return PositiveZ;
         }
         return null;
     }
 }
예제 #2
0
 /// <summary>
 /// Get a Builded CubeMap Texture Face.
 /// </summary>
 /// <param name="face">CubeMap Face To Get.</param>
 /// <param name="mipmap">The MipMap to Get. Note: 0 Is The Main Image.</param>
 /// <param name="rebuild">Indicate if the Image is Recreated if it exists.</param>
 /// <returns></returns>
 public Bitmap BuildCubeMapFace(DDSImageCubeMapFace face, uint mipmap, bool rebuild = false)
 {
     if (_cubeMapTexture == null)
         return null;
     CubeMapTextureFace cface = null;
     switch (face)
     {
         case DDSImageCubeMapFace.NegativeX:
             cface = _cubeMapTexture.NegativeX;
             break;
         case DDSImageCubeMapFace.NegativeY:
             cface = _cubeMapTexture.NegativeY;
             break;
         case DDSImageCubeMapFace.NegativeZ:
             cface = _cubeMapTexture.NegativeZ;
             break;
         case DDSImageCubeMapFace.PositiveX:
             cface = _cubeMapTexture.PositiveX;
             break;
         case DDSImageCubeMapFace.PositiveY:
             cface = _cubeMapTexture.PositiveY;
             break;
         case DDSImageCubeMapFace.PositiveZ:
             cface = _cubeMapTexture.PositiveZ;
             break;
     }
     if (cface == null)
         return null;
     if (mipmap < 0 || mipmap >= cface.Mipmaps.Length)
         mipmap = 0;
     try
     {
         if (cface.Mipmaps[mipmap].Image != null && !rebuild)
             return cface.Mipmaps[mipmap].Image;
         else if (cface.Mipmaps[mipmap].Image != null)
         {
             cface.Mipmaps[mipmap].Image.Dispose();
         }
         int width = (int)cface.Mipmaps[mipmap].Width;
         int height = (int)cface.Mipmaps[mipmap].Height;
         byte[] lpData = cface.Mipmaps[mipmap].Data;
         Bitmap tmp = BuidImageFromData(width, height, lpData);
         cface.Mipmaps[mipmap].Image = tmp;
         return tmp;
     }
     catch { }
     return null;
 }