twgl.js 6.1.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{6.x → 7.x}/twgl-full.d.ts +15 -6
- package/dist/{6.x → 7.x}/twgl-full.js +817 -93
- package/dist/{6.x → 7.x}/twgl-full.module.js +379 -94
- package/dist/{6.x → 7.x}/twgl.d.ts +15 -6
- package/dist/{6.x → 7.x}/twgl.js +817 -93
- package/package.json +9 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @license twgl.js
|
|
2
|
+
* @license twgl.js 7.0.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
|
|
3
3
|
* Available via the MIT license.
|
|
4
4
|
* see: http://github.com/greggman/twgl.js for details
|
|
5
5
|
*/
|
|
@@ -7152,6 +7152,7 @@ var CLAMP_TO_EDGE = 0x812f;
|
|
|
7152
7152
|
/* TextureMagFilter */
|
|
7153
7153
|
var NEAREST = 0x2600;
|
|
7154
7154
|
var LINEAR = 0x2601;
|
|
7155
|
+
var NEAREST_MIPMAP_LINEAR = 0x2702;
|
|
7155
7156
|
|
|
7156
7157
|
/* TextureMinFilter */
|
|
7157
7158
|
// const NEAREST_MIPMAP_NEAREST = 0x2700;
|
|
@@ -7275,6 +7276,74 @@ var RED = 0x1903;
|
|
|
7275
7276
|
var RED_INTEGER = 0x8D94;
|
|
7276
7277
|
var RGB_INTEGER = 0x8D98;
|
|
7277
7278
|
var RGBA_INTEGER = 0x8D99;
|
|
7279
|
+
|
|
7280
|
+
/* Compressed Texture Formats */
|
|
7281
|
+
// s3tc
|
|
7282
|
+
var COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
|
7283
|
+
var COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
|
|
7284
|
+
var COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
|
|
7285
|
+
var COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
|
|
7286
|
+
// s3tc_srgb
|
|
7287
|
+
var COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C;
|
|
7288
|
+
var COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D;
|
|
7289
|
+
var COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E;
|
|
7290
|
+
var COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F;
|
|
7291
|
+
// etc
|
|
7292
|
+
var COMPRESSED_RGB_ETC1_WEBGL = 0x8D64;
|
|
7293
|
+
var COMPRESSED_R11_EAC = 0x9270;
|
|
7294
|
+
var COMPRESSED_SIGNED_R11_EAC = 0x9271;
|
|
7295
|
+
var COMPRESSED_RG11_EAC = 0x9272;
|
|
7296
|
+
var COMPRESSED_SIGNED_RG11_EAC = 0x9273;
|
|
7297
|
+
var COMPRESSED_RGB8_ETC2 = 0x9274;
|
|
7298
|
+
var COMPRESSED_SRGB8_ETC2 = 0x9275;
|
|
7299
|
+
var COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276;
|
|
7300
|
+
var COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277;
|
|
7301
|
+
var COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
|
|
7302
|
+
var COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279;
|
|
7303
|
+
// pvrtc
|
|
7304
|
+
var COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
|
|
7305
|
+
var COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01;
|
|
7306
|
+
var COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
|
|
7307
|
+
var COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
|
|
7308
|
+
// astc
|
|
7309
|
+
var COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
|
|
7310
|
+
var COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
|
|
7311
|
+
var COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
|
|
7312
|
+
var COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
|
|
7313
|
+
var COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
|
|
7314
|
+
var COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
|
|
7315
|
+
var COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
|
|
7316
|
+
var COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
|
|
7317
|
+
var COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
|
|
7318
|
+
var COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
|
|
7319
|
+
var COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
|
|
7320
|
+
var COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
|
|
7321
|
+
var COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
|
|
7322
|
+
var COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
|
|
7323
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
|
|
7324
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
|
|
7325
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
|
|
7326
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
|
|
7327
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
|
|
7328
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
|
|
7329
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
|
|
7330
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
|
|
7331
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
|
|
7332
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
|
|
7333
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
|
|
7334
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
|
|
7335
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
|
|
7336
|
+
var COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
|
|
7337
|
+
// bptc
|
|
7338
|
+
var COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8E8C;
|
|
7339
|
+
var COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8E8D;
|
|
7340
|
+
var COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8E8E;
|
|
7341
|
+
var COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8E8F;
|
|
7342
|
+
// rgtc
|
|
7343
|
+
var COMPRESSED_RED_RGTC1_EXT = 0x8DBB;
|
|
7344
|
+
var COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC;
|
|
7345
|
+
var COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD;
|
|
7346
|
+
var COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE;
|
|
7278
7347
|
var formatInfo = {};
|
|
7279
7348
|
{
|
|
7280
7349
|
// NOTE: this is named `numColorComponents` vs `numComponents` so we can let Uglify mangle
|
|
@@ -7327,13 +7396,22 @@ var formatInfo = {};
|
|
|
7327
7396
|
};
|
|
7328
7397
|
}
|
|
7329
7398
|
|
|
7399
|
+
/**
|
|
7400
|
+
* @typedef {Object} BlockInfo
|
|
7401
|
+
* @property {number} bytes number of bytes in the block
|
|
7402
|
+
* @property {number} width width of the block
|
|
7403
|
+
* @property {number} height height of the block
|
|
7404
|
+
* @private
|
|
7405
|
+
*/
|
|
7406
|
+
|
|
7330
7407
|
/**
|
|
7331
7408
|
* @typedef {Object} TextureFormatDetails
|
|
7332
7409
|
* @property {number} textureFormat format to pass texImage2D and similar functions.
|
|
7333
7410
|
* @property {boolean} colorRenderable true if you can render to this format of texture.
|
|
7334
7411
|
* @property {boolean} textureFilterable true if you can filter the texture, false if you can ony use `NEAREST`.
|
|
7335
7412
|
* @property {number[]} type Array of possible types you can pass to texImage2D and similar function
|
|
7336
|
-
* @property {Object.<number,number>} bytesPerElementMap A map of types to bytes per element
|
|
7413
|
+
* @property {Object.<number,number>} [bytesPerElementMap] A map of types to bytes per element
|
|
7414
|
+
* @property {BlockInfo} [block] block size, only for compressed textures
|
|
7337
7415
|
* @private
|
|
7338
7416
|
*/
|
|
7339
7417
|
|
|
@@ -7774,9 +7852,514 @@ function getTextureInternalFormatInfo(internalFormat) {
|
|
|
7774
7852
|
info.bytesPerElementMap[type] = bytesPerElement;
|
|
7775
7853
|
});
|
|
7776
7854
|
});
|
|
7855
|
+
var block8_4_4 = {
|
|
7856
|
+
bytes: 8,
|
|
7857
|
+
width: 4,
|
|
7858
|
+
height: 4
|
|
7859
|
+
};
|
|
7860
|
+
var block16_4_4 = {
|
|
7861
|
+
bytes: 16,
|
|
7862
|
+
width: 4,
|
|
7863
|
+
height: 4
|
|
7864
|
+
};
|
|
7865
|
+
|
|
7866
|
+
// compressed texture formats
|
|
7867
|
+
// s3tc:https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_compression_s3tc.txt
|
|
7868
|
+
t[COMPRESSED_RGB_S3TC_DXT1_EXT] = {
|
|
7869
|
+
textureFormat: COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
7870
|
+
colorRenderable: false,
|
|
7871
|
+
textureFilterable: true,
|
|
7872
|
+
block: block8_4_4
|
|
7873
|
+
};
|
|
7874
|
+
t[COMPRESSED_RGBA_S3TC_DXT1_EXT] = {
|
|
7875
|
+
textureFormat: COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
7876
|
+
colorRenderable: false,
|
|
7877
|
+
textureFilterable: true,
|
|
7878
|
+
block: block8_4_4
|
|
7879
|
+
};
|
|
7880
|
+
t[COMPRESSED_RGBA_S3TC_DXT3_EXT] = {
|
|
7881
|
+
textureFormat: COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
7882
|
+
colorRenderable: false,
|
|
7883
|
+
textureFilterable: true,
|
|
7884
|
+
block: block16_4_4
|
|
7885
|
+
};
|
|
7886
|
+
t[COMPRESSED_RGBA_S3TC_DXT5_EXT] = {
|
|
7887
|
+
textureFormat: COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
7888
|
+
colorRenderable: false,
|
|
7889
|
+
textureFilterable: true,
|
|
7890
|
+
block: block16_4_4
|
|
7891
|
+
};
|
|
7892
|
+
// https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_compression_s3tc_srgb.txt
|
|
7893
|
+
t[COMPRESSED_SRGB_S3TC_DXT1_EXT] = {
|
|
7894
|
+
textureFormat: COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
7895
|
+
colorRenderable: false,
|
|
7896
|
+
textureFilterable: true,
|
|
7897
|
+
block: block8_4_4
|
|
7898
|
+
};
|
|
7899
|
+
t[COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = {
|
|
7900
|
+
textureFormat: COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
|
|
7901
|
+
colorRenderable: false,
|
|
7902
|
+
textureFilterable: true,
|
|
7903
|
+
block: block8_4_4
|
|
7904
|
+
};
|
|
7905
|
+
t[COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = {
|
|
7906
|
+
textureFormat: COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
7907
|
+
colorRenderable: false,
|
|
7908
|
+
textureFilterable: true,
|
|
7909
|
+
block: block16_4_4
|
|
7910
|
+
};
|
|
7911
|
+
t[COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = {
|
|
7912
|
+
textureFormat: COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
7913
|
+
colorRenderable: false,
|
|
7914
|
+
textureFilterable: true,
|
|
7915
|
+
block: block16_4_4
|
|
7916
|
+
};
|
|
7917
|
+
// https://registry.khronos.org/OpenGL/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
|
|
7918
|
+
t[COMPRESSED_RGB_ETC1_WEBGL] = {
|
|
7919
|
+
textureFormat: COMPRESSED_RGB_ETC1_WEBGL,
|
|
7920
|
+
colorRenderable: false,
|
|
7921
|
+
textureFilterable: true,
|
|
7922
|
+
block: block8_4_4
|
|
7923
|
+
};
|
|
7924
|
+
t[COMPRESSED_R11_EAC] = {
|
|
7925
|
+
textureFormat: COMPRESSED_R11_EAC,
|
|
7926
|
+
colorRenderable: false,
|
|
7927
|
+
textureFilterable: true,
|
|
7928
|
+
block: block8_4_4
|
|
7929
|
+
};
|
|
7930
|
+
t[COMPRESSED_SIGNED_R11_EAC] = {
|
|
7931
|
+
textureFormat: COMPRESSED_SIGNED_R11_EAC,
|
|
7932
|
+
colorRenderable: false,
|
|
7933
|
+
textureFilterable: true,
|
|
7934
|
+
block: block8_4_4
|
|
7935
|
+
};
|
|
7936
|
+
t[COMPRESSED_RG11_EAC] = {
|
|
7937
|
+
textureFormat: COMPRESSED_RG11_EAC,
|
|
7938
|
+
colorRenderable: false,
|
|
7939
|
+
textureFilterable: true,
|
|
7940
|
+
block: block16_4_4
|
|
7941
|
+
};
|
|
7942
|
+
t[COMPRESSED_SIGNED_RG11_EAC] = {
|
|
7943
|
+
textureFormat: COMPRESSED_SIGNED_RG11_EAC,
|
|
7944
|
+
colorRenderable: false,
|
|
7945
|
+
textureFilterable: true,
|
|
7946
|
+
block: block16_4_4
|
|
7947
|
+
};
|
|
7948
|
+
t[COMPRESSED_RGB8_ETC2] = {
|
|
7949
|
+
textureFormat: COMPRESSED_RGB8_ETC2,
|
|
7950
|
+
colorRenderable: false,
|
|
7951
|
+
textureFilterable: true,
|
|
7952
|
+
block: block8_4_4
|
|
7953
|
+
};
|
|
7954
|
+
t[COMPRESSED_SRGB8_ETC2] = {
|
|
7955
|
+
textureFormat: COMPRESSED_SRGB8_ETC2,
|
|
7956
|
+
colorRenderable: false,
|
|
7957
|
+
textureFilterable: true,
|
|
7958
|
+
block: block8_4_4
|
|
7959
|
+
};
|
|
7960
|
+
t[COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = {
|
|
7961
|
+
textureFormat: COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
7962
|
+
colorRenderable: false,
|
|
7963
|
+
textureFilterable: true,
|
|
7964
|
+
block: block8_4_4
|
|
7965
|
+
};
|
|
7966
|
+
t[COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = {
|
|
7967
|
+
textureFormat: COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
7968
|
+
colorRenderable: false,
|
|
7969
|
+
textureFilterable: true,
|
|
7970
|
+
block: block8_4_4
|
|
7971
|
+
};
|
|
7972
|
+
t[COMPRESSED_RGBA8_ETC2_EAC] = {
|
|
7973
|
+
textureFormat: COMPRESSED_RGBA8_ETC2_EAC,
|
|
7974
|
+
colorRenderable: false,
|
|
7975
|
+
textureFilterable: true,
|
|
7976
|
+
block: block16_4_4
|
|
7977
|
+
};
|
|
7978
|
+
t[COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = {
|
|
7979
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
7980
|
+
colorRenderable: false,
|
|
7981
|
+
textureFilterable: true,
|
|
7982
|
+
block: block16_4_4
|
|
7983
|
+
};
|
|
7984
|
+
// https://registry.khronos.org/OpenGL/extensions/IMG/IMG_texture_compression_pvrtc.txt
|
|
7985
|
+
t[COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = {
|
|
7986
|
+
textureFormat: COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
7987
|
+
colorRenderable: false,
|
|
7988
|
+
textureFilterable: true,
|
|
7989
|
+
block: {
|
|
7990
|
+
bytes: 32,
|
|
7991
|
+
width: 8,
|
|
7992
|
+
height: 8
|
|
7993
|
+
}
|
|
7994
|
+
};
|
|
7995
|
+
t[COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = {
|
|
7996
|
+
textureFormat: COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
|
|
7997
|
+
colorRenderable: false,
|
|
7998
|
+
textureFilterable: true,
|
|
7999
|
+
block: {
|
|
8000
|
+
bytes: 32,
|
|
8001
|
+
width: 16,
|
|
8002
|
+
height: 8
|
|
8003
|
+
}
|
|
8004
|
+
};
|
|
8005
|
+
t[COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = {
|
|
8006
|
+
textureFormat: COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
8007
|
+
colorRenderable: false,
|
|
8008
|
+
textureFilterable: true,
|
|
8009
|
+
block: {
|
|
8010
|
+
bytes: 32,
|
|
8011
|
+
width: 8,
|
|
8012
|
+
height: 8
|
|
8013
|
+
}
|
|
8014
|
+
};
|
|
8015
|
+
t[COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = {
|
|
8016
|
+
textureFormat: COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
8017
|
+
colorRenderable: false,
|
|
8018
|
+
textureFilterable: true,
|
|
8019
|
+
block: {
|
|
8020
|
+
bytes: 32,
|
|
8021
|
+
width: 16,
|
|
8022
|
+
height: 8
|
|
8023
|
+
}
|
|
8024
|
+
};
|
|
8025
|
+
// https://registry.khronos.org/OpenGL/extensions/KHR/KHR_texture_compression_astc_hdr.txt
|
|
8026
|
+
t[COMPRESSED_RGBA_ASTC_4x4_KHR] = {
|
|
8027
|
+
textureFormat: COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
8028
|
+
colorRenderable: false,
|
|
8029
|
+
textureFilterable: true,
|
|
8030
|
+
block: {
|
|
8031
|
+
bytes: 16,
|
|
8032
|
+
width: 4,
|
|
8033
|
+
height: 4
|
|
8034
|
+
}
|
|
8035
|
+
};
|
|
8036
|
+
t[COMPRESSED_RGBA_ASTC_5x4_KHR] = {
|
|
8037
|
+
textureFormat: COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
8038
|
+
colorRenderable: false,
|
|
8039
|
+
textureFilterable: true,
|
|
8040
|
+
block: {
|
|
8041
|
+
bytes: 16,
|
|
8042
|
+
width: 5,
|
|
8043
|
+
height: 4
|
|
8044
|
+
}
|
|
8045
|
+
};
|
|
8046
|
+
t[COMPRESSED_RGBA_ASTC_5x5_KHR] = {
|
|
8047
|
+
textureFormat: COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
8048
|
+
colorRenderable: false,
|
|
8049
|
+
textureFilterable: true,
|
|
8050
|
+
block: {
|
|
8051
|
+
bytes: 16,
|
|
8052
|
+
width: 5,
|
|
8053
|
+
height: 5
|
|
8054
|
+
}
|
|
8055
|
+
};
|
|
8056
|
+
t[COMPRESSED_RGBA_ASTC_6x5_KHR] = {
|
|
8057
|
+
textureFormat: COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
8058
|
+
colorRenderable: false,
|
|
8059
|
+
textureFilterable: true,
|
|
8060
|
+
block: {
|
|
8061
|
+
bytes: 16,
|
|
8062
|
+
width: 6,
|
|
8063
|
+
height: 5
|
|
8064
|
+
}
|
|
8065
|
+
};
|
|
8066
|
+
t[COMPRESSED_RGBA_ASTC_6x6_KHR] = {
|
|
8067
|
+
textureFormat: COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
8068
|
+
colorRenderable: false,
|
|
8069
|
+
textureFilterable: true,
|
|
8070
|
+
block: {
|
|
8071
|
+
bytes: 16,
|
|
8072
|
+
width: 6,
|
|
8073
|
+
height: 6
|
|
8074
|
+
}
|
|
8075
|
+
};
|
|
8076
|
+
t[COMPRESSED_RGBA_ASTC_8x5_KHR] = {
|
|
8077
|
+
textureFormat: COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
8078
|
+
colorRenderable: false,
|
|
8079
|
+
textureFilterable: true,
|
|
8080
|
+
block: {
|
|
8081
|
+
bytes: 16,
|
|
8082
|
+
width: 8,
|
|
8083
|
+
height: 5
|
|
8084
|
+
}
|
|
8085
|
+
};
|
|
8086
|
+
t[COMPRESSED_RGBA_ASTC_8x6_KHR] = {
|
|
8087
|
+
textureFormat: COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
8088
|
+
colorRenderable: false,
|
|
8089
|
+
textureFilterable: true,
|
|
8090
|
+
block: {
|
|
8091
|
+
bytes: 16,
|
|
8092
|
+
width: 8,
|
|
8093
|
+
height: 6
|
|
8094
|
+
}
|
|
8095
|
+
};
|
|
8096
|
+
t[COMPRESSED_RGBA_ASTC_8x8_KHR] = {
|
|
8097
|
+
textureFormat: COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
8098
|
+
colorRenderable: false,
|
|
8099
|
+
textureFilterable: true,
|
|
8100
|
+
block: {
|
|
8101
|
+
bytes: 16,
|
|
8102
|
+
width: 8,
|
|
8103
|
+
height: 8
|
|
8104
|
+
}
|
|
8105
|
+
};
|
|
8106
|
+
t[COMPRESSED_RGBA_ASTC_10x5_KHR] = {
|
|
8107
|
+
textureFormat: COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
8108
|
+
colorRenderable: false,
|
|
8109
|
+
textureFilterable: true,
|
|
8110
|
+
block: {
|
|
8111
|
+
bytes: 16,
|
|
8112
|
+
width: 10,
|
|
8113
|
+
height: 5
|
|
8114
|
+
}
|
|
8115
|
+
};
|
|
8116
|
+
t[COMPRESSED_RGBA_ASTC_10x6_KHR] = {
|
|
8117
|
+
textureFormat: COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
8118
|
+
colorRenderable: false,
|
|
8119
|
+
textureFilterable: true,
|
|
8120
|
+
block: {
|
|
8121
|
+
bytes: 16,
|
|
8122
|
+
width: 10,
|
|
8123
|
+
height: 6
|
|
8124
|
+
}
|
|
8125
|
+
};
|
|
8126
|
+
t[COMPRESSED_RGBA_ASTC_10x8_KHR] = {
|
|
8127
|
+
textureFormat: COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
8128
|
+
colorRenderable: false,
|
|
8129
|
+
textureFilterable: true,
|
|
8130
|
+
block: {
|
|
8131
|
+
bytes: 16,
|
|
8132
|
+
width: 10,
|
|
8133
|
+
height: 8
|
|
8134
|
+
}
|
|
8135
|
+
};
|
|
8136
|
+
t[COMPRESSED_RGBA_ASTC_10x10_KHR] = {
|
|
8137
|
+
textureFormat: COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
8138
|
+
colorRenderable: false,
|
|
8139
|
+
textureFilterable: true,
|
|
8140
|
+
block: {
|
|
8141
|
+
bytes: 16,
|
|
8142
|
+
width: 10,
|
|
8143
|
+
height: 10
|
|
8144
|
+
}
|
|
8145
|
+
};
|
|
8146
|
+
t[COMPRESSED_RGBA_ASTC_12x10_KHR] = {
|
|
8147
|
+
textureFormat: COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
8148
|
+
colorRenderable: false,
|
|
8149
|
+
textureFilterable: true,
|
|
8150
|
+
block: {
|
|
8151
|
+
bytes: 16,
|
|
8152
|
+
width: 12,
|
|
8153
|
+
height: 10
|
|
8154
|
+
}
|
|
8155
|
+
};
|
|
8156
|
+
t[COMPRESSED_RGBA_ASTC_12x12_KHR] = {
|
|
8157
|
+
textureFormat: COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
8158
|
+
colorRenderable: false,
|
|
8159
|
+
textureFilterable: true,
|
|
8160
|
+
block: {
|
|
8161
|
+
bytes: 16,
|
|
8162
|
+
width: 12,
|
|
8163
|
+
height: 12
|
|
8164
|
+
}
|
|
8165
|
+
};
|
|
8166
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR] = {
|
|
8167
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
8168
|
+
colorRenderable: false,
|
|
8169
|
+
textureFilterable: true,
|
|
8170
|
+
block: {
|
|
8171
|
+
bytes: 16,
|
|
8172
|
+
width: 4,
|
|
8173
|
+
height: 4
|
|
8174
|
+
}
|
|
8175
|
+
};
|
|
8176
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR] = {
|
|
8177
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
8178
|
+
colorRenderable: false,
|
|
8179
|
+
textureFilterable: true,
|
|
8180
|
+
block: {
|
|
8181
|
+
bytes: 16,
|
|
8182
|
+
width: 5,
|
|
8183
|
+
height: 4
|
|
8184
|
+
}
|
|
8185
|
+
};
|
|
8186
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR] = {
|
|
8187
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
8188
|
+
colorRenderable: false,
|
|
8189
|
+
textureFilterable: true,
|
|
8190
|
+
block: {
|
|
8191
|
+
bytes: 16,
|
|
8192
|
+
width: 5,
|
|
8193
|
+
height: 5
|
|
8194
|
+
}
|
|
8195
|
+
};
|
|
8196
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR] = {
|
|
8197
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
8198
|
+
colorRenderable: false,
|
|
8199
|
+
textureFilterable: true,
|
|
8200
|
+
block: {
|
|
8201
|
+
bytes: 16,
|
|
8202
|
+
width: 6,
|
|
8203
|
+
height: 5
|
|
8204
|
+
}
|
|
8205
|
+
};
|
|
8206
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR] = {
|
|
8207
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
8208
|
+
colorRenderable: false,
|
|
8209
|
+
textureFilterable: true,
|
|
8210
|
+
block: {
|
|
8211
|
+
bytes: 16,
|
|
8212
|
+
width: 6,
|
|
8213
|
+
height: 6
|
|
8214
|
+
}
|
|
8215
|
+
};
|
|
8216
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR] = {
|
|
8217
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
8218
|
+
colorRenderable: false,
|
|
8219
|
+
textureFilterable: true,
|
|
8220
|
+
block: {
|
|
8221
|
+
bytes: 16,
|
|
8222
|
+
width: 8,
|
|
8223
|
+
height: 5
|
|
8224
|
+
}
|
|
8225
|
+
};
|
|
8226
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR] = {
|
|
8227
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
8228
|
+
colorRenderable: false,
|
|
8229
|
+
textureFilterable: true,
|
|
8230
|
+
block: {
|
|
8231
|
+
bytes: 16,
|
|
8232
|
+
width: 8,
|
|
8233
|
+
height: 6
|
|
8234
|
+
}
|
|
8235
|
+
};
|
|
8236
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR] = {
|
|
8237
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
8238
|
+
colorRenderable: false,
|
|
8239
|
+
textureFilterable: true,
|
|
8240
|
+
block: {
|
|
8241
|
+
bytes: 16,
|
|
8242
|
+
width: 8,
|
|
8243
|
+
height: 8
|
|
8244
|
+
}
|
|
8245
|
+
};
|
|
8246
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR] = {
|
|
8247
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
8248
|
+
colorRenderable: false,
|
|
8249
|
+
textureFilterable: true,
|
|
8250
|
+
block: {
|
|
8251
|
+
bytes: 16,
|
|
8252
|
+
width: 10,
|
|
8253
|
+
height: 5
|
|
8254
|
+
}
|
|
8255
|
+
};
|
|
8256
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR] = {
|
|
8257
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
8258
|
+
colorRenderable: false,
|
|
8259
|
+
textureFilterable: true,
|
|
8260
|
+
block: {
|
|
8261
|
+
bytes: 16,
|
|
8262
|
+
width: 10,
|
|
8263
|
+
height: 6
|
|
8264
|
+
}
|
|
8265
|
+
};
|
|
8266
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR] = {
|
|
8267
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
8268
|
+
colorRenderable: false,
|
|
8269
|
+
textureFilterable: true,
|
|
8270
|
+
block: {
|
|
8271
|
+
bytes: 16,
|
|
8272
|
+
width: 10,
|
|
8273
|
+
height: 8
|
|
8274
|
+
}
|
|
8275
|
+
};
|
|
8276
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR] = {
|
|
8277
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
8278
|
+
colorRenderable: false,
|
|
8279
|
+
textureFilterable: true,
|
|
8280
|
+
block: {
|
|
8281
|
+
bytes: 16,
|
|
8282
|
+
width: 10,
|
|
8283
|
+
height: 10
|
|
8284
|
+
}
|
|
8285
|
+
};
|
|
8286
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR] = {
|
|
8287
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
8288
|
+
colorRenderable: false,
|
|
8289
|
+
textureFilterable: true,
|
|
8290
|
+
block: {
|
|
8291
|
+
bytes: 16,
|
|
8292
|
+
width: 12,
|
|
8293
|
+
height: 10
|
|
8294
|
+
}
|
|
8295
|
+
};
|
|
8296
|
+
t[COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR] = {
|
|
8297
|
+
textureFormat: COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
8298
|
+
colorRenderable: false,
|
|
8299
|
+
textureFilterable: true,
|
|
8300
|
+
block: {
|
|
8301
|
+
bytes: 16,
|
|
8302
|
+
width: 12,
|
|
8303
|
+
height: 12
|
|
8304
|
+
}
|
|
8305
|
+
};
|
|
8306
|
+
// https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_compression_bptc.txt
|
|
8307
|
+
t[COMPRESSED_RGBA_BPTC_UNORM_EXT] = {
|
|
8308
|
+
textureFormat: COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
8309
|
+
colorRenderable: false,
|
|
8310
|
+
textureFilterable: true,
|
|
8311
|
+
block: block16_4_4
|
|
8312
|
+
};
|
|
8313
|
+
t[COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT] = {
|
|
8314
|
+
textureFormat: COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
|
|
8315
|
+
colorRenderable: false,
|
|
8316
|
+
textureFilterable: true,
|
|
8317
|
+
block: block16_4_4
|
|
8318
|
+
};
|
|
8319
|
+
t[COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT] = {
|
|
8320
|
+
textureFormat: COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
|
|
8321
|
+
colorRenderable: false,
|
|
8322
|
+
textureFilterable: true,
|
|
8323
|
+
block: block16_4_4
|
|
8324
|
+
};
|
|
8325
|
+
t[COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT] = {
|
|
8326
|
+
textureFormat: COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
|
|
8327
|
+
colorRenderable: false,
|
|
8328
|
+
textureFilterable: true,
|
|
8329
|
+
block: block16_4_4
|
|
8330
|
+
};
|
|
8331
|
+
// https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_compression_rgtc.txt
|
|
8332
|
+
t[COMPRESSED_RED_RGTC1_EXT] = {
|
|
8333
|
+
textureFormat: COMPRESSED_RED_RGTC1_EXT,
|
|
8334
|
+
colorRenderable: false,
|
|
8335
|
+
textureFilterable: true,
|
|
8336
|
+
block: block8_4_4
|
|
8337
|
+
};
|
|
8338
|
+
t[COMPRESSED_SIGNED_RED_RGTC1_EXT] = {
|
|
8339
|
+
textureFormat: COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
8340
|
+
colorRenderable: false,
|
|
8341
|
+
textureFilterable: true,
|
|
8342
|
+
block: block8_4_4
|
|
8343
|
+
};
|
|
8344
|
+
t[COMPRESSED_RED_GREEN_RGTC2_EXT] = {
|
|
8345
|
+
textureFormat: COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
8346
|
+
colorRenderable: false,
|
|
8347
|
+
textureFilterable: true,
|
|
8348
|
+
block: block8_4_4
|
|
8349
|
+
};
|
|
8350
|
+
t[COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT] = {
|
|
8351
|
+
textureFormat: COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
8352
|
+
colorRenderable: false,
|
|
8353
|
+
textureFilterable: true,
|
|
8354
|
+
block: block8_4_4
|
|
8355
|
+
};
|
|
7777
8356
|
s_textureInternalFormatInfo = t;
|
|
7778
8357
|
}
|
|
7779
|
-
|
|
8358
|
+
var info = s_textureInternalFormatInfo[internalFormat];
|
|
8359
|
+
if (!info) {
|
|
8360
|
+
throw new Error("unknown internal format");
|
|
8361
|
+
}
|
|
8362
|
+
return info;
|
|
7780
8363
|
}
|
|
7781
8364
|
|
|
7782
8365
|
/**
|
|
@@ -7788,12 +8371,9 @@ function getTextureInternalFormatInfo(internalFormat) {
|
|
|
7788
8371
|
*/
|
|
7789
8372
|
function getBytesPerElementForInternalFormat(internalFormat, type) {
|
|
7790
8373
|
var info = getTextureInternalFormatInfo(internalFormat);
|
|
7791
|
-
if (!info) {
|
|
7792
|
-
throw "unknown internal format";
|
|
7793
|
-
}
|
|
7794
8374
|
var bytesPerElement = info.bytesPerElementMap[type];
|
|
7795
8375
|
if (bytesPerElement === undefined) {
|
|
7796
|
-
throw "
|
|
8376
|
+
throw new Error("type not supported for internal format");
|
|
7797
8377
|
}
|
|
7798
8378
|
return bytesPerElement;
|
|
7799
8379
|
}
|
|
@@ -7816,13 +8396,47 @@ function getBytesPerElementForInternalFormat(internalFormat, type) {
|
|
|
7816
8396
|
* @memberOf module:twgl/textures
|
|
7817
8397
|
*/
|
|
7818
8398
|
function getFormatAndTypeForInternalFormat(internalFormat) {
|
|
8399
|
+
var _info$type$, _info$type;
|
|
7819
8400
|
var info = getTextureInternalFormatInfo(internalFormat);
|
|
7820
8401
|
if (!info) {
|
|
7821
|
-
throw "unknown internal format";
|
|
8402
|
+
throw new Error("unknown internal format");
|
|
7822
8403
|
}
|
|
7823
8404
|
return {
|
|
7824
8405
|
format: info.textureFormat,
|
|
7825
|
-
type: info.type[0]
|
|
8406
|
+
type: (_info$type$ = (_info$type = info.type) === null || _info$type === void 0 ? void 0 : _info$type[0]) !== null && _info$type$ !== void 0 ? _info$type$ : UNSIGNED_BYTE
|
|
8407
|
+
};
|
|
8408
|
+
}
|
|
8409
|
+
|
|
8410
|
+
/**
|
|
8411
|
+
* @param {number} internalFormat The internal format
|
|
8412
|
+
* @returns if the internalFormat is a compressed format
|
|
8413
|
+
* @private
|
|
8414
|
+
*/
|
|
8415
|
+
function isCompressedInternalFormat(internalFormat) {
|
|
8416
|
+
var info = getTextureInternalFormatInfo(internalFormat);
|
|
8417
|
+
return !!info.block;
|
|
8418
|
+
}
|
|
8419
|
+
|
|
8420
|
+
/**
|
|
8421
|
+
* Gets the width, height, and bytes per block for the given internal format
|
|
8422
|
+
* @param {number} internalFormat
|
|
8423
|
+
* @param {number} type
|
|
8424
|
+
* @private
|
|
8425
|
+
*/
|
|
8426
|
+
function getBlockInfoForInternalFormat(internalFormat, type) {
|
|
8427
|
+
var info = getTextureInternalFormatInfo(internalFormat);
|
|
8428
|
+
if (info.block) {
|
|
8429
|
+
return {
|
|
8430
|
+
blockWidth: info.block.width,
|
|
8431
|
+
blockHeight: info.block.height,
|
|
8432
|
+
bytesPerBlock: info.block.bytes
|
|
8433
|
+
};
|
|
8434
|
+
}
|
|
8435
|
+
var bytesPerBlock = getBytesPerElementForInternalFormat(internalFormat, type);
|
|
8436
|
+
return {
|
|
8437
|
+
blockWidth: 1,
|
|
8438
|
+
blockHeight: 1,
|
|
8439
|
+
bytesPerBlock: bytesPerBlock
|
|
7826
8440
|
};
|
|
7827
8441
|
}
|
|
7828
8442
|
|
|
@@ -7852,9 +8466,6 @@ function canGenerateMipmap(gl, width, height, internalFormat) {
|
|
|
7852
8466
|
return isPowerOf2(width) && isPowerOf2(height);
|
|
7853
8467
|
}
|
|
7854
8468
|
var info = getTextureInternalFormatInfo(internalFormat);
|
|
7855
|
-
if (!info) {
|
|
7856
|
-
throw "unknown internal format";
|
|
7857
|
-
}
|
|
7858
8469
|
return info.colorRenderable && info.textureFilterable;
|
|
7859
8470
|
}
|
|
7860
8471
|
|
|
@@ -7866,9 +8477,6 @@ function canGenerateMipmap(gl, width, height, internalFormat) {
|
|
|
7866
8477
|
*/
|
|
7867
8478
|
function canFilter(internalFormat) {
|
|
7868
8479
|
var info = getTextureInternalFormatInfo(internalFormat);
|
|
7869
|
-
if (!info) {
|
|
7870
|
-
throw "unknown internal format";
|
|
7871
|
-
}
|
|
7872
8480
|
return info.textureFilterable;
|
|
7873
8481
|
}
|
|
7874
8482
|
|
|
@@ -7880,9 +8488,6 @@ function canFilter(internalFormat) {
|
|
|
7880
8488
|
*/
|
|
7881
8489
|
function getNumComponentsForFormat(format) {
|
|
7882
8490
|
var info = formatInfo[format];
|
|
7883
|
-
if (!info) {
|
|
7884
|
-
throw "unknown format: " + format;
|
|
7885
|
-
}
|
|
7886
8491
|
return info.numColorComponents;
|
|
7887
8492
|
}
|
|
7888
8493
|
|
|
@@ -7900,7 +8505,7 @@ function getTextureTypeForArrayType(gl, src, defaultType) {
|
|
|
7900
8505
|
}
|
|
7901
8506
|
function guessDimensions(gl, target, width, height, numElements) {
|
|
7902
8507
|
if (numElements % 1 !== 0) {
|
|
7903
|
-
throw "can't guess dimensions";
|
|
8508
|
+
throw new Error("can't guess dimensions");
|
|
7904
8509
|
}
|
|
7905
8510
|
if (!width && !height) {
|
|
7906
8511
|
var size = Math.sqrt(numElements / (target === TEXTURE_CUBE_MAP ? 6 : 1));
|
|
@@ -7914,12 +8519,12 @@ function guessDimensions(gl, target, width, height, numElements) {
|
|
|
7914
8519
|
} else if (!height) {
|
|
7915
8520
|
height = numElements / width;
|
|
7916
8521
|
if (height % 1) {
|
|
7917
|
-
throw "can't guess dimensions";
|
|
8522
|
+
throw new Error("can't guess dimensions");
|
|
7918
8523
|
}
|
|
7919
8524
|
} else if (!width) {
|
|
7920
8525
|
width = numElements / height;
|
|
7921
8526
|
if (width % 1) {
|
|
7922
|
-
throw "can't guess dimensions";
|
|
8527
|
+
throw new Error("can't guess dimensions");
|
|
7923
8528
|
}
|
|
7924
8529
|
}
|
|
7925
8530
|
return {
|
|
@@ -7972,7 +8577,7 @@ function setDefaults(newDefaults) {
|
|
|
7972
8577
|
* @property {number} [level] the mip level to affect. Defaults to 0. Note, if set auto will be considered false unless explicitly set to true.
|
|
7973
8578
|
* @property {number} [width] the width of the texture. Only used if src is an array or typed array or null.
|
|
7974
8579
|
* @property {number} [height] the height of a texture. Only used if src is an array or typed array or null.
|
|
7975
|
-
* @property {number} [depth] the depth of a texture. Only used if src is an array or
|
|
8580
|
+
* @property {number} [depth] the depth of a texture. Only used if src is an array or typed array or null and target is `TEXTURE_3D` .
|
|
7976
8581
|
* @property {number} [min] the min filter setting (eg. `gl.LINEAR`). Defaults to `gl.NEAREST_MIPMAP_LINEAR`
|
|
7977
8582
|
* or if texture is not a power of 2 on both dimensions then defaults to `gl.LINEAR`.
|
|
7978
8583
|
* @property {number} [mag] the mag filter setting (eg. `gl.LINEAR`). Defaults to `gl.LINEAR`
|
|
@@ -8031,15 +8636,24 @@ function setDefaults(newDefaults) {
|
|
|
8031
8636
|
* If `TexImageSource` then it wil be used immediately to create the contents of the texture. Examples `HTMLImageElement`,
|
|
8032
8637
|
* `HTMLCanvasElement`, `HTMLVideoElement`.
|
|
8033
8638
|
*
|
|
8034
|
-
* If `number[]` or `ArrayBufferView` it's assumed to be data for a texture.
|
|
8035
|
-
* not specified it is guessed as follows. First the number of elements is computed by `src.length / numComponents`
|
|
8036
|
-
* where `numComponents` is derived from `format`. If `target` is `gl.TEXTURE_CUBE_MAP` then `numElements` is divided
|
|
8037
|
-
* by 6. Then
|
|
8639
|
+
* If `number[]` or `ArrayBufferView` it's assumed to be data for a texture.
|
|
8038
8640
|
*
|
|
8039
|
-
* *
|
|
8040
|
-
* are set to `sqrt(numElements)`. Otherwise `width = numElements` and `height = 1`.
|
|
8641
|
+
* * If `width` or `height` is not specified it is guessed as follows.
|
|
8041
8642
|
*
|
|
8042
|
-
*
|
|
8643
|
+
* First the number of elements is computed by `src.length / numComponents`
|
|
8644
|
+
* where `numComponents` is derived from `format`. If `target` is `gl.TEXTURE_CUBE_MAP` then `numElements` is divided
|
|
8645
|
+
* by 6. Then
|
|
8646
|
+
*
|
|
8647
|
+
* * If neither `width` nor `height` are specified and `sqrt(numElements)` is an integer then width and height
|
|
8648
|
+
* are set to `sqrt(numElements)`. Otherwise `width = numElements` and `height = 1`.
|
|
8649
|
+
*
|
|
8650
|
+
* * If only one of `width` or `height` is specified then the other equals `numElements / specifiedDimension`.
|
|
8651
|
+
*
|
|
8652
|
+
* * If both `width` and `height` is specified, then, the size of mip levels from `level` will be computed
|
|
8653
|
+
* and data for consecutive mip levels will be uploaded until the data runs out.
|
|
8654
|
+
*
|
|
8655
|
+
* In other words: `{ format: g.RGBA, width: 4, height: 4, src: Uint8Array((4 * 4 + 2 * 2 + 1) * 4) }`
|
|
8656
|
+
* uploads 3 mip levels (4x4, 2x2, 1x1) because src is more than the data for the first mip level.
|
|
8043
8657
|
*
|
|
8044
8658
|
* If `number[]` will be converted to `type`.
|
|
8045
8659
|
*
|
|
@@ -8290,27 +8904,48 @@ function make1Pixel(color) {
|
|
|
8290
8904
|
return new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]);
|
|
8291
8905
|
}
|
|
8292
8906
|
|
|
8907
|
+
/**
|
|
8908
|
+
* @typedef {Object} SetTextureFilteringInternalOptions
|
|
8909
|
+
* @property {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
|
|
8910
|
+
* This is often the same options you passed in when you created the texture.
|
|
8911
|
+
* @property {number} [width] width of texture
|
|
8912
|
+
* @property {number} [height] height of texture
|
|
8913
|
+
* @property {number} [internalFormat] The internalFormat parameter from texImage2D etc..
|
|
8914
|
+
* @property {number} [lastMipLevelUploaded] The last mip level manually uploaded
|
|
8915
|
+
* @private
|
|
8916
|
+
*/
|
|
8917
|
+
|
|
8293
8918
|
/**
|
|
8294
8919
|
* Sets filtering or generates mips for texture based on width or height
|
|
8295
8920
|
* If width or height is not passed in uses `options.width` and//or `options.height`
|
|
8296
8921
|
*
|
|
8297
8922
|
* @param {WebGLRenderingContext} gl the WebGLRenderingContext
|
|
8298
8923
|
* @param {WebGLTexture} tex the WebGLTexture to set parameters for
|
|
8299
|
-
* @param {
|
|
8300
|
-
*
|
|
8301
|
-
* @param {number} [width] width of texture
|
|
8302
|
-
* @param {number} [height] height of texture
|
|
8303
|
-
* @param {number} [internalFormat] The internalFormat parameter from texImage2D etc..
|
|
8304
|
-
* @memberOf module:twgl/textures
|
|
8924
|
+
* @param {SetTextureFilteringInternalOptions} p
|
|
8925
|
+
* @private
|
|
8305
8926
|
*/
|
|
8306
|
-
function
|
|
8927
|
+
function setTextureFilteringForSizeInternal(gl, tex, _ref2) {
|
|
8928
|
+
var options = _ref2.options,
|
|
8929
|
+
width = _ref2.width,
|
|
8930
|
+
height = _ref2.height,
|
|
8931
|
+
internalFormat = _ref2.internalFormat,
|
|
8932
|
+
lastMipLevelUploaded = _ref2.lastMipLevelUploaded;
|
|
8307
8933
|
options = options || defaults.textureOptions;
|
|
8308
8934
|
internalFormat = internalFormat || RGBA;
|
|
8309
8935
|
var target = options.target || TEXTURE_2D;
|
|
8310
8936
|
width = width || options.width;
|
|
8311
8937
|
height = height || options.height;
|
|
8312
8938
|
gl.bindTexture(target, tex);
|
|
8313
|
-
if (
|
|
8939
|
+
if (lastMipLevelUploaded > 1) {
|
|
8940
|
+
var lastLevelWidth = Math.max(1, width >> lastMipLevelUploaded);
|
|
8941
|
+
var lastLevelHeight = Math.max(1, height >> lastMipLevelUploaded);
|
|
8942
|
+
// Note: This is a guess. The user can set maxLod etc...
|
|
8943
|
+
var canUseMips = lastLevelWidth === 1 && lastLevelHeight === 1;
|
|
8944
|
+
var magFiltering = canFilter(internalFormat) ? LINEAR : NEAREST;
|
|
8945
|
+
var minFiltering = canFilter(internalFormat) ? canUseMips ? NEAREST_MIPMAP_LINEAR : LINEAR : NEAREST;
|
|
8946
|
+
gl.texParameteri(target, TEXTURE_MAG_FILTER, magFiltering);
|
|
8947
|
+
gl.texParameteri(target, TEXTURE_MIN_FILTER, minFiltering);
|
|
8948
|
+
} else if (canGenerateMipmap(gl, width, height, internalFormat)) {
|
|
8314
8949
|
gl.generateMipmap(target);
|
|
8315
8950
|
} else {
|
|
8316
8951
|
var filtering = canFilter(internalFormat) ? LINEAR : NEAREST;
|
|
@@ -8320,6 +8955,28 @@ function setTextureFilteringForSize(gl, tex, options, width, height, internalFor
|
|
|
8320
8955
|
gl.texParameteri(target, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
|
|
8321
8956
|
}
|
|
8322
8957
|
}
|
|
8958
|
+
|
|
8959
|
+
/**
|
|
8960
|
+
* Sets filtering or generates mips for texture based on width or height
|
|
8961
|
+
* If width or height is not passed in uses `options.width` and//or `options.height`
|
|
8962
|
+
*
|
|
8963
|
+
* @param {WebGLRenderingContext} gl the WebGLRenderingContext
|
|
8964
|
+
* @param {WebGLTexture} tex the WebGLTexture to set parameters for
|
|
8965
|
+
* @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
|
|
8966
|
+
* This is often the same options you passed in when you created the texture.
|
|
8967
|
+
* @param {number} [width] width of texture
|
|
8968
|
+
* @param {number} [height] height of texture
|
|
8969
|
+
* @param {number} [internalFormat] The internalFormat parameter from texImage2D etc..
|
|
8970
|
+
* @memberOf module:twgl/textures
|
|
8971
|
+
*/
|
|
8972
|
+
function setTextureFilteringForSize(gl, tex, options, width, height, internalFormat) {
|
|
8973
|
+
setTextureFilteringForSizeInternal(gl, tex, {
|
|
8974
|
+
options: options,
|
|
8975
|
+
width: width,
|
|
8976
|
+
height: height,
|
|
8977
|
+
internalFormat: internalFormat
|
|
8978
|
+
});
|
|
8979
|
+
}
|
|
8323
8980
|
function shouldAutomaticallySetTextureFilteringForSize(options) {
|
|
8324
8981
|
return options.auto === true || options.auto === undefined && options.level === undefined;
|
|
8325
8982
|
}
|
|
@@ -8419,7 +9076,7 @@ function setTextureFromElement(gl, tex, element, options) {
|
|
|
8419
9076
|
size = imgWidth / 2;
|
|
8420
9077
|
slices = [0, 0, 1, 0, 0, 1, 1, 1, 0, 2, 1, 2];
|
|
8421
9078
|
} else {
|
|
8422
|
-
throw "can't figure out cube map from element: "
|
|
9079
|
+
throw new Error("can't figure out cube map from element: ".concat(element.src ? element.src : element.nodeName));
|
|
8423
9080
|
}
|
|
8424
9081
|
var ctx = getShared2DContext();
|
|
8425
9082
|
if (ctx) {
|
|
@@ -8472,7 +9129,7 @@ function setTextureFromElement(gl, tex, element, options) {
|
|
|
8472
9129
|
var largest = Math.max(element.width, element.height);
|
|
8473
9130
|
var depth = largest / smallest;
|
|
8474
9131
|
if (depth % 1 !== 0) {
|
|
8475
|
-
throw "can not compute 3D dimensions of element";
|
|
9132
|
+
throw new Error("can not compute 3D dimensions of element");
|
|
8476
9133
|
}
|
|
8477
9134
|
var xMult = element.width === largest ? 1 : 0;
|
|
8478
9135
|
var yMult = element.height === largest ? 1 : 0;
|
|
@@ -8754,7 +9411,7 @@ function loadCubemapFromUrls(gl, tex, options, callback) {
|
|
|
8754
9411
|
callback = callback || noop;
|
|
8755
9412
|
var urls = options.src;
|
|
8756
9413
|
if (urls.length !== 6) {
|
|
8757
|
-
throw "there must be 6 urls for a cubemap";
|
|
9414
|
+
throw new Error("there must be 6 urls for a cubemap");
|
|
8758
9415
|
}
|
|
8759
9416
|
var level = options.level || 0;
|
|
8760
9417
|
var internalFormat = options.internalFormat || options.format || RGBA;
|
|
@@ -8763,7 +9420,7 @@ function loadCubemapFromUrls(gl, tex, options, callback) {
|
|
|
8763
9420
|
var type = options.type || UNSIGNED_BYTE;
|
|
8764
9421
|
var target = options.target || TEXTURE_2D;
|
|
8765
9422
|
if (target !== TEXTURE_CUBE_MAP) {
|
|
8766
|
-
throw "target must be TEXTURE_CUBE_MAP";
|
|
9423
|
+
throw new Error("target must be TEXTURE_CUBE_MAP");
|
|
8767
9424
|
}
|
|
8768
9425
|
setTextureTo1PixelColor(gl, tex, options);
|
|
8769
9426
|
// Because it's async we need to copy the options.
|
|
@@ -8841,7 +9498,7 @@ function loadSlicesFromUrls(gl, tex, options, callback) {
|
|
|
8841
9498
|
var type = options.type || UNSIGNED_BYTE;
|
|
8842
9499
|
var target = options.target || TEXTURE_2D_ARRAY;
|
|
8843
9500
|
if (target !== TEXTURE_3D && target !== TEXTURE_2D_ARRAY) {
|
|
8844
|
-
throw "target must be TEXTURE_3D or TEXTURE_2D_ARRAY";
|
|
9501
|
+
throw new Error("target must be TEXTURE_3D or TEXTURE_2D_ARRAY");
|
|
8845
9502
|
}
|
|
8846
9503
|
setTextureTo1PixelColor(gl, tex, options);
|
|
8847
9504
|
// Because it's async we need to copy the options.
|
|
@@ -8920,9 +9577,6 @@ function setTextureFromArray(gl, tex, src, options) {
|
|
|
8920
9577
|
options = options || defaults.textureOptions;
|
|
8921
9578
|
var target = options.target || TEXTURE_2D;
|
|
8922
9579
|
gl.bindTexture(target, tex);
|
|
8923
|
-
var width = options.width;
|
|
8924
|
-
var height = options.height;
|
|
8925
|
-
var depth = options.depth;
|
|
8926
9580
|
var level = options.level || 0;
|
|
8927
9581
|
var internalFormat = options.internalFormat || options.format || RGBA;
|
|
8928
9582
|
var formatType = getFormatAndTypeForInternalFormat(internalFormat);
|
|
@@ -8934,61 +9588,123 @@ function setTextureFromArray(gl, tex, src, options) {
|
|
|
8934
9588
|
} else if (src instanceof Uint8ClampedArray) {
|
|
8935
9589
|
src = new Uint8Array(src.buffer);
|
|
8936
9590
|
}
|
|
8937
|
-
var
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
var dimensions;
|
|
8943
|
-
if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
|
|
8944
|
-
if (!width && !height && !depth) {
|
|
8945
|
-
var size = Math.cbrt(numElements);
|
|
8946
|
-
if (size % 1 !== 0) {
|
|
8947
|
-
throw "can't guess cube size of array of numElements: " + numElements;
|
|
8948
|
-
}
|
|
8949
|
-
width = size;
|
|
8950
|
-
height = size;
|
|
8951
|
-
depth = size;
|
|
8952
|
-
} else if (width && (!height || !depth)) {
|
|
8953
|
-
dimensions = guessDimensions(gl, target, height, depth, numElements / width);
|
|
8954
|
-
height = dimensions.width;
|
|
8955
|
-
depth = dimensions.height;
|
|
8956
|
-
} else if (height && (!width || !depth)) {
|
|
8957
|
-
dimensions = guessDimensions(gl, target, width, depth, numElements / height);
|
|
8958
|
-
width = dimensions.width;
|
|
8959
|
-
depth = dimensions.height;
|
|
8960
|
-
} else {
|
|
8961
|
-
dimensions = guessDimensions(gl, target, width, height, numElements / depth);
|
|
8962
|
-
width = dimensions.width;
|
|
8963
|
-
height = dimensions.height;
|
|
8964
|
-
}
|
|
8965
|
-
} else {
|
|
8966
|
-
dimensions = guessDimensions(gl, target, width, height, numElements);
|
|
8967
|
-
width = dimensions.width;
|
|
8968
|
-
height = dimensions.height;
|
|
8969
|
-
}
|
|
9591
|
+
var _getTextureSize = getTextureSize(target, src, options, internalFormat, format, type),
|
|
9592
|
+
width = _getTextureSize.width,
|
|
9593
|
+
height = _getTextureSize.height,
|
|
9594
|
+
depth = _getTextureSize.depth;
|
|
9595
|
+
var compressed = isCompressedInternalFormat(internalFormat);
|
|
8970
9596
|
setSkipStateToDefault(gl);
|
|
8971
9597
|
gl.pixelStorei(UNPACK_ALIGNMENT, options.unpackAlignment || 1);
|
|
9598
|
+
var mipLevelOffset = 0; // this is in addition to level
|
|
8972
9599
|
scopedSetPackState(gl, options, function () {
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
9600
|
+
var mipLevelByteOffset = 0;
|
|
9601
|
+
var _getBlockInfoForInter = getBlockInfoForInternalFormat(internalFormat, type),
|
|
9602
|
+
blockWidth = _getBlockInfoForInter.blockWidth,
|
|
9603
|
+
blockHeight = _getBlockInfoForInter.blockHeight,
|
|
9604
|
+
bytesPerBlock = _getBlockInfoForInter.bytesPerBlock;
|
|
9605
|
+
var _loop = function _loop() {
|
|
9606
|
+
var mipWidth = Math.max(1, width >> mipLevelOffset);
|
|
9607
|
+
var mipHeight = Math.max(1, height >> mipLevelOffset);
|
|
9608
|
+
var mipDepth = target === TEXTURE_2D ? Math.max(1, depth >> mipLevelOffset) : depth;
|
|
9609
|
+
var blocksAcross = Math.ceil(mipWidth / blockWidth);
|
|
9610
|
+
var blocksDown = Math.ceil(mipHeight / blockHeight);
|
|
9611
|
+
var numFaces = target === TEXTURE_CUBE_MAP ? 6 : 1;
|
|
9612
|
+
var bytesPerMipLevel = blocksAcross * blocksDown * bytesPerBlock * mipDepth * numFaces;
|
|
9613
|
+
if (mipLevelByteOffset + bytesPerMipLevel > src.byteLength) {
|
|
9614
|
+
throw new Error('src size does not match number of mip levels');
|
|
9615
|
+
}
|
|
9616
|
+
var mipSource = src.subarray(mipLevelByteOffset / src.BYTES_PER_ELEMENT, (mipLevelByteOffset + bytesPerMipLevel) / src.BYTES_PER_ELEMENT);
|
|
9617
|
+
var mipLevel = level + mipLevelOffset;
|
|
9618
|
+
if (target === TEXTURE_CUBE_MAP) {
|
|
9619
|
+
var faceSize = mipSource.length / 6;
|
|
9620
|
+
getCubeFacesWithNdx(gl, options).forEach(function (f) {
|
|
9621
|
+
var offset = faceSize * f.ndx;
|
|
9622
|
+
var data = mipSource.subarray(offset, offset + faceSize);
|
|
9623
|
+
if (compressed) {
|
|
9624
|
+
gl.compressedTexImage2D(f.face, mipLevel, internalFormat, mipWidth, mipHeight, 0, data);
|
|
9625
|
+
} else {
|
|
9626
|
+
gl.texImage2D(f.face, mipLevel, internalFormat, mipWidth, mipHeight, 0, format, type, data);
|
|
9627
|
+
}
|
|
9628
|
+
});
|
|
9629
|
+
} else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
|
|
9630
|
+
gl.texImage3D(target, mipLevel, internalFormat, mipWidth, mipHeight, mipDepth, 0, format, type, mipSource);
|
|
9631
|
+
} else {
|
|
9632
|
+
if (compressed) {
|
|
9633
|
+
gl.compressedTexImage2D(target, mipLevel, internalFormat, mipWidth, mipHeight, 0, mipSource);
|
|
9634
|
+
} else {
|
|
9635
|
+
gl.texImage2D(target, mipLevel, internalFormat, mipWidth, mipHeight, 0, format, type, mipSource);
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9638
|
+
++mipLevelOffset;
|
|
9639
|
+
mipLevelByteOffset += bytesPerMipLevel;
|
|
9640
|
+
if (mipWidth === 1 && mipHeight === 1 && mipDepth === 1 && mipLevelByteOffset !== src.byteLength) {
|
|
9641
|
+
throw new Error('src size has more data than can fit in mip levels');
|
|
9642
|
+
}
|
|
9643
|
+
};
|
|
9644
|
+
while (mipLevelByteOffset < src.byteLength) {
|
|
9645
|
+
_loop();
|
|
8985
9646
|
}
|
|
8986
9647
|
});
|
|
8987
9648
|
return {
|
|
8988
9649
|
width: width,
|
|
8989
9650
|
height: height,
|
|
8990
9651
|
depth: depth,
|
|
8991
|
-
type: type
|
|
9652
|
+
type: type,
|
|
9653
|
+
lastMipLevelUploaded: level + mipLevelOffset - 1
|
|
9654
|
+
};
|
|
9655
|
+
}
|
|
9656
|
+
function getTextureSize(target, src, options, internalFormat, format, type) {
|
|
9657
|
+
var width = options.width;
|
|
9658
|
+
var height = options.height;
|
|
9659
|
+
var depth = options.depth;
|
|
9660
|
+
var compressed = isCompressedInternalFormat(internalFormat);
|
|
9661
|
+
if (compressed) {
|
|
9662
|
+
if (!width || !height) {
|
|
9663
|
+
throw new Error("compressed texture needs to set width and height!");
|
|
9664
|
+
}
|
|
9665
|
+
depth = depth || 1;
|
|
9666
|
+
} else {
|
|
9667
|
+
var bytesPerElement = getBytesPerElementForInternalFormat(internalFormat, type);
|
|
9668
|
+
var numElements = src.byteLength / bytesPerElement; // TODO: check UNPACK_ALIGNMENT?
|
|
9669
|
+
if (numElements % 1) {
|
|
9670
|
+
throw new Error("length wrong size for format: ".concat(utils.glEnumToString(gl, format)));
|
|
9671
|
+
}
|
|
9672
|
+
if (compressed && (!width || !height)) {
|
|
9673
|
+
throw new Error("compressed texture needs to set width and height!");
|
|
9674
|
+
}
|
|
9675
|
+
var dimensions;
|
|
9676
|
+
if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
|
|
9677
|
+
if (!width && !height && !depth) {
|
|
9678
|
+
var size = Math.cbrt(numElements);
|
|
9679
|
+
if (size % 1 !== 0) {
|
|
9680
|
+
throw new Error("can't guess cube size of array of numElements: ".concat(numElements));
|
|
9681
|
+
}
|
|
9682
|
+
width = size;
|
|
9683
|
+
height = size;
|
|
9684
|
+
depth = size;
|
|
9685
|
+
} else if (width && (!height || !depth)) {
|
|
9686
|
+
dimensions = guessDimensions(gl, target, height, depth, numElements / width);
|
|
9687
|
+
height = dimensions.width;
|
|
9688
|
+
depth = dimensions.height;
|
|
9689
|
+
} else if (height && (!width || !depth)) {
|
|
9690
|
+
dimensions = guessDimensions(gl, target, width, depth, numElements / height);
|
|
9691
|
+
width = dimensions.width;
|
|
9692
|
+
depth = dimensions.height;
|
|
9693
|
+
} else {
|
|
9694
|
+
dimensions = guessDimensions(gl, target, width, height, numElements / depth);
|
|
9695
|
+
width = dimensions.width;
|
|
9696
|
+
height = dimensions.height;
|
|
9697
|
+
}
|
|
9698
|
+
} else {
|
|
9699
|
+
dimensions = guessDimensions(gl, target, width, height, numElements);
|
|
9700
|
+
width = dimensions.width;
|
|
9701
|
+
height = dimensions.height;
|
|
9702
|
+
}
|
|
9703
|
+
}
|
|
9704
|
+
return {
|
|
9705
|
+
width: width,
|
|
9706
|
+
height: height,
|
|
9707
|
+
depth: depth
|
|
8992
9708
|
};
|
|
8993
9709
|
}
|
|
8994
9710
|
|
|
@@ -9061,6 +9777,7 @@ function createTexture(gl, options, callback) {
|
|
|
9061
9777
|
var target = options.target || TEXTURE_2D;
|
|
9062
9778
|
var width = options.width || 1;
|
|
9063
9779
|
var height = options.height || 1;
|
|
9780
|
+
var lastMipLevelUploaded = 0;
|
|
9064
9781
|
var internalFormat = options.internalFormat || RGBA;
|
|
9065
9782
|
gl.bindTexture(target, tex);
|
|
9066
9783
|
if (target === TEXTURE_CUBE_MAP) {
|
|
@@ -9079,6 +9796,7 @@ function createTexture(gl, options, callback) {
|
|
|
9079
9796
|
var dimensions = setTextureFromArray(gl, tex, src, options);
|
|
9080
9797
|
width = dimensions.width;
|
|
9081
9798
|
height = dimensions.height;
|
|
9799
|
+
lastMipLevelUploaded = dimensions.lastMipLevelUploaded;
|
|
9082
9800
|
} else if (Array.isArray(src) && (typeof src[0] === 'string' || isTexImageSource(src[0]))) {
|
|
9083
9801
|
if (target === TEXTURE_CUBE_MAP) {
|
|
9084
9802
|
loadCubemapFromUrls(gl, tex, options, callback);
|
|
@@ -9095,7 +9813,13 @@ function createTexture(gl, options, callback) {
|
|
|
9095
9813
|
setEmptyTexture(gl, tex, options);
|
|
9096
9814
|
}
|
|
9097
9815
|
if (shouldAutomaticallySetTextureFilteringForSize(options)) {
|
|
9098
|
-
|
|
9816
|
+
setTextureFilteringForSizeInternal(gl, tex, {
|
|
9817
|
+
options: options,
|
|
9818
|
+
width: width,
|
|
9819
|
+
height: height,
|
|
9820
|
+
internalFormat: internalFormat,
|
|
9821
|
+
lastMipLevelUploaded: lastMipLevelUploaded
|
|
9822
|
+
});
|
|
9099
9823
|
}
|
|
9100
9824
|
setTextureParameters(gl, tex, options);
|
|
9101
9825
|
return tex;
|
|
@@ -9671,7 +10395,7 @@ function addExtensionToContext(gl, extensionName) {
|
|
|
9671
10395
|
* list.
|
|
9672
10396
|
*
|
|
9673
10397
|
*/
|
|
9674
|
-
var supportedExtensions = ['ANGLE_instanced_arrays', 'EXT_blend_minmax', 'EXT_color_buffer_float', 'EXT_color_buffer_half_float', 'EXT_disjoint_timer_query', 'EXT_disjoint_timer_query_webgl2', 'EXT_frag_depth', 'EXT_sRGB', 'EXT_shader_texture_lod', 'EXT_texture_filter_anisotropic', 'OES_element_index_uint', 'OES_standard_derivatives', 'OES_texture_float', 'OES_texture_float_linear', 'OES_texture_half_float', 'OES_texture_half_float_linear', 'OES_vertex_array_object', 'WEBGL_color_buffer_float', 'WEBGL_compressed_texture_atc', 'WEBGL_compressed_texture_etc1', 'WEBGL_compressed_texture_pvrtc', 'WEBGL_compressed_texture_s3tc', 'WEBGL_compressed_texture_s3tc_srgb', 'WEBGL_depth_texture', 'WEBGL_draw_buffers'];
|
|
10398
|
+
var supportedExtensions = ['ANGLE_instanced_arrays', 'EXT_blend_minmax', 'EXT_color_buffer_float', 'EXT_color_buffer_half_float', 'EXT_disjoint_timer_query', 'EXT_disjoint_timer_query_webgl2', 'EXT_frag_depth', 'EXT_sRGB', 'EXT_shader_texture_lod', 'EXT_texture_compression_bptc', 'EXT_texture_compression_rgtc', 'EXT_texture_filter_anisotropic', 'OES_element_index_uint', 'OES_standard_derivatives', 'OES_texture_float', 'OES_texture_float_linear', 'OES_texture_half_float', 'OES_texture_half_float_linear', 'OES_vertex_array_object', 'WEBGL_color_buffer_float', 'WEBGL_compressed_texture_atc', 'WEBGL_compressed_texture_etc1', 'WEBGL_compressed_texture_etc', 'WEBGL_compressed_texture_pvrtc', 'WEBGL_compressed_texture_s3tc', 'WEBGL_compressed_texture_s3tc_srgb', 'WEBGL_depth_texture', 'WEBGL_draw_buffers'];
|
|
9675
10399
|
|
|
9676
10400
|
/**
|
|
9677
10401
|
* Attempts to enable all of the following extensions
|