-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpicogl.min.js
26 lines (20 loc) · 52.5 KB
/
picogl.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
PicoGL.js v0.8.7
The MIT License (MIT)
Copyright (c) 2017 Tarek Sherif
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.PicoGL=e():t.PicoGL=e()}(this,function(){return function(t){function e(_){if(E[_])return E[_].exports;var i=E[_]={i:_,l:!1,exports:{}};return t[_].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var E={};return e.m=t,e.c=E,e.d=function(t,E,_){e.o(t,E)||Object.defineProperty(t,E,{configurable:!1,enumerable:!0,get:_})},e.n=function(t){var E=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(E,"a",E),E},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=4)}([function(t,e,E){"use strict";let _=document.createElement("canvas").getContext("webgl2");const i={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,TIMEOUT_IGNORED:-1,MAX_CLIENT_WAIT_TIMEOUT_WEBGL:37447,QUERY_COUNTER_BITS_EXT:34916,TIME_ELAPSED_EXT:35007,TIMESTAMP_EXT:36392,GPU_DISJOINT_EXT:36795,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_KHR:37808,COMPRESSED_RGBA_ASTC_5x4_KHR:37809,COMPRESSED_RGBA_ASTC_5x5_KHR:37810,COMPRESSED_RGBA_ASTC_6x5_KHR:37811,COMPRESSED_RGBA_ASTC_6x6_KHR:37812,COMPRESSED_RGBA_ASTC_8x5_KHR:37813,COMPRESSED_RGBA_ASTC_8x6_KHR:37814,COMPRESSED_RGBA_ASTC_8x8_KHR:37815,COMPRESSED_RGBA_ASTC_10x5_KHR:37816,COMPRESSED_RGBA_ASTC_10x6_KHR:37817,COMPRESSED_RGBA_ASTC_10x8_KHR:37818,COMPRESSED_RGBA_ASTC_10x10_KHR:37819,COMPRESSED_RGBA_ASTC_12x10_KHR:37820,COMPRESSED_RGBA_ASTC_12x12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:37853,TYPE_SIZE:{[_.BYTE]:1,[_.UNSIGNED_BYTE]:1,[_.SHORT]:2,[_.UNSIGNED_SHORT]:2,[_.INT]:4,[_.UNSIGNED_INT]:4,[_.FLOAT]:4},WEBGL_INFO:{MAX_TEXTURE_UNITS:_.getParameter(_.MAX_COMBINED_TEXTURE_IMAGE_UNITS),MAX_UNIFORM_BUFFERS:_.getParameter(_.MAX_UNIFORM_BUFFER_BINDINGS)},DUMMY_OBJECT:{}};t.exports=i},function(t,e,E){"use strict";const _=E(0),i={[_.UNSIGNED_BYTE]:{[_.RED]:_.R8,[_.RG]:_.RG8,[_.RGB]:_.RGB8,[_.RGBA]:_.RGBA8},[_.UNSIGNED_SHORT]:{[_.DEPTH_COMPONENT]:_.DEPTH_COMPONENT16},[_.FLOAT]:{[_.RED]:_.R16F,[_.RG]:_.RG16F,[_.RGB]:_.RGB16F,[_.RGBA]:_.RGBA16F,[_.DEPTH_COMPONENT]:_.DEPTH_COMPONENT32F},COMPRESSED_TYPES:{}};t.exports=i},function(t,e,E){"use strict";class _{constructor(t,e,E){if(this.gl=t,this.shader=t.createShader(e),t.shaderSource(this.shader,E),t.compileShader(this.shader),!t.getShaderParameter(this.shader,t.COMPILE_STATUS)){let e,_;for(console.error(t.getShaderInfoLog(this.shader)),_=E.split("\n"),e=0;e<_.length;++e)console.error(`${e+1}: ${_[e]}`)}}delete(){this.shader&&(this.gl.deleteShader(this.shader),this.shader=null)}}t.exports=_},function(t,e,E){"use strict";class _{constructor(t,e){this.gl=t,this.query=t.createQuery(),this.target=e,this.active=!1,this.result=null}begin(){this.active||(this.gl.beginQuery(this.target,this.query),this.result=null)}end(){this.active||(this.gl.endQuery(this.target),this.active=!0)}ready(){return!(!this.active||!this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT_AVAILABLE))&&(this.active=!1,this.result=Number(this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT)),!0)}}t.exports=_},function(t,e,E){"use strict";const _=E(5),i=E(0);i.version="0.8.7",i.createApp=function(t,e){return new _(t,e)},t.exports=i},function(t,e,E){"use strict";const _=E(0),i=E(1),r=E(6),s=E(7),T=E(8),R=E(9),A=E(2),S=E(11),h=E(12),a=E(13),n=E(14),N=E(15),u=E(16),M=E(3);class I{constructor(t,e){this.canvas=t,this.gl=t.getContext("webgl2",e),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this.viewportX=0,this.viewportY=0,this.viewportWidth=0,this.viewportHeight=0,this.currentDrawCalls=null,this.emptyFragmentShader=null,this.state={program:null,vertexArray:null,transformFeedback:null,activeTexture:-1,textures:new Array(_.WEBGL_INFO.MAX_TEXTURE_UNITS),uniformBuffers:new Array(_.WEBGL_INFO.MAX_UNIFORM_BUFFERS),freeUniformBufferBases:[],drawFramebuffer:null,readFramebuffer:null},this.clearBits=this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT,this.cpuTime=0,this.gpuTime=0,this.floatRenderTargetsEnabled=!1,this.linearFloatTexturesEnabled=!1,this.s3tcTexturesEnabled=!1,this.s3tcSRGBTexturesEnabled=!1,this.etcTexturesEnabled=!1,this.astcTexturesEnabled=!1,this.pvrtcTexturesEnabled=!1,this.viewport(0,0,this.width,this.height)}colorMask(t,e,E,_){return this.gl.colorMask(t,e,E,_),this}clearColor(t,e,E,_){return this.gl.clearColor(t,e,E,_),this}clearMask(t){return this.clearBits=t,this}clear(){return this.gl.clear(this.clearBits),this}drawFramebuffer(t){return t.bindForDraw(),this}readFramebuffer(t){return t.bindForRead(),this}defaultDrawFramebuffer(){return null!==this.state.drawFramebuffer&&(this.gl.bindFramebuffer(this.gl.DRAW_FRAMEBUFFER,null),this.state.drawFramebuffer=null),this}defaultReadFramebuffer(){return null!==this.state.readFramebuffer&&(this.gl.bindFramebuffer(this.gl.READ_FRAMEBUFFER,null),this.state.readFramebuffer=null),this}depthRange(t,e){return this.gl.depthRange(t,e),this}depthTest(){return this.gl.enable(this.gl.DEPTH_TEST),this}noDepthTest(){return this.gl.disable(this.gl.DEPTH_TEST),this}depthMask(t){return this.gl.depthMask(t),this}depthFunc(t){return this.gl.depthFunc(t),this}blend(){return this.gl.enable(this.gl.BLEND),this}noBlend(){return this.gl.disable(this.gl.BLEND),this}blendFunc(t,e){return this.gl.blendFunc(t,e),this}blendFuncSeparate(t,e,E,_){return this.gl.blendFuncSeparate(t,e,E,_),this}stencilTest(){return this.gl.enable(this.gl.STENCIL_TEST),this}noStencilTest(){return this.gl.disable(this.gl.STENCIL_TEST),this}scissorTest(){return this.gl.enable(this.gl.SCISSOR_TEST),this}noScissorTest(){return this.gl.disable(this.gl.SCISSOR_TEST),this}scissor(t,e,E,_){return this.gl.scissor(t,e,E,_),this}stencilMask(t){return this.gl.stencilMask(t),this}stencilMaskSeparate(t,e){return this.gl.stencilMaskSeparate(t,e),this}stencilFunc(t,e,E){return this.gl.stencilFunc(t,e,E),this}stencilFuncSeparate(t,e,E,_){return this.gl.stencilFuncSeparate(t,e,E,_),this}stencilOp(t,e,E){return this.gl.stencilOp(t,e,E),this}stencilOpSeparate(t,e,E,_){return this.gl.stencilOpSeparate(t,e,E,_),this}rasterize(){return this.gl.disable(this.gl.RASTERIZER_DISCARD),this}noRasterize(){return this.gl.enable(this.gl.RASTERIZER_DISCARD),this}cullBackfaces(){return this.gl.enable(this.gl.CULL_FACE),this}drawBackfaces(){return this.gl.disable(this.gl.CULL_FACE),this}floatRenderTargets(){return this.floatRenderTargetsEnabled=!!this.gl.getExtension("EXT_color_buffer_float"),this}linearFloatTextures(){return this.linearFloatTexturesEnabled=!!this.gl.getExtension("OES_texture_float_linear"),this}s3tcTextures(){let t=this.gl.getExtension("WEBGL_compressed_texture_s3tc");return this.s3tcTexturesEnabled=!!t,this.s3tcTexturesEnabled&&(i.COMPRESSED_TYPES[_.COMPRESSED_RGB_S3TC_DXT1_EXT]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_S3TC_DXT1_EXT]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_S3TC_DXT3_EXT]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_S3TC_DXT5_EXT]=!0),t=this.gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),this.s3tcSRGBTexturesEnabled=!!t,this.s3tcSRGBTexturesEnabled&&(i.COMPRESSED_TYPES[_.COMPRESSED_SRGB_S3TC_DXT1_EXT]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=!0),this}etcTextures(){let t=this.gl.getExtension("WEBGL_compressed_texture_etc");return this.etcTexturesEnabled=!!t,this.etcTexturesEnabled&&(i.COMPRESSED_TYPES[_.COMPRESSED_R11_EAC]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SIGNED_R11_EAC]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RG11_EAC]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SIGNED_RG11_EAC]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGB8_ETC2]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ETC2]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA8_ETC2_EAC]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=!0),this}astcTextures(){let t=this.gl.getExtension("WEBGL_compressed_texture_astc");return this.astcTexturesEnabled=!!t,this.astcTexturesEnabled&&(i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_4x4_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_5x4_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_5x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_6x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_6x6_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_8x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_8x6_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_8x8_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_10x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_10x6_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_10x8_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_10x10_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_12x10_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_ASTC_12x12_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR]=!0),this}pvrtcTextures(){let t=this.gl.getExtension("WEBGL_compressed_texture_pvrtc");return this.pvrtcTexturesEnabled=!!t,this.pvrtcTexturesEnabled&&(i.COMPRESSED_TYPES[_.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=!0,i.COMPRESSED_TYPES[_.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=!0),this}readPixel(t,e,E,i=_.DUMMY_OBJECT){let{format:r=_.RGBA,type:s=_.UNSIGNED_BYTE}=i;return this.gl.readPixels(t,e,1,1,r,s,E),this}viewport(t,e,E,_){return this.viewportWidth===E&&this.viewportHeight===_&&this.viewportX===t&&this.viewportY===e||(this.viewportX=t,this.viewportY=e,this.viewportWidth=E,this.viewportHeight=_,this.gl.viewport(t,e,this.viewportWidth,this.viewportHeight)),this}defaultViewport(){return this.viewport(0,0,this.width,this.height),this}resize(t,e){return this.canvas.width=t,this.canvas.height=e,this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this.viewport(0,0,this.width,this.height),this}createProgram(t,e,E){return new R(this.gl,this.state,t,e,E)}createShader(t,e){return new A(this.gl,t,e)}createVertexArray(){return new N(this.gl,this.state)}createTransformFeedback(){return new a(this.gl,this.state)}createVertexBuffer(t,e,E,_){return new u(this.gl,this.state,t,e,E,_)}createMatrixBuffer(t,e,E){return new u(this.gl,this.state,t,0,e,E)}createIndexBuffer(t,e,E,_){return new u(this.gl,this.state,t,e,E,_,!0)}createUniformBuffer(t,e){return new n(this.gl,this.state,t,e)}createTexture2D(t,e,E,_){return"number"==typeof t?(_=E,E=e,e=t,t=null):void 0===E&&(_=e,e=t.width,E=t.height),new S(this.gl,this.state,this.gl.TEXTURE_2D,t,e,E,void 0,!1,_)}createTextureArray(t,e,E,_,i){return"number"==typeof t&&(i=_,_=E,E=e,e=t,t=null),new S(this.gl,this.state,this.gl.TEXTURE_2D_ARRAY,t,e,E,_,!0,i)}createTexture3D(t,e,E,_,i){return"number"==typeof t&&(i=_,_=E,E=e,e=t,t=null),new S(this.gl,this.state,this.gl.TEXTURE_3D,t,e,E,_,!0,i)}createCubemap(t){return new r(this.gl,this.state,t)}createFramebuffer(){return new T(this.gl,this.state)}createQuery(t){return new M(this.gl,t)}createTimer(){return new h(this.gl)}createDrawCall(t,e,E){return new s(this.gl,this.state,t,e,E)}}t.exports=I},function(t,e,E){"use strict";const _=E(0),i=E(1);class r{constructor(t,e,E){let{negX:r,posX:s,negY:T,posY:R,negZ:A,posZ:S}=E,h=E.format===_.DEPTH_COMPONENT?_.UNSIGNED_SHORT:_.UNSIGNED_BYTE;this.gl=t,this.texture=t.createTexture(),this.format=void 0!==E.format?E.format:t.RGBA,this.type=void 0!==E.type?E.type:h,this.internalFormat=void 0!==E.internalFormat?E.internalFormat:i[this.type][this.format],this.appState=e,this.currentUnit=-1;let{width:a=r.width,height:n=r.height,flipY:N=!1,minFilter:u=(r?t.LINEAR_MIPMAP_NEAREST:t.NEAREST),magFilter:M=(r?t.LINEAR:t.NEAREST),wrapS:I=t.REPEAT,wrapT:C=t.REPEAT,compareMode:l=t.NONE,compareFunc:O=t.LEQUAL,generateMipmaps:F=u===t.LINEAR_MIPMAP_NEAREST||u===t.LINEAR_MIPMAP_LINEAR}=E;this.bind(0),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,N),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,M),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,u),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,I),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,C),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_COMPARE_FUNC,O),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_COMPARE_MODE,l),void 0!==E.baseLevel&&t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_BASE_LEVEL,E.baseLevel),void 0!==E.maxLevel&&t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAX_LEVEL,E.maxLevel),void 0!==E.minLOD&&t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_LOD,E.minLOD),void 0!==E.maxLOD&&t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAX_LOD,E.maxLOD);let P=F?Math.floor(Math.log2(Math.min(a,n)))+1:1;t.texStorage2D(t.TEXTURE_CUBE_MAP,P,this.internalFormat,a,n),r&&(t.texSubImage2D(t.TEXTURE_CUBE_MAP_NEGATIVE_X,0,0,0,a,n,this.format,this.type,r),t.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X,0,0,0,a,n,this.format,this.type,s),t.texSubImage2D(t.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,0,0,a,n,this.format,this.type,T),t.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_Y,0,0,0,a,n,this.format,this.type,R),t.texSubImage2D(t.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,0,0,a,n,this.format,this.type,A),t.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_Z,0,0,0,a,n,this.format,this.type,S)),F&&t.generateMipmap(t.TEXTURE_CUBE_MAP)}delete(){this.texture&&(this.gl.deleteTexture(this.texture),this.texture=null,this.appState.textures[this.currentUnit]=null,this.currentUnit=-1)}bind(t){let e=this.appState.textures[t];return e!==this&&(e&&(e.currentUnit=-1),-1!==this.currentUnit&&(this.appState.textures[this.currentUnit]=null),this.gl.activeTexture(this.gl.TEXTURE0+t),this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP,this.texture),this.appState.textures[t]=this,this.currentUnit=t),this}}t.exports=r},function(t,e,E){"use strict";const _=E(0);class i{constructor(t,e,E,i,r=_.TRIANGLES){this.gl=t,this.currentProgram=E,this.currentVertexArray=i,this.currentTransformFeedback=null,this.appState=e,this.uniformIndices={},this.uniformNames=new Array(_.WEBGL_INFO.MAX_UNIFORMS),this.uniformValues=new Array(_.WEBGL_INFO.MAX_UNIFORMS),this.uniformCount=0,this.uniformBuffers=new Array(_.WEBGL_INFO.MAX_UNIFORM_BUFFERS),this.uniformBlockNames=new Array(_.WEBGL_INFO.MAX_UNIFORM_BUFFERS),this.uniformBlockBases={},this.uniformBlockCount=0,this.samplerIndices={},this.textures=new Array(_.WEBGL_INFO.MAX_TEXTURE_UNITS),this.textureCount=0,this.primitive=r}transformFeedback(t){return this.currentTransformFeedback=t,this}uniform(t,e){let E=this.uniformIndices[t];return void 0===E&&(E=this.uniformCount++,this.uniformIndices[t]=E,this.uniformNames[E]=t),this.uniformValues[E]=e,this}texture(t,e){let E=this.currentProgram.samplers[t];return this.textures[E]=e,this}uniformBlock(t,e){let E=this.currentProgram.uniformBlocks[t];return this.uniformBuffers[E]=e,this}draw(){let t=this.uniformNames,e=this.uniformValues,E=this.uniformBuffers,_=this.currentProgram.uniformBlockCount,i=this.textures,r=this.currentProgram.samplerCount;this.currentProgram.bind(),this.currentVertexArray.bind();for(let E=0;E<this.uniformCount;++E)this.currentProgram.uniform(t[E],e[E]);for(let t=0;t<_;++t)E[t].bind(t);for(let t=0;t<r;++t)i[t].bind(t);if(this.currentTransformFeedback&&(this.currentTransformFeedback.bind(),this.gl.beginTransformFeedback(this.primitive)),this.currentVertexArray.instanced?this.currentVertexArray.indexed?this.gl.drawElementsInstanced(this.primitive,this.currentVertexArray.numElements,this.currentVertexArray.indexType,0,this.currentVertexArray.numInstances):this.gl.drawArraysInstanced(this.primitive,0,this.currentVertexArray.numElements,this.currentVertexArray.numInstances):this.currentVertexArray.indexed?this.gl.drawElements(this.primitive,this.currentVertexArray.numElements,this.currentVertexArray.indexType,0):this.gl.drawArrays(this.primitive,0,this.currentVertexArray.numElements),this.currentTransformFeedback){this.gl.endTransformFeedback();for(let t=0,e=this.currentTransformFeedback.angleBugBuffers.length;t<e;++t)this.gl.bindBufferBase(this.gl.TRANSFORM_FEEDBACK_BUFFER,t,null)}}}t.exports=i},function(t,e,E){"use strict";const _=E(0);class i{constructor(t,e){this.gl=t,this.framebuffer=t.createFramebuffer(),this.appState=e,this.numColorTargets=0,this.colorTextures=[],this.colorAttachments=[],this.colorTextureTargets=[],this.depthTexture=null,this.depthTextureTarget=null}colorTarget(t,e,E=(e.is3D?0:_.TEXTURE_2D)){this.colorAttachments[t]=_.COLOR_ATTACHMENT0+t;let i=this.bindAndCaptureState();return this.colorTextures[t]=e,this.colorTextureTargets[t]=E,e.is3D?this.gl.framebufferTextureLayer(this.gl.DRAW_FRAMEBUFFER,this.colorAttachments[t],e.texture,0,E):this.gl.framebufferTexture2D(this.gl.DRAW_FRAMEBUFFER,this.colorAttachments[t],E,e.texture,0),this.gl.drawBuffers(this.colorAttachments),this.numColorTargets++,this.restoreState(i),this}depthTarget(t,e=(t.is3D?0:_.TEXTURE_2D)){let E=this.bindAndCaptureState();return this.depthTexture=t,this.depthTextureTarget=e,t.is3D?this.gl.framebufferTextureLayer(this.gl.DRAW_FRAMEBUFFER,_.DEPTH_ATTACHMENT,t.texture,0,e):this.gl.framebufferTexture2D(this.gl.DRAW_FRAMEBUFFER,_.DEPTH_ATTACHMENT,e,t.texture,0),this.restoreState(E),this}resize(t=this.gl.drawingBufferWidth,e=this.gl.drawingBufferHeight,E){let i=this.bindAndCaptureState();for(let _=0;_<this.numColorTargets;++_){var r=this.colorTextures[_];r.resize(t,e,E),r.is3D?this.gl.framebufferTextureLayer(this.gl.DRAW_FRAMEBUFFER,this.colorAttachments[_],r.texture,0,this.colorTextureTargets[_]):this.gl.framebufferTexture2D(this.gl.DRAW_FRAMEBUFFER,this.colorAttachments[_],this.colorTextureTargets[_],r.texture,0)}return this.depthTexture&&(this.depthTexture.resize(t,e,E),this.depthTexture.is3D?this.gl.framebufferTextureLayer(this.gl.DRAW_FRAMEBUFFER,_.DEPTH_ATTACHMENT,this.depthTexture.texture,0,this.depthTextureTarget):this.gl.framebufferTexture2D(this.gl.DRAW_FRAMEBUFFER,_.DEPTH_ATTACHMENT,this.depthTextureTarget,this.depthTexture.texture,0)),this.restoreState(i),this}delete(){this.framebuffer&&(this.gl.deleteFramebuffer(this.framebuffer),this.framebuffer=null)}bindForDraw(){this.appState.drawFramebuffer!==this&&(this.gl.bindFramebuffer(this.gl.DRAW_FRAMEBUFFER,this.framebuffer),this.appState.drawFramebuffer=this)}bindForRead(){this.appState.readFramebuffer!==this&&(this.gl.bindFramebuffer(this.gl.READ_FRAMEBUFFER,this.framebuffer),this.appState.readFramebuffer=this)}bindAndCaptureState(){let t=this.appState.drawFramebuffer;return t!==this&&this.gl.bindFramebuffer(this.gl.DRAW_FRAMEBUFFER,this.framebuffer),t}restoreState(t){t!==this&&this.gl.bindFramebuffer(this.gl.DRAW_FRAMEBUFFER,t?t.framebuffer:null)}}t.exports=i},function(t,e,E){"use strict";const _=E(0),i=E(2),r=E(10),s=r.SingleComponentUniform,T=r.MultiNumericUniform,R=r.MultiBoolUniform,A=r.MatrixUniform;class S{constructor(t,e,E,r,S){let h,a,n,N=!1,u=!1;"string"==typeof E?(a=new i(t,t.VERTEX_SHADER,E),N=!0):a=E,"string"==typeof r?(n=new i(t,t.FRAGMENT_SHADER,r),u=!0):n=r;let M=t.createProgram();t.attachShader(M,a.shader),t.attachShader(M,n.shader),S&&t.transformFeedbackVaryings(M,S,t.SEPARATE_ATTRIBS),t.linkProgram(M),t.getProgramParameter(M,t.LINK_STATUS)||console.error(t.getProgramInfoLog(M)),N&&a.delete(),u&&n.delete(),this.gl=t,this.program=M,this.appState=e,this.transformFeedback=!!S,this.uniforms={},this.uniformBlocks={},this.uniformBlockCount=0,this.samplers={},this.samplerCount=0,t.useProgram(M);let I,C=t.getProgramParameter(M,t.ACTIVE_UNIFORMS);for(h=0;h<C;++h){let e=t.getActiveUniform(M,h),E=t.getUniformLocation(this.program,e.name),i=null,r=e.type,S=e.size;switch(r){case _.SAMPLER_2D:case _.INT_SAMPLER_2D:case _.UNSIGNED_INT_SAMPLER_2D:case _.SAMPLER_2D_SHADOW:case _.SAMPLER_2D_ARRAY:case _.INT_SAMPLER_2D_ARRAY:case _.UNSIGNED_INT_SAMPLER_2D_ARRAY:case _.SAMPLER_2D_ARRAY_SHADOW:case _.SAMPLER_CUBE:case _.INT_SAMPLER_CUBE:case _.UNSIGNED_INT_SAMPLER_CUBE:case _.SAMPLER_CUBE_SHADOW:case _.SAMPLER_3D:case _.INT_SAMPLER_3D:case _.UNSIGNED_INT_SAMPLER_3D:I=this.samplerCount++,this.samplers[e.name]=I,this.gl.uniform1i(E,I);break;case _.INT:case _.UNSIGNED_INT:case _.FLOAT:i=S>1?T:s;break;case _.BOOL:i=S>1?R:s;break;case _.FLOAT_VEC2:case _.INT_VEC2:case _.UNSIGNED_INT_VEC2:case _.FLOAT_VEC3:case _.INT_VEC3:case _.UNSIGNED_INT_VEC3:case _.FLOAT_VEC4:case _.INT_VEC4:case _.UNSIGNED_INT_VEC4:i=T;break;case _.BOOL_VEC2:case _.BOOL_VEC3:case _.BOOL_VEC4:i=R;break;case _.FLOAT_MAT2:case _.FLOAT_MAT3:case _.FLOAT_MAT4:case _.FLOAT_MAT2x3:case _.FLOAT_MAT2x4:case _.FLOAT_MAT3x2:case _.FLOAT_MAT3x4:case _.FLOAT_MAT4x2:case _.FLOAT_MAT4x3:i=A;break;default:console.error("Unrecognized type for uniform ",e.name)}i&&(this.uniforms[e.name]=new i(t,E,r,S))}let l=t.getProgramParameter(M,t.ACTIVE_UNIFORM_BLOCKS);for(h=0;h<l;++h){let e=t.getActiveUniformBlockName(this.program,h),E=t.getUniformBlockIndex(this.program,e),_=this.uniformBlockCount++;this.gl.uniformBlockBinding(this.program,E,_),this.uniformBlocks[e]=_}t.useProgram(null)}delete(){this.program&&(this.gl.deleteProgram(this.program),this.program=null)}uniform(t,e){this.uniforms[t].set(e)}bind(){this.appState.program!==this&&(this.gl.useProgram(this.program),this.appState.program=this)}}t.exports=S},function(t,e,E){"use strict";const _=E(0),i={};i[_.BOOL]="uniform1i",i[_.INT]="uniform1i",i[_.SAMPLER_2D]="uniform1i",i[_.INT_SAMPLER_2D]="uniform1i",i[_.UNSIGNED_INT_SAMPLER_2D]="uniform1i",i[_.SAMPLER_2D_SHADOW]="uniform1i",i[_.SAMPLER_2D_ARRAY]="uniform1i",i[_.INT_SAMPLER_2D_ARRAY]="uniform1i",i[_.UNSIGNED_INT_SAMPLER_2D_ARRAY]="uniform1i",i[_.SAMPLER_2D_ARRAY_SHADOW]="uniform1i",i[_.SAMPLER_CUBE]="uniform1i",i[_.INT_SAMPLER_CUBE]="uniform1i",i[_.UNSIGNED_INT_SAMPLER_CUBE]="uniform1i",i[_.SAMPLER_CUBE_SHADOW]="uniform1i",i[_.SAMPLER_3D]="uniform1i",i[_.INT_SAMPLER_3D]="uniform1i",i[_.UNSIGNED_INT_SAMPLER_3D]="uniform1i",i[_.UNSIGNED_INT]="uniform1ui",i[_.FLOAT]="uniform1f",i[_.FLOAT_VEC2]="uniform2f",i[_.FLOAT_VEC3]="uniform3f",i[_.FLOAT_VEC4]="uniform4f",i[_.INT_VEC2]="uniform2i",i[_.INT_VEC3]="uniform3i",i[_.INT_VEC4]="uniform4i",i[_.UNSIGNED_INT_VEC2]="uniform2ui",i[_.UNSIGNED_INT_VEC3]="uniform3ui",i[_.UNSIGNED_INT_VEC4]="uniform4ui",i[_.BOOL_VEC2]="uniform2i",i[_.BOOL_VEC3]="uniform3i",i[_.BOOL_VEC4]="uniform4i",i[_.FLOAT_MAT2]="uniformMatrix2fv",i[_.FLOAT_MAT3]="uniformMatrix3fv",i[_.FLOAT_MAT4]="uniformMatrix4fv",i[_.FLOAT_MAT2x3]="uniformMatrix2x3fv",i[_.FLOAT_MAT2x4]="uniformMatrix2x4fv",i[_.FLOAT_MAT3x2]="uniformMatrix3x2fv",i[_.FLOAT_MAT3x4]="uniformMatrix3x4fv",i[_.FLOAT_MAT4x2]="uniformMatrix4x2fv",i[_.FLOAT_MAT4x3]="uniformMatrix4x3fv";const r={};r[_.BOOL]=1,r[_.INT]=1,r[_.SAMPLER_2D]=1,r[_.INT_SAMPLER_2D]=1,r[_.UNSIGNED_INT_SAMPLER_2D]=1,r[_.SAMPLER_2D_SHADOW]=1,r[_.SAMPLER_2D_ARRAY]=1,r[_.INT_SAMPLER_2D_ARRAY]=1,r[_.UNSIGNED_INT_SAMPLER_2D_ARRAY]=1,r[_.SAMPLER_2D_ARRAY_SHADOW]=1,r[_.SAMPLER_CUBE]=1,r[_.INT_SAMPLER_CUBE]=1,r[_.UNSIGNED_INT_SAMPLER_CUBE]=1,r[_.SAMPLER_CUBE_SHADOW]=1,r[_.SAMPLER_3D]=1,r[_.INT_SAMPLER_3D]=1,r[_.UNSIGNED_INT_SAMPLER_3D]=1,r[_.UNSIGNED_INT]=1,r[_.FLOAT]=1,r[_.FLOAT_VEC2]=2,r[_.FLOAT_VEC3]=3,r[_.FLOAT_VEC4]=4,r[_.INT_VEC2]=2,r[_.INT_VEC3]=3,r[_.INT_VEC4]=4,r[_.UNSIGNED_INT_VEC2]=2,r[_.UNSIGNED_INT_VEC3]=3,r[_.UNSIGNED_INT_VEC4]=4,r[_.BOOL_VEC2]=2,r[_.BOOL_VEC3]=3,r[_.BOOL_VEC4]=4,r[_.FLOAT_MAT2]=4,r[_.FLOAT_MAT3]=9,r[_.FLOAT_MAT4]=16,r[_.FLOAT_MAT2x3]=6,r[_.FLOAT_MAT2x4]=8,r[_.FLOAT_MAT3x2]=6,r[_.FLOAT_MAT3x4]=12,r[_.FLOAT_MAT4x2]=8,r[_.FLOAT_MAT4x3]=12;const s={};s[_.INT]=Int32Array,s[_.SAMPLER_2D]=Int32Array,s[_.INT_SAMPLER_2D]=Int32Array,s[_.UNSIGNED_INT_SAMPLER_2D]=Int32Array,s[_.SAMPLER_2D_SHADOW]=Int32Array,s[_.SAMPLER_2D_ARRAY]=Int32Array,s[_.INT_SAMPLER_2D_ARRAY]=Int32Array,s[_.UNSIGNED_INT_SAMPLER_2D_ARRAY]=Int32Array,s[_.SAMPLER_2D_ARRAY_SHADOW]=Int32Array,s[_.SAMPLER_CUBE]=Int32Array,s[_.INT_SAMPLER_CUBE]=Int32Array,s[_.UNSIGNED_INT_SAMPLER_CUBE]=Int32Array,s[_.SAMPLER_CUBE_SHADOW]=Int32Array,s[_.SAMPLER_3D]=Int32Array,s[_.INT_SAMPLER_3D]=Int32Array,s[_.UNSIGNED_INT_SAMPLER_3D]=Int32Array,s[_.UNSIGNED_INT]=Uint32Array,s[_.FLOAT]=Float32Array,s[_.FLOAT_VEC2]=Float32Array,s[_.FLOAT_VEC3]=Float32Array,s[_.FLOAT_VEC4]=Float32Array,s[_.INT_VEC2]=Int32Array,s[_.INT_VEC3]=Int32Array,s[_.INT_VEC4]=Int32Array,s[_.UNSIGNED_INT_VEC2]=Uint32Array,s[_.UNSIGNED_INT_VEC3]=Uint32Array,s[_.UNSIGNED_INT_VEC4]=Uint32Array;class T{constructor(t,e,E){this.gl=t,this.handle=e,this.glFuncName=i[E],this.cache=E!==_.BOOL&&0}set(t){this.cache!==t&&(this.gl[this.glFuncName](this.handle,t),this.cache=t)}}class R{constructor(t,e,E,_){this.gl=t,this.handle=e,this.glFuncName=i[E]+"v",this.count=_,this.cache=new s[E](r[E]*_)}set(t){for(let e=0,E=t.length;e<E;++e)if(this.cache[e]!==t[e])return this.gl[this.glFuncName](this.handle,t),void this.cache.set(t)}}class A{constructor(t,e,E,_){this.gl=t,this.handle=e,this.glFuncName=i[E]+"v",this.count=_,this.cache=new Array(r[E]*_).fill(!1)}set(t){for(let e=0,E=t.length;e<E;++e)if(this.cache[e]!==t[e]){this.gl[this.glFuncName](this.handle,t);for(let _=e;_<E;_++)this.cache[_]=t[_];return}}}class S{constructor(t,e,E,_){this.gl=t,this.handle=e,this.glFuncName=i[E],this.count=_,this.cache=new Float32Array(r[E]*_)}set(t){for(let e=0,E=t.length;e<E;++e)if(this.cache[e]!==t[e])return this.gl[this.glFuncName](this.handle,!1,t),void this.cache.set(t)}}t.exports.SingleComponentUniform=T,t.exports.MultiNumericUniform=R,t.exports.MultiBoolUniform=A,t.exports.MatrixUniform=S},function(t,e,E){"use strict";const _=E(0),i=E(1),r=new Array(1);class s{constructor(t,e,E,r,s=r.width,T=r.height,R,A,S=_.DUMMY_OBJECT){let h=S.format===_.DEPTH_COMPONENT?_.UNSIGNED_SHORT:_.UNSIGNED_BYTE;this.gl=t,this.binding=E,this.texture=null,this.width=-1,this.height=-1,this.depth=-1,this.type=void 0!==S.type?S.type:h,this.is3D=A,this.appState=e,this.format=null,this.internalFormat=null,this.compressed=!(!i.COMPRESSED_TYPES[S.format]&&!i.COMPRESSED_TYPES[S.internalFormat]),this.compressed?(this.format=void 0!==S.format?S.format:S.internalFormat,this.internalFormat=void 0!==S.internalFormat?S.internalFormat:S.format):(this.format=void 0!==S.format?S.format:t.RGBA,this.internalFormat=void 0!==S.internalFormat?S.internalFormat:i[this.type][this.format]),this.currentUnit=-1;let{minFilter:a=(r?t.LINEAR_MIPMAP_NEAREST:t.NEAREST),magFilter:n=(r?t.LINEAR:t.NEAREST),wrapS:N=t.REPEAT,wrapT:u=t.REPEAT,wrapR:M=t.REPEAT,compareMode:I=t.NONE,compareFunc:C=t.LEQUAL,minLOD:l=null,maxLOD:O=null,baseLevel:F=null,maxLevel:P=null,flipY:D=!1}=S;this.minFilter=a,this.magFilter=n,this.wrapS=N,this.wrapT=u,this.wrapR=M,this.compareMode=I,this.compareFunc=C,this.minLOD=l,this.maxLOD=O,this.baseLevel=F,this.maxLevel=P,this.flipY=D,this.mipmaps=a===t.LINEAR_MIPMAP_NEAREST||a===t.LINEAR_MIPMAP_LINEAR,this.resize(s,T,R),r&&this.data(r)}resize(t,e,E){if(E=E||0,t===this.width&&e===this.height&&E===this.depth)return;this.gl.deleteTexture(this.texture),-1!==this.currentUnit&&(this.appState.textures[this.currentUnit]=null),this.texture=this.gl.createTexture(),this.bind(Math.max(this.currentUnit,0)),this.width=t,this.height=e,this.depth=E,this.gl.texParameteri(this.binding,this.gl.TEXTURE_MIN_FILTER,this.minFilter),this.gl.texParameteri(this.binding,this.gl.TEXTURE_MAG_FILTER,this.magFilter),this.gl.texParameteri(this.binding,this.gl.TEXTURE_WRAP_S,this.wrapS),this.gl.texParameteri(this.binding,this.gl.TEXTURE_WRAP_T,this.wrapT),this.gl.texParameteri(this.binding,this.gl.TEXTURE_WRAP_R,this.wrapR),this.gl.texParameteri(this.binding,this.gl.TEXTURE_COMPARE_FUNC,this.compareFunc),this.gl.texParameteri(this.binding,this.gl.TEXTURE_COMPARE_MODE,this.compareMode),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,this.flipY),null!==this.minLOD&&this.gl.texParameterf(this.binding,this.gl.TEXTURE_MIN_LOD,this.minLOD),null!==this.maxLOD&&this.gl.texParameterf(this.binding,this.gl.TEXTURE_MAX_LOD,this.maxLOD),null!==this.baseLevel&&this.gl.texParameteri(this.binding,this.gl.TEXTURE_BASE_LEVEL,this.baseLevel),null!==this.maxLevel&&this.gl.texParameteri(this.binding,this.gl.TEXTURE_MAX_LEVEL,this.maxLevel);let _;this.is3D?(_=this.mipmaps?Math.floor(Math.log2(Math.max(Math.max(this.width,this.height),this.depth)))+1:1,this.gl.texStorage3D(this.binding,_,this.internalFormat,this.width,this.height,this.depth)):(_=this.mipmaps?Math.floor(Math.log2(Math.max(this.width,this.height)))+1:1,this.gl.texStorage2D(this.binding,_,this.internalFormat,this.width,this.height))}data(t){Array.isArray(t)||(r[0]=t,t=r);let e,E=this.mipmaps?t.length:1,_=this.width,i=this.height,s=this.depth,T=this.mipmaps&&1===t.length;if(this.bind(Math.max(this.currentUnit,0)),this.compressed)if(this.is3D)for(e=0;e<E;++e)this.gl.compressedTexSubImage3D(this.binding,e,0,0,0,_,i,s,this.format,t[e]),_=Math.max(_>>1,1),i=Math.max(i>>1,1),s=Math.max(s>>1,1);else for(e=0;e<E;++e)this.gl.compressedTexSubImage2D(this.binding,e,0,0,_,i,this.format,t[e]),_=Math.max(_>>1,1),i=Math.max(i>>1,1);else if(this.is3D)for(e=0;e<E;++e)this.gl.texSubImage3D(this.binding,e,0,0,0,_,i,s,this.format,this.type,t[e]),_=Math.max(_>>1,1),i=Math.max(i>>1,1),s=Math.max(s>>1,1);else for(e=0;e<E;++e)this.gl.texSubImage2D(this.binding,e,0,0,_,i,this.format,this.type,t[e]),_=Math.max(_>>1,1),i=Math.max(i>>1,1);return T&&this.gl.generateMipmap(this.binding),this}delete(){this.texture&&(this.gl.deleteTexture(this.texture),this.texture=null,-1!==this.currentUnit&&this.appState.textures[this.currentUnit]===this&&(this.appState.textures[this.currentUnit]=null,this.currentUnit=-1))}bind(t){let e=this.appState.textures[t];return e!==this&&(e&&(e.currentUnit=-1),-1!==this.currentUnit&&(this.appState.textures[this.currentUnit]=null),this.gl.activeTexture(this.gl.TEXTURE0+t),this.gl.bindTexture(this.binding,this.texture),this.appState.textures[t]=this,this.currentUnit=t),this}}t.exports=s},function(t,e,E){"use strict";const _=E(0),i=E(3);class r{constructor(t){this.gl=t,this.cpuTimer=window.performance||window.Date,this.gl.getExtension("EXT_disjoint_timer_query_webgl2")||this.gl.getExtension("EXT_disjoint_timer_query")?(this.gpuTimer=!0,this.gpuTimerQuery=new i(this.gl,_.TIME_ELAPSED_EXT)):(this.gpuTimer=!1,this.gpuTimerQuery=null),this.cpuStartTime=0,this.cpuTime=0,this.gpuTime=0}start(){this.gpuTimer?this.gpuTimerQuery.active||(this.gpuTimerQuery.begin(),this.cpuStartTime=this.cpuTimer.now()):this.cpuStartTime=this.cpuTimer.now()}end(){this.gpuTimer?this.gpuTimerQuery.active||(this.gpuTimerQuery.end(),this.cpuTime=this.cpuTimer.now()-this.cpuStartTime):this.cpuTime=this.cpuTimer.now()-this.cpuStartTime}ready(){if(this.gpuTimer){if(!this.gpuTimerQuery.active)return!1;var t=this.gpuTimerQuery.ready(),e=this.gl.getParameter(_.GPU_DISJOINT_EXT);return!(!t||e)&&(this.gpuTime=this.gpuTimerQuery.result/1e6,!0)}return!!this.cpuStartTime}}t.exports=r},function(t,e,E){"use strict";class _{constructor(t,e){this.gl=t,this.transformFeedback=t.createTransformFeedback(),this.appState=e,this.angleBugBuffers=[]}feedbackBuffer(t,e){return this.gl.bindTransformFeedback(this.gl.TRANSFORM_FEEDBACK,this.transformFeedback),this.gl.bindBufferBase(this.gl.TRANSFORM_FEEDBACK_BUFFER,t,e.buffer),this.gl.bindTransformFeedback(this.gl.TRANSFORM_FEEDBACK,null),this.gl.bindBufferBase(this.gl.TRANSFORM_FEEDBACK_BUFFER,t,null),this.angleBugBuffers[t]=e,this}delete(){this.transformFeedback&&(this.gl.deleteTransformFeedback(this.transformFeedback),this.transformFeedback=null)}bind(){if(this.appState.transformFeedback!==this){this.gl.bindTransformFeedback(this.gl.TRANSFORM_FEEDBACK,this.transformFeedback);for(let t=0,e=this.angleBugBuffers.length;t<e;++t)this.gl.bindBufferBase(this.gl.TRANSFORM_FEEDBACK_BUFFER,t,this.angleBugBuffers[t].buffer);this.appState.transformFeedback=this}return this}}t.exports=_},function(t,e,E){"use strict";const _=E(0);class i{constructor(t,e,E,i=t.DYNAMIC_DRAW){this.gl=t,this.buffer=t.createBuffer(),this.dataViews={},this.offsets=new Array(E.length),this.sizes=new Array(E.length),this.types=new Array(E.length),this.size=0,this.usage=i,this.appState=e,this.currentBase=-1;for(let t=0,e=E.length;t<e;++t){let e=E[t];switch(e){case _.FLOAT:case _.INT:case _.UNSIGNED_INT:case _.BOOL:this.offsets[t]=this.size,this.sizes[t]=1,e===_.INT?this.types[t]=_.INT:this.type===_.UNSIGNED_INT?this.types[t]=_.UNSIGNED_INT:this.types[t]=_.FLOAT,this.size++;break;case _.FLOAT_VEC2:case _.INT_VEC2:case _.UNSIGNED_INT_VEC2:case _.BOOL_VEC2:this.size+=this.size%2,this.offsets[t]=this.size,this.sizes[t]=2,e===_.INT_VEC2?this.types[t]=_.INT:this.type===_.UNSIGNED_INT_VEC2?this.types[t]=_.UNSIGNED_INT:this.types[t]=_.FLOAT,this.size+=2;break;case _.FLOAT_VEC3:case _.INT_VEC3:case _.UNSIGNED_INT_VEC3:case _.BOOL_VEC3:case _.FLOAT_VEC4:case _.INT_VEC4:case _.UNSIGNED_INT_VEC4:case _.BOOL_VEC4:this.size+=(4-this.size%4)%4,this.offsets[t]=this.size,this.sizes[t]=4,e===_.INT_VEC4||e===_.INT_VEC3?this.types[t]=_.INT:this.type===_.UNSIGNED_INT_VEC4||this.type===_.UNSIGNED_INT_VEC3?this.types[t]=_.UNSIGNED_INT:this.types[t]=_.FLOAT,this.size+=4;break;case _.FLOAT_MAT2:case _.FLOAT_MAT2x3:case _.FLOAT_MAT2x4:this.size+=(4-this.size%4)%4,this.offsets[t]=this.size,this.sizes[t]=8,this.types[t]=_.FLOAT,this.size+=8;break;case _.FLOAT_MAT3:case _.FLOAT_MAT3x2:case _.FLOAT_MAT3x4:this.size+=(4-this.size%4)%4,this.offsets[t]=this.size,this.sizes[t]=12,this.types[t]=_.FLOAT,this.size+=12;break;case _.FLOAT_MAT4:case _.FLOAT_MAT4x2:case _.FLOAT_MAT4x3:this.size+=(4-this.size%4)%4,this.offsets[t]=this.size,this.sizes[t]=16,this.types[t]=_.FLOAT,this.size+=16;break;default:console.error("Unsupported type for uniform buffer.")}}this.size+=(4-this.size%4)%4,this.data=new Float32Array(this.size),this.dataViews[_.FLOAT]=this.data,this.dataViews[_.INT]=new Int32Array(this.data.buffer),this.dataViews[_.UNSIGNED_INT]=new Uint32Array(this.data.buffer),this.gl.bindBuffer(this.gl.UNIFORM_BUFFER,this.buffer),this.gl.bufferData(this.gl.UNIFORM_BUFFER,4*this.size,this.usage),this.gl.bindBuffer(this.gl.UNIFORM_BUFFER,null)}set(t,e){let E=this.dataViews[this.types[t]];return 1===this.sizes[t]?E[this.offsets[t]]=e:E.set(e,this.offsets[t]),this}update(t){let e,E;if(void 0===t)e=this.data,E=0;else{let _=this.offsets[t],i=_+this.sizes[t];e=this.data.subarray(_,i),E=4*_}return this.gl.bindBuffer(this.gl.UNIFORM_BUFFER,this.buffer),this.gl.bufferSubData(this.gl.UNIFORM_BUFFER,E,e),this.gl.bindBuffer(this.gl.UNIFORM_BUFFER,null),this}delete(){this.buffer&&(this.gl.deleteBuffer(this.buffer),this.buffer=null,-1!==this.currentBase&&this.appState.uniformBuffers[this.currentBase]===this&&(this.appState.uniformBuffers[this.currentBase]=null))}bind(t){let e=this.appState.uniformBuffers[t];return e!==this&&(e&&(e.currentBase=-1),-1!==this.currentBase&&(this.appState.uniformBuffers[this.currentBase]=null),this.gl.bindBufferBase(this.gl.UNIFORM_BUFFER,t,this.buffer),this.appState.uniformBuffers[t]=this,this.currentBase=t),this}}t.exports=i},function(t,e,E){"use strict";const _=E(0);class i{constructor(t,e){this.gl=t,this.vertexArray=t.createVertexArray(),this.appState=e,this.numElements=0,this.indexType=null,this.instancedBuffers=0,this.indexed=!1,this.numInstances=0}vertexAttributeBuffer(t,e){return this.attributeBuffer(t,e,!1,!1,!1),this}instanceAttributeBuffer(t,e){return this.attributeBuffer(t,e,!0,!1,!1),this}vertexIntegerAttributeBuffer(t,e){return this.attributeBuffer(t,e,!1,!0,!1),this}instanceIntegerAttributeBuffer(t,e){return this.attributeBuffer(t,e,!0,!0,!1),this}vertexNormalizedAttributeBuffer(t,e){return this.attributeBuffer(t,e,!1,!1,!0),this}instanceNormalizedAttributeBuffer(t,e){return this.attributeBuffer(t,e,!0,!1,!0),this}indexBuffer(t){return this.gl.bindVertexArray(this.vertexArray),this.gl.bindBuffer(t.binding,t.buffer),this.numElements=3*t.numItems,this.indexType=t.type,this.indexed=!0,this.gl.bindVertexArray(null),this.gl.bindBuffer(t.binding,null),this}delete(){return this.vertexArray&&(this.gl.deleteVertexArray(this.vertexArray),this.vertexArray=null),this.gl.bindVertexArray(null),this}bind(){return this.appState.vertexArray!==this&&(this.gl.bindVertexArray(this.vertexArray),this.appState.vertexArray=this),this}attributeBuffer(t,e,E,i,r){this.gl.bindVertexArray(this.vertexArray),this.gl.bindBuffer(e.binding,e.buffer);let s=e.numColumns;for(let T=0;T<s;++T)i?this.gl.vertexAttribIPointer(t+T,e.itemSize,e.type,s*e.itemSize*_.TYPE_SIZE[e.type],T*e.itemSize*_.TYPE_SIZE[e.type]):this.gl.vertexAttribPointer(t+T,e.itemSize,e.type,r,s*e.itemSize*_.TYPE_SIZE[e.type],T*e.itemSize*_.TYPE_SIZE[e.type]),E&&this.gl.vertexAttribDivisor(t+T,1),this.gl.enableVertexAttribArray(t+T);return this.instanced=this.instanced||E,E?this.numInstances=e.numItems:this.numElements=this.numElements||e.numItems,this.gl.bindVertexArray(null),this.gl.bindBuffer(e.binding,null),this}}t.exports=i},function(t,e,E){"use strict";const _=E(0);class i{constructor(t,e,E,i,r,s=t.STATIC_DRAW,T){let R;switch(E){case _.FLOAT_MAT4:case _.FLOAT_MAT4x2:case _.FLOAT_MAT4x3:R=4;break;case _.FLOAT_MAT3:case _.FLOAT_MAT3x2:case _.FLOAT_MAT3x4:R=3;break;case _.FLOAT_MAT2:case _.FLOAT_MAT2x3:case _.FLOAT_MAT2x4:R=2;break;default:R=1}switch(E){case _.FLOAT_MAT4:case _.FLOAT_MAT3x4:case _.FLOAT_MAT2x4:i=4,E=_.FLOAT;break;case _.FLOAT_MAT3:case _.FLOAT_MAT4x3:case _.FLOAT_MAT2x3:i=3,E=_.FLOAT;break;case _.FLOAT_MAT2:case _.FLOAT_MAT3x2:case _.FLOAT_MAT4x2:i=2,E=_.FLOAT}let A;"number"==typeof r?(A=r,r*=_.TYPE_SIZE[E]):A=r.length,this.gl=t,this.buffer=t.createBuffer(),this.appState=e,this.type=E,this.itemSize=i,this.numItems=A/(i*R),this.numColumns=R,this.usage=s,this.indexArray=!!T,this.binding=this.indexArray?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER,t.bindBuffer(this.binding,this.buffer),t.bufferData(this.binding,r,this.usage),t.bindBuffer(this.binding,null)}data(t){let e=this.appState.vertexArray;return e&&this.gl.bindVertexArray(null),this.gl.bindBuffer(this.binding,this.buffer),this.gl.bufferSubData(this.binding,0,t),this.gl.bindBuffer(this.binding,null),e&&this.gl.bindVertexArray(e.vertexArray),this}delete(){this.buffer&&(this.gl.deleteBuffer(this.buffer),this.buffer=null)}}t.exports=i}])});