public GvrTexture() { // Set default values HasGlobalIndex = true; GlobalIndex = 0; gbixType = GvrGbixType.Gbix; PaletteFormat = GvrPixelFormat.Unknown; DataFormat = GvrDataFormat.Rgb5a3; HasMipmaps = false; }
private bool Initalize(GvrPixelFormat pixelFormat, GvrDataFormat dataFormat) { // Set the default values dataFlags = GvrDataFlags.None; hasGlobalIndex = true; gbixType = GvrGbixType.Gbix; globalIndex = 0; // Set the data format and pixel format and load the appropiate codecs this.dataFormat = dataFormat; dataCodec = GvrDataCodec.GetDataCodec(dataFormat); // Make sure the data codec exists and we can encode to it if (dataCodec == null || !dataCodec.CanEncode) { return(false); } // Only palettized formats require a pixel codec. if (dataCodec.PaletteEntries != 0) { this.pixelFormat = pixelFormat; pixelCodec = GvrPixelCodec.GetPixelCodec(pixelFormat); // Make sure the pixel codec exists and we can encode to it if (pixelCodec == null || !pixelCodec.CanEncode) { return(false); } dataCodec.PixelCodec = pixelCodec; dataFlags |= GvrDataFlags.InternalPalette; // Convert the bitmap to an array containing indicies. decodedData = BitmapToRawIndexed(decodedBitmap, dataCodec.PaletteEntries, out texturePalette); //decodedData = BitmapToRawIndexed(decodedBitmap, 8, out texturePalette); } else { this.pixelFormat = GvrPixelFormat.Unknown; pixelCodec = null; // Convert the bitmap to an array decodedData = BitmapToRaw(decodedBitmap); } return(true); }
private bool Initalize(GvrPixelFormat pixelFormat, GvrDataFormat dataFormat) { // Set the default values dataFlags = GvrDataFlags.None; hasGlobalIndex = true; gbixType = GvrGbixType.Gbix; globalIndex = 0; // Set the data format and pixel format and load the appropiate codecs this.dataFormat = dataFormat; dataCodec = GvrDataCodec.GetDataCodec(dataFormat); // Make sure the data codec exists and we can encode to it if (dataCodec == null || !dataCodec.CanEncode) return false; // Only palettized formats require a pixel codec. if (dataCodec.PaletteEntries != 0) { this.pixelFormat = pixelFormat; pixelCodec = GvrPixelCodec.GetPixelCodec(pixelFormat); // Make sure the pixel codec exists and we can encode to it if (pixelCodec == null || !pixelCodec.CanEncode) return false; dataCodec.PixelCodec = pixelCodec; dataFlags |= GvrDataFlags.InternalPalette; // Convert the bitmap to an array containing indicies. decodedData = BitmapToRawIndexed(decodedBitmap, dataCodec.PaletteEntries, out texturePalette); } else { this.pixelFormat = GvrPixelFormat.Unknown; pixelCodec = null; // Convert the bitmap to an array decodedData = BitmapToRaw(decodedBitmap); } return true; }