@@ -164,15 +164,15 @@ Phaser.LoaderParser = {
164164 return bitmapFontData ;
165165
166166 } ,
167-
167+
168168 /**
169169 * Extract PVR header from loaded binary
170170 *
171171 * @method Phaser.LoaderParser.parsePVR
172172 * @param {ArrayBuffer } arrayBuffer - The BaseTexture this font uses.
173173 * @return {object } The parsed PVR file including texture data.
174174 */
175- parsePVR : function ( arrayBuffer ) {
175+ pvr : function ( arrayBuffer ) {
176176 // Reference: http://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf
177177 // PVR 3 header structure
178178 // ---------------------------------------
@@ -201,6 +201,7 @@ Phaser.LoaderParser = {
201201 ] . indexOf ( pixelFormat ) >= 0
202202 ) {
203203 pvrHeader = {
204+ fileFormat : 'PVR' ,
204205 flags : uintArray [ 1 ] ,
205206 pixelFormat : pixelFormat ,
206207 colorSpace : uintArray [ 4 ] ,
@@ -225,7 +226,7 @@ Phaser.LoaderParser = {
225226 * @param {ArrayBuffer } arrayBuffer - The BaseTexture this font uses.
226227 * @return {object } The parsed DDS file including texture data.
227228 */
228- parseDDS : function ( arrayBuffer ) {
229+ dds : function ( arrayBuffer ) {
229230 // Reference at: https://msdn.microsoft.com/en-us/library/windows/desktop/bb943982(v=vs.85).aspx
230231 // DDS header structure
231232 // ---------------------------------------
@@ -267,6 +268,7 @@ Phaser.LoaderParser = {
267268 byteArray [ 2 ] === 0x53 &&
268269 byteArray [ 3 ] === 0x20 ) {
269270 ddsHeader = {
271+ fileFormat : 'DDS' ,
270272 size : uintArray [ 1 ] ,
271273 flags : uintArray [ 2 ] ,
272274 height : uintArray [ 3 ] ,
@@ -316,7 +318,7 @@ Phaser.LoaderParser = {
316318 * @param {ArrayBuffer } arrayBuffer - The BaseTexture this font uses.
317319 * @return {object } The parsed KTX file including texture data.
318320 */
319- parseKTX : function ( arrayBuffer ) {
321+ ktx : function ( arrayBuffer ) {
320322 // Reference: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
321323 // KTX header structure
322324 // ---------------------------------------
@@ -344,16 +346,23 @@ Phaser.LoaderParser = {
344346 ktxHeader = null ,
345347 imageSizeOffset = 16 + ( uintArray [ 15 ] / 4 ) | 0 ,
346348 imageSize = uintArray [ imageSizeOffset ] ;
347-
348349 if ( byteArray [ 0 ] === 0xAB && byteArray [ 1 ] === 0x4B &&
349350 byteArray [ 2 ] === 0x54 && byteArray [ 3 ] === 0x58 &&
350351 byteArray [ 4 ] === 0x20 && byteArray [ 5 ] === 0x31 &&
351352 byteArray [ 6 ] === 0x31 && byteArray [ 7 ] === 0xBB &&
352353 byteArray [ 8 ] === 0x0D && byteArray [ 9 ] === 0x0A &&
353354 byteArray [ 10 ] === 0x1A && byteArray [ 11 ] === 0x0A &&
354- //Check if internal GL format is ETC1_RGB8_OES
355- uintArray [ 7 ] === 0x8D64 ) {
355+ //Check if internal GL format is supported by WebGL
356+ [
357+ // ETC1
358+ 0x8D64 ,
359+ // PVRTC
360+ 0x8C00 , 0x8C01 , 0x8C02 , 0x8C03 ,
361+ // DXTC | S3TC
362+ 0x83F0 , 0x83F1 , 0x83F2 , 0x83F3
363+ ] . indexOf ( uintArray [ 7 ] ) >= 0 ) {
356364 ktxHeader = {
365+ fileFormat : 'KTX' ,
357366 endianness : uintArray [ 3 ] ,
358367 glType : uintArray [ 4 ] ,
359368 glTypeSize : uintArray [ 5 ] ,
@@ -382,7 +391,7 @@ Phaser.LoaderParser = {
382391 * @param {ArrayBuffer } arrayBuffer - The BaseTexture this font uses.
383392 * @return {object } The parsed PKM file including texture data.
384393 */
385- parsePKM : function ( arrayBuffer ) {
394+ pkm : function ( arrayBuffer ) {
386395 // PKM header structure
387396 // ---------------------------------------
388397 // address: 0, size 4 bytes: for 'PKM '
@@ -402,6 +411,7 @@ Phaser.LoaderParser = {
402411 byteArray [ 2 ] === 0x4D &&
403412 byteArray [ 3 ] === 0x20 ) {
404413 pkmHeader = {
414+ fileFormat : 'PKM' ,
405415 format : ( ( byteArray [ 6 ] << 8 | byteArray [ 7 ] ) ) & 0xFFFF ,
406416 extendedWidth : ( ( byteArray [ 8 ] << 8 | byteArray [ 9 ] ) ) & 0xFFFF ,
407417 extendedHeight : ( ( byteArray [ 10 ] << 8 | byteArray [ 11 ] ) ) & 0xFFFF ,
0 commit comments