public CubeMapTextureData() { for (int i = 0; i < 6; i++) this[i] = new CubeMapTextureFace(); }
public CubeMapTextureFace this[int index] { get { switch (index) { case 0: return PositiveX; case 1: return NegativeX; case 2: return PositiveY; case 3: return NegativeY; case 4: return PositiveZ; case 5: return NegativeZ; default: return null; } } set { switch (index) { case 0: PositiveX = value; break; case 1: NegativeX = value; break; case 2: PositiveY = value; break; case 3: NegativeY = value; break; case 4: PositiveZ = value; break; case 5: NegativeZ = value; break; } } }
private CubeMapTextureFace ReadFace(BinaryReader br, uint mipMaps, bool isCompressed, SquishFlags flag) { CubeMapTextureFace f = new CubeMapTextureFace((int)mipMaps); uint ui_width = _header.Width; uint ui_height = _header.Height; for (int i = 0; i < mipMaps; i++) { int dataSize = (int)(ui_width * ui_height * (_header.PixelFormat.RGBBitCount / 8)); if (isCompressed) dataSize = SharpSquish.GetStorageRequirements((int)ui_width, (int)ui_height, flag); byte[] m_slice = br.ReadBytes(dataSize); f.Mipmaps[i] = new MipmapData() { Width = ui_width, Height = ui_height, Data = m_slice }; ui_width = Math.Max(ui_width / 2, 1); ui_height = Math.Max(ui_height / 2, 1); } return f; }