mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-09 22:05:24 +00:00
[engine] [cocos2d-x] [jsb-adapter] 适配引擎 v2.4.12 版本
This commit is contained in:
@@ -72,6 +72,36 @@ const GL_COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; // ext.COMPRESSED_RGB_ETC1_WEBGL
|
||||
const GL_COMPRESSED_RGB8_ETC2 = 0x9274; // ext.COMPRESSED_RGB8_ETC2
|
||||
const GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278; // ext.COMPRESSED_RGBA8_ETC2_EAC
|
||||
|
||||
const GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
|
||||
const GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
|
||||
const GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
|
||||
const GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
|
||||
const GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
|
||||
const GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
|
||||
const GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
|
||||
const GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
|
||||
const GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
|
||||
const GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
|
||||
const GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
|
||||
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
|
||||
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
|
||||
|
||||
const _filterGL = [
|
||||
[ GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR ],
|
||||
[ GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_LINEAR ],
|
||||
@@ -167,6 +197,90 @@ const _textureFmtGL = [
|
||||
|
||||
// TEXTURE_FMT_RGBA_ETC2: 29
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA8_ETC2_EAC, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_4X4: 30
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_4x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_5X4: 31
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_5x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_5X5: 32
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_5x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_6X5: 33
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_6x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_6X6: 34
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_6x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_8X5: 35
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_8X6: 36
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_8X8: 37
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X5: 38
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X6: 39
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X8: 40
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_10X10: 41
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_12X10: 42
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_12x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_RGBA_ASTC_12X12: 43
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_12x12_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_4X4: 44
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_5X4: 45
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_5X5: 46
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_6X5: 47
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_6X6: 48
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_8X5: 49
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_8X6: 50
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_8X8: 51
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X5: 52
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X6: 53
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X8: 54
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_10X10: 55
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_12X10: 56
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, pixelType: null },
|
||||
|
||||
// TEXTURE_FMT_SRGBA_ASTC_12X12: 57
|
||||
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, pixelType: null },
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -270,6 +384,38 @@ export const enums = {
|
||||
TEXTURE_FMT_RGB_ETC2: 28,
|
||||
TEXTURE_FMT_RGBA_ETC2: 29,
|
||||
|
||||
// astc format (Adaptive Scalable Texture Compression)
|
||||
TEXTURE_FMT_RGBA_ASTC_4X4: 30,
|
||||
TEXTURE_FMT_RGBA_ASTC_5X4: 31,
|
||||
TEXTURE_FMT_RGBA_ASTC_5X5: 32,
|
||||
TEXTURE_FMT_RGBA_ASTC_6X5: 33,
|
||||
TEXTURE_FMT_RGBA_ASTC_6X6: 34,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X5: 35,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X6: 36,
|
||||
TEXTURE_FMT_RGBA_ASTC_8X8: 37,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X5: 38,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X6: 39,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X8: 40,
|
||||
TEXTURE_FMT_RGBA_ASTC_10X10: 41,
|
||||
TEXTURE_FMT_RGBA_ASTC_12X10: 42,
|
||||
TEXTURE_FMT_RGBA_ASTC_12X12: 43,
|
||||
|
||||
// astc format (Adaptive Scalable Texture Compression) SRGB
|
||||
TEXTURE_FMT_SRGBA_ASTC_4X4: 44,
|
||||
TEXTURE_FMT_SRGBA_ASTC_5X4: 45,
|
||||
TEXTURE_FMT_SRGBA_ASTC_5X5: 46,
|
||||
TEXTURE_FMT_SRGBA_ASTC_6X5: 47,
|
||||
TEXTURE_FMT_SRGBA_ASTC_6X6: 48,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X5: 49,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X6: 50,
|
||||
TEXTURE_FMT_SRGBA_ASTC_8X8: 51,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X5: 52,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X6: 53,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X8: 54,
|
||||
TEXTURE_FMT_SRGBA_ASTC_10X10: 55,
|
||||
TEXTURE_FMT_SRGBA_ASTC_12X10: 56,
|
||||
TEXTURE_FMT_SRGBA_ASTC_12X12: 57,
|
||||
|
||||
// depth and stencil function
|
||||
DS_FUNC_NEVER: 512, // gl.NEVER
|
||||
DS_FUNC_LESS: 513, // gl.LESS
|
||||
|
@@ -161,7 +161,8 @@ function convertOptions(texture, options) {
|
||||
options.bpp = gltf.bpp;
|
||||
options.compressed =
|
||||
(format >= enums.TEXTURE_FMT_RGB_DXT1 && format <= enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1) ||
|
||||
(format >= enums.TEXTURE_FMT_RGB_ETC2 && format <= enums.TEXTURE_FMT_RGBA_ETC2);
|
||||
(format >= enums.TEXTURE_FMT_RGB_ETC2 && format <= enums.TEXTURE_FMT_RGBA_ETC2) ||
|
||||
(format >= enums.TEXTURE_FMT_RGBA_ASTC_4X4 && format <= enums.TEXTURE_FMT_SRGBA_ASTC_12X12);
|
||||
}
|
||||
|
||||
options.width = options.width || texture._width;
|
||||
|
Reference in New Issue
Block a user