UNPKG

@thi.ng/webgl

Version:

WebGL & GLSL abstraction layer

593 lines (592 loc) 15.8 kB
var TextureFormat = /* @__PURE__ */ ((TextureFormat2) => { TextureFormat2[TextureFormat2["ALPHA"] = 6406] = "ALPHA"; TextureFormat2[TextureFormat2["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; TextureFormat2[TextureFormat2["DEPTH_COMPONENT16"] = 33189] = "DEPTH_COMPONENT16"; TextureFormat2[TextureFormat2["DEPTH_COMPONENT24"] = 33190] = "DEPTH_COMPONENT24"; TextureFormat2[TextureFormat2["DEPTH_COMPONENT32F"] = 36012] = "DEPTH_COMPONENT32F"; TextureFormat2[TextureFormat2["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; TextureFormat2[TextureFormat2["DEPTH24_STENCIL8"] = 35056] = "DEPTH24_STENCIL8"; TextureFormat2[TextureFormat2["DEPTH32F_STENCIL8"] = 36013] = "DEPTH32F_STENCIL8"; TextureFormat2[TextureFormat2["LUMINANCE"] = 6409] = "LUMINANCE"; TextureFormat2[TextureFormat2["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; TextureFormat2[TextureFormat2["R11F_G11F_B10F"] = 35898] = "R11F_G11F_B10F"; TextureFormat2[TextureFormat2["R16F"] = 33325] = "R16F"; TextureFormat2[TextureFormat2["R16I"] = 33331] = "R16I"; TextureFormat2[TextureFormat2["R16UI"] = 33332] = "R16UI"; TextureFormat2[TextureFormat2["R32F"] = 33326] = "R32F"; TextureFormat2[TextureFormat2["R32I"] = 33333] = "R32I"; TextureFormat2[TextureFormat2["R32UI"] = 33334] = "R32UI"; TextureFormat2[TextureFormat2["R8"] = 33321] = "R8"; TextureFormat2[TextureFormat2["R8_SNORM"] = 36756] = "R8_SNORM"; TextureFormat2[TextureFormat2["R8I"] = 33329] = "R8I"; TextureFormat2[TextureFormat2["R8UI"] = 33330] = "R8UI"; TextureFormat2[TextureFormat2["RED"] = 6403] = "RED"; TextureFormat2[TextureFormat2["RED_INTEGER"] = 36244] = "RED_INTEGER"; TextureFormat2[TextureFormat2["RG"] = 33319] = "RG"; TextureFormat2[TextureFormat2["RG_INTEGER"] = 33320] = "RG_INTEGER"; TextureFormat2[TextureFormat2["RG16F"] = 33327] = "RG16F"; TextureFormat2[TextureFormat2["RG16I"] = 33337] = "RG16I"; TextureFormat2[TextureFormat2["RG16UI"] = 33338] = "RG16UI"; TextureFormat2[TextureFormat2["RG32F"] = 33328] = "RG32F"; TextureFormat2[TextureFormat2["RG32I"] = 33339] = "RG32I"; TextureFormat2[TextureFormat2["RG32UI"] = 33340] = "RG32UI"; TextureFormat2[TextureFormat2["RG8"] = 33323] = "RG8"; TextureFormat2[TextureFormat2["RG8_SNORM"] = 36757] = "RG8_SNORM"; TextureFormat2[TextureFormat2["RG8I"] = 33335] = "RG8I"; TextureFormat2[TextureFormat2["RG8UI"] = 33336] = "RG8UI"; TextureFormat2[TextureFormat2["RGB"] = 6407] = "RGB"; TextureFormat2[TextureFormat2["RGB_INTEGER"] = 36248] = "RGB_INTEGER"; TextureFormat2[TextureFormat2["RGB10_A2"] = 32857] = "RGB10_A2"; TextureFormat2[TextureFormat2["RGB10_A2UI"] = 36975] = "RGB10_A2UI"; TextureFormat2[TextureFormat2["RGB16F"] = 34843] = "RGB16F"; TextureFormat2[TextureFormat2["RGB16I"] = 36233] = "RGB16I"; TextureFormat2[TextureFormat2["RGB16UI"] = 36215] = "RGB16UI"; TextureFormat2[TextureFormat2["RGB32F"] = 34837] = "RGB32F"; TextureFormat2[TextureFormat2["RGB32I"] = 36227] = "RGB32I"; TextureFormat2[TextureFormat2["RGB32UI"] = 36209] = "RGB32UI"; TextureFormat2[TextureFormat2["RGB5_A1"] = 32855] = "RGB5_A1"; TextureFormat2[TextureFormat2["RGB565"] = 36194] = "RGB565"; TextureFormat2[TextureFormat2["RGB8"] = 32849] = "RGB8"; TextureFormat2[TextureFormat2["RGB8_SNORM"] = 36758] = "RGB8_SNORM"; TextureFormat2[TextureFormat2["RGB8I"] = 36239] = "RGB8I"; TextureFormat2[TextureFormat2["RGB8UI"] = 36221] = "RGB8UI"; TextureFormat2[TextureFormat2["RGB9_E5"] = 35901] = "RGB9_E5"; TextureFormat2[TextureFormat2["RGBA"] = 6408] = "RGBA"; TextureFormat2[TextureFormat2["RGBA_INTEGER"] = 36249] = "RGBA_INTEGER"; TextureFormat2[TextureFormat2["RGBA16F"] = 34842] = "RGBA16F"; TextureFormat2[TextureFormat2["RGBA16I"] = 36232] = "RGBA16I"; TextureFormat2[TextureFormat2["RGBA16UI"] = 36214] = "RGBA16UI"; TextureFormat2[TextureFormat2["RGBA32F"] = 34836] = "RGBA32F"; TextureFormat2[TextureFormat2["RGBA32I"] = 36226] = "RGBA32I"; TextureFormat2[TextureFormat2["RGBA32UI"] = 36208] = "RGBA32UI"; TextureFormat2[TextureFormat2["RGBA4"] = 32854] = "RGBA4"; TextureFormat2[TextureFormat2["RGBA8"] = 32856] = "RGBA8"; TextureFormat2[TextureFormat2["RGBA8_SNORM"] = 36759] = "RGBA8_SNORM"; TextureFormat2[TextureFormat2["RGBA8I"] = 36238] = "RGBA8I"; TextureFormat2[TextureFormat2["RGBA8UI"] = 36220] = "RGBA8UI"; TextureFormat2[TextureFormat2["SRGB8"] = 35905] = "SRGB8"; TextureFormat2[TextureFormat2["SRGB8_ALPHA8"] = 35907] = "SRGB8_ALPHA8"; return TextureFormat2; })(TextureFormat || {}); var TextureType = /* @__PURE__ */ ((TextureType2) => { TextureType2[TextureType2["BYTE"] = 5120] = "BYTE"; TextureType2[TextureType2["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; TextureType2[TextureType2["SHORT"] = 5122] = "SHORT"; TextureType2[TextureType2["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; TextureType2[TextureType2["INT"] = 5124] = "INT"; TextureType2[TextureType2["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT"; TextureType2[TextureType2["FLOAT"] = 5126] = "FLOAT"; TextureType2[TextureType2["HALF_FLOAT"] = 5131] = "HALF_FLOAT"; TextureType2[TextureType2["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; TextureType2[TextureType2["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; TextureType2[TextureType2["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; TextureType2[TextureType2["UNSIGNED_INT_2_10_10_10_REV"] = 33640] = "UNSIGNED_INT_2_10_10_10_REV"; TextureType2[TextureType2["UNSIGNED_INT_24_8"] = 34042] = "UNSIGNED_INT_24_8"; TextureType2[TextureType2["UNSIGNED_INT_10F_11F_11F_REV"] = 35899] = "UNSIGNED_INT_10F_11F_11F_REV"; TextureType2[TextureType2["UNSIGNED_INT_5_9_9_9_REV"] = 35902] = "UNSIGNED_INT_5_9_9_9_REV"; TextureType2[TextureType2["HALF_FLOAT_OES"] = 36193] = "HALF_FLOAT_OES"; TextureType2[TextureType2["FLOAT_32_UNSIGNED_INT_24_8_REV"] = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV"; return TextureType2; })(TextureType || {}); var TextureTarget = /* @__PURE__ */ ((TextureTarget2) => { TextureTarget2[TextureTarget2["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; TextureTarget2[TextureTarget2["TEXTURE_3D"] = 32879] = "TEXTURE_3D"; TextureTarget2[TextureTarget2["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; TextureTarget2[TextureTarget2["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; return TextureTarget2; })(TextureTarget || {}); var TextureFilter = /* @__PURE__ */ ((TextureFilter2) => { TextureFilter2[TextureFilter2["LINEAR"] = 9729] = "LINEAR"; TextureFilter2[TextureFilter2["NEAREST"] = 9728] = "NEAREST"; TextureFilter2[TextureFilter2["NEAREST_MIPMAP_NEAREST"] = 9984] = "NEAREST_MIPMAP_NEAREST"; TextureFilter2[TextureFilter2["LINEAR_MIPMAP_NEAREST"] = 9985] = "LINEAR_MIPMAP_NEAREST"; TextureFilter2[TextureFilter2["NEAREST_MIPMAP_LINEAR"] = 9986] = "NEAREST_MIPMAP_LINEAR"; TextureFilter2[TextureFilter2["LINEAR_MIPMAP_LINEAR"] = 9987] = "LINEAR_MIPMAP_LINEAR"; return TextureFilter2; })(TextureFilter || {}); var TextureRepeat = /* @__PURE__ */ ((TextureRepeat2) => { TextureRepeat2[TextureRepeat2["REPEAT"] = 10497] = "REPEAT"; TextureRepeat2[TextureRepeat2["CLAMP"] = 33071] = "CLAMP"; TextureRepeat2[TextureRepeat2["REPEAT_MIRROR"] = 33648] = "REPEAT_MIRROR"; return TextureRepeat2; })(TextureRepeat || {}); const $ = (format, types, num, render = false, filter = false, renderExt = render) => ({ format, types, render, renderExt, filter, num }); const TEX_FORMATS = { [6406 /* ALPHA */]: $( 6406 /* ALPHA */, [ 5121 /* UNSIGNED_BYTE */, 1, 5131 /* HALF_FLOAT */, 2, 36193 /* HALF_FLOAT_OES */, 2, 5126 /* FLOAT */, 4 ], 1, true, true ), [6402 /* DEPTH_COMPONENT */]: $( 6402 /* DEPTH_COMPONENT */, [5123 /* UNSIGNED_SHORT */, 2, 5125 /* UNSIGNED_INT */, 4], 1, true ), [33189 /* DEPTH_COMPONENT16 */]: $( 6402 /* DEPTH_COMPONENT */, [5123 /* UNSIGNED_SHORT */, 2, 5125 /* UNSIGNED_INT */, 4], 1, true ), [33190 /* DEPTH_COMPONENT24 */]: $( 6402 /* DEPTH_COMPONENT */, [5125 /* UNSIGNED_INT */, 4], 1, true ), [36012 /* DEPTH_COMPONENT32F */]: $( 6402 /* DEPTH_COMPONENT */, [5126 /* FLOAT */, 4], 1, true ), [34041 /* DEPTH_STENCIL */]: $( 34041 /* DEPTH_STENCIL */, [34042 /* UNSIGNED_INT_24_8 */, 4], 1, true ), [35056 /* DEPTH24_STENCIL8 */]: $( 34041 /* DEPTH_STENCIL */, [34042 /* UNSIGNED_INT_24_8 */, 4], 1, true ), [36013 /* DEPTH32F_STENCIL8 */]: $( 34041 /* DEPTH_STENCIL */, [36269 /* FLOAT_32_UNSIGNED_INT_24_8_REV */, 4], 1, true ), [6410 /* LUMINANCE_ALPHA */]: $( 6410 /* LUMINANCE_ALPHA */, [ 5121 /* UNSIGNED_BYTE */, 2, 5131 /* HALF_FLOAT */, 4, 36193 /* HALF_FLOAT_OES */, 4, 5126 /* FLOAT */, 8 ], 2, true, true ), [6409 /* LUMINANCE */]: $( 6409 /* LUMINANCE */, [ 5121 /* UNSIGNED_BYTE */, 1, 5131 /* HALF_FLOAT */, 2, 36193 /* HALF_FLOAT_OES */, 2, 5126 /* FLOAT */, 4 ], 1, true, true ), [35898 /* R11F_G11F_B10F */]: $( 6407 /* RGB */, [ 5126 /* FLOAT */, 12, 5131 /* HALF_FLOAT */, 6, 35899 /* UNSIGNED_INT_10F_11F_11F_REV */, 4 ], 3, false, true, true ), [33325 /* R16F */]: $( 6403 /* RED */, [5126 /* FLOAT */, 4, 5131 /* HALF_FLOAT */, 2], 1, false, true, true ), [33331 /* R16I */]: $( 36244 /* RED_INTEGER */, [5122 /* SHORT */, 2], 1, true ), [33332 /* R16UI */]: $( 36244 /* RED_INTEGER */, [5123 /* UNSIGNED_SHORT */, 2], 1, true ), [33326 /* R32F */]: $( 6403 /* RED */, [5126 /* FLOAT */, 4], 1, false, false, true ), [33333 /* R32I */]: $( 36244 /* RED_INTEGER */, [5124 /* INT */, 4], 1, true ), [33334 /* R32UI */]: $( 36244 /* RED_INTEGER */, [5125 /* UNSIGNED_INT */, 4], 1, true ), [36756 /* R8_SNORM */]: $( 6403 /* RED */, [5120 /* BYTE */, 1], 1, false, true ), [33321 /* R8 */]: $( 6403 /* RED */, [5121 /* UNSIGNED_BYTE */, 1], 1, true, true ), [33329 /* R8I */]: $( 36244 /* RED_INTEGER */, [5120 /* BYTE */, 1], 1, true ), [33330 /* R8UI */]: $( 36244 /* RED_INTEGER */, [5121 /* UNSIGNED_BYTE */, 1], 1, true ), [33327 /* RG16F */]: $( 33319 /* RG */, [5126 /* FLOAT */, 8, 5131 /* HALF_FLOAT */, 4], 2, false, true, true ), [33337 /* RG16I */]: $( 33320 /* RG_INTEGER */, [5122 /* SHORT */, 4], 2, true ), [33338 /* RG16UI */]: $( 33320 /* RG_INTEGER */, [5123 /* UNSIGNED_SHORT */, 4], 2, true ), [33328 /* RG32F */]: $( 33319 /* RG */, [5126 /* FLOAT */, 8], 2, false, false, true ), [33339 /* RG32I */]: $( 33320 /* RG_INTEGER */, [5124 /* INT */, 8], 2, true ), [33340 /* RG32UI */]: $( 33320 /* RG_INTEGER */, [5125 /* UNSIGNED_INT */, 8], 2, true ), [36757 /* RG8_SNORM */]: $( 33319 /* RG */, [5120 /* BYTE */, 2], 2, false, true ), [33323 /* RG8 */]: $( 33319 /* RG */, [5121 /* UNSIGNED_BYTE */, 2], 2, true, true ), [33335 /* RG8I */]: $( 33320 /* RG_INTEGER */, [5120 /* BYTE */, 2], 2, true ), [33336 /* RG8UI */]: $( 33320 /* RG_INTEGER */, [5121 /* UNSIGNED_BYTE */, 2], 2, true ), [6407 /* RGB */]: $( 6407 /* RGB */, [ 5121 /* UNSIGNED_BYTE */, 3, 5131 /* HALF_FLOAT */, 6, 36193 /* HALF_FLOAT_OES */, 6, 5126 /* FLOAT */, 12, 33635 /* UNSIGNED_SHORT_5_6_5 */, 2 ], 3, true, true ), [32857 /* RGB10_A2 */]: $( 6408 /* RGBA */, [33640 /* UNSIGNED_INT_2_10_10_10_REV */, 4], 4, true, true ), [36975 /* RGB10_A2UI */]: $( 36249 /* RGBA_INTEGER */, [33640 /* UNSIGNED_INT_2_10_10_10_REV */, 4], 4, true ), [34843 /* RGB16F */]: $( 6407 /* RGB */, [5126 /* FLOAT */, 12, 5131 /* HALF_FLOAT */, 6], 3, false, true ), [36233 /* RGB16I */]: $( 36248 /* RGB_INTEGER */, [5122 /* SHORT */, 6], 3 ), [36215 /* RGB16UI */]: $( 36248 /* RGB_INTEGER */, [5123 /* UNSIGNED_SHORT */, 6], 3 ), [34837 /* RGB32F */]: $(6407 /* RGB */, [5126 /* FLOAT */, 12], 3), [36227 /* RGB32I */]: $( 36248 /* RGB_INTEGER */, [5124 /* INT */, 12], 3 ), [36209 /* RGB32UI */]: $( 36248 /* RGB_INTEGER */, [5125 /* UNSIGNED_INT */, 12], 3 ), [32855 /* RGB5_A1 */]: $( 6408 /* RGBA */, [ 5121 /* UNSIGNED_BYTE */, 4, 32820 /* UNSIGNED_SHORT_5_5_5_1 */, 2, 33640 /* UNSIGNED_INT_2_10_10_10_REV */, 4 ], 4, true, true ), [36194 /* RGB565 */]: $( 6407 /* RGB */, [5121 /* UNSIGNED_BYTE */, 3, 33635 /* UNSIGNED_SHORT_5_6_5 */, 2], 3, true, true ), [36758 /* RGB8_SNORM */]: $( 6407 /* RGB */, [5120 /* BYTE */, 3], 3, false, true ), [32849 /* RGB8 */]: $( 6407 /* RGB */, [5121 /* UNSIGNED_BYTE */, 3], 3, true, true ), [36239 /* RGB8I */]: $( 36248 /* RGB_INTEGER */, [5120 /* BYTE */, 3], 3 ), [36221 /* RGB8UI */]: $( 36248 /* RGB_INTEGER */, [5121 /* UNSIGNED_BYTE */, 3], 3 ), [35901 /* RGB9_E5 */]: $( 6407 /* RGB */, [ 5126 /* FLOAT */, 12, 5131 /* HALF_FLOAT */, 6, 35902 /* UNSIGNED_INT_5_9_9_9_REV */, 4 ], 3, false, true ), [6408 /* RGBA */]: $( 6408 /* RGBA */, [ 5121 /* UNSIGNED_BYTE */, 4, 5131 /* HALF_FLOAT */, 8, 36193 /* HALF_FLOAT_OES */, 8, 5126 /* FLOAT */, 16, 32819 /* UNSIGNED_SHORT_4_4_4_4 */, 2, 32820 /* UNSIGNED_SHORT_5_5_5_1 */, 2 ], 4, true, true ), [34842 /* RGBA16F */]: $( 6408 /* RGBA */, [5126 /* FLOAT */, 16, 5131 /* HALF_FLOAT */, 8], 4, false, true, true ), [36232 /* RGBA16I */]: $( 36249 /* RGBA_INTEGER */, [5122 /* SHORT */, 8], 4, true ), [36214 /* RGBA16UI */]: $( 36249 /* RGBA_INTEGER */, [5123 /* UNSIGNED_SHORT */, 8], 4, true ), [34836 /* RGBA32F */]: $( 6408 /* RGBA */, [5126 /* FLOAT */, 16], 4, false, false, true ), [36226 /* RGBA32I */]: $( 36249 /* RGBA_INTEGER */, [5124 /* INT */, 16], 4, true ), [36208 /* RGBA32UI */]: $( 36249 /* RGBA_INTEGER */, [5125 /* UNSIGNED_INT */, 16], 4, true ), [32854 /* RGBA4 */]: $( 6408 /* RGBA */, [5121 /* UNSIGNED_BYTE */, 4, 32819 /* UNSIGNED_SHORT_4_4_4_4 */, 2], 4, true, true ), [36759 /* RGBA8_SNORM */]: $( 6408 /* RGBA */, [5120 /* BYTE */, 4], 4, false, true ), [32856 /* RGBA8 */]: $( 6408 /* RGBA */, [5121 /* UNSIGNED_BYTE */, 4], 4, true, true ), [36238 /* RGBA8I */]: $( 36249 /* RGBA_INTEGER */, [5120 /* BYTE */, 4], 4, true ), [36220 /* RGBA8UI */]: $( 36249 /* RGBA_INTEGER */, [5121 /* UNSIGNED_BYTE */, 4], 4, true ), [35907 /* SRGB8_ALPHA8 */]: $( 6408 /* RGBA */, [5121 /* UNSIGNED_BYTE */, 4], 4, true, true ), [35905 /* SRGB8 */]: $( 6407 /* RGB */, [5121 /* UNSIGNED_BYTE */, 3], 3, false, true ) }; export { TEX_FORMATS, TextureFilter, TextureFormat, TextureRepeat, TextureTarget, TextureType };