define(["exports","./WebGLConstants-4739ce15"],function(_,e){"use strict";var n={UNSIGNED_BYTE:e.WebGLConstants.UNSIGNED_BYTE,UNSIGNED_SHORT:e.WebGLConstants.UNSIGNED_SHORT,UNSIGNED_INT:e.WebGLConstants.UNSIGNED_INT,FLOAT:e.WebGLConstants.FLOAT,HALF_FLOAT:e.WebGLConstants.HALF_FLOAT_OES,UNSIGNED_INT_24_8:e.WebGLConstants.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:e.WebGLConstants.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:e.WebGLConstants.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:e.WebGLConstants.UNSIGNED_SHORT_5_6_5,toWebGLConstant:function(_,t){switch(_){case n.UNSIGNED_BYTE:return e.WebGLConstants.UNSIGNED_BYTE;case n.UNSIGNED_SHORT:return e.WebGLConstants.UNSIGNED_SHORT;case n.UNSIGNED_INT:return e.WebGLConstants.UNSIGNED_INT;case n.FLOAT:return e.WebGLConstants.FLOAT;case n.HALF_FLOAT:return t.webgl2?e.WebGLConstants.HALF_FLOAT:e.WebGLConstants.HALF_FLOAT_OES;case n.UNSIGNED_INT_24_8:return e.WebGLConstants.UNSIGNED_INT_24_8;case n.UNSIGNED_SHORT_4_4_4_4:return e.WebGLConstants.UNSIGNED_SHORT_4_4_4_4;case n.UNSIGNED_SHORT_5_5_5_1:return e.WebGLConstants.UNSIGNED_SHORT_5_5_5_1;case n.UNSIGNED_SHORT_5_6_5:return n.UNSIGNED_SHORT_5_6_5}},isPacked:function(_){return _===n.UNSIGNED_INT_24_8||_===n.UNSIGNED_SHORT_4_4_4_4||_===n.UNSIGNED_SHORT_5_5_5_1||_===n.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(_){switch(_){case n.UNSIGNED_BYTE:return 1;case n.UNSIGNED_SHORT:case n.UNSIGNED_SHORT_4_4_4_4:case n.UNSIGNED_SHORT_5_5_5_1:case n.UNSIGNED_SHORT_5_6_5:case n.HALF_FLOAT:return 2;case n.UNSIGNED_INT:case n.FLOAT:case n.UNSIGNED_INT_24_8:return 4}},validate:function(_){return _===n.UNSIGNED_BYTE||_===n.UNSIGNED_SHORT||_===n.UNSIGNED_INT||_===n.FLOAT||_===n.HALF_FLOAT||_===n.UNSIGNED_INT_24_8||_===n.UNSIGNED_SHORT_4_4_4_4||_===n.UNSIGNED_SHORT_5_5_5_1||_===n.UNSIGNED_SHORT_5_6_5}},T=Object.freeze(n),a={DEPTH_COMPONENT:e.WebGLConstants.DEPTH_COMPONENT,DEPTH_STENCIL:e.WebGLConstants.DEPTH_STENCIL,ALPHA:e.WebGLConstants.ALPHA,RGB:e.WebGLConstants.RGB,RGBA:e.WebGLConstants.RGBA,LUMINANCE:e.WebGLConstants.LUMINANCE,LUMINANCE_ALPHA:e.WebGLConstants.LUMINANCE_ALPHA,RGB_DXT1:e.WebGLConstants.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:e.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:e.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:e.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:e.WebGLConstants.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:e.WebGLConstants.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:e.WebGLConstants.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:e.WebGLConstants.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:e.WebGLConstants.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:e.WebGLConstants.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:e.WebGLConstants.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:e.WebGLConstants.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:e.WebGLConstants.COMPRESSED_RGBA_BPTC_UNORM,componentsLength:function(_){switch(_){case a.RGB:return 3;case a.RGBA:return 4;case a.LUMINANCE_ALPHA:return 2;case a.ALPHA:case a.LUMINANCE:default:return 1}},validate:function(_){return _===a.DEPTH_COMPONENT||_===a.DEPTH_STENCIL||_===a.ALPHA||_===a.RGB||_===a.RGBA||_===a.LUMINANCE||_===a.LUMINANCE_ALPHA||_===a.RGB_DXT1||_===a.RGBA_DXT1||_===a.RGBA_DXT3||_===a.RGBA_DXT5||_===a.RGB_PVRTC_4BPPV1||_===a.RGB_PVRTC_2BPPV1||_===a.RGBA_PVRTC_4BPPV1||_===a.RGBA_PVRTC_2BPPV1||_===a.RGBA_ASTC||_===a.RGB_ETC1||_===a.RGB8_ETC2||_===a.RGBA8_ETC2_EAC||_===a.RGBA_BC7},isColorFormat:function(_){return _===a.ALPHA||_===a.RGB||_===a.RGBA||_===a.LUMINANCE||_===a.LUMINANCE_ALPHA},isDepthFormat:function(_){return _===a.DEPTH_COMPONENT||_===a.DEPTH_STENCIL},isCompressedFormat:function(_){return _===a.RGB_DXT1||_===a.RGBA_DXT1||_===a.RGBA_DXT3||_===a.RGBA_DXT5||_===a.RGB_PVRTC_4BPPV1||_===a.RGB_PVRTC_2BPPV1||_===a.RGBA_PVRTC_4BPPV1||_===a.RGBA_PVRTC_2BPPV1||_===a.RGBA_ASTC||_===a.RGB_ETC1||_===a.RGB8_ETC2||_===a.RGBA8_ETC2_EAC||_===a.RGBA_BC7},isDXTFormat:function(_){return _===a.RGB_DXT1||_===a.RGBA_DXT1||_===a.RGBA_DXT3||_===a.RGBA_DXT5},isPVRTCFormat:function(_){return _===a.RGB_PVRTC_4BPPV1||_===a.RGB_PVRTC_2BPPV1||_===a.RGBA_PVRTC_4BPPV1||_===a.RGBA_PVRTC_2BPPV1},isASTCFormat:function(_){return _===a.RGBA_ASTC},isETC1Format:function(_){return _===a.RGB_ETC1},isETC2Format:function(_){return _===a.RGB8_ETC2||_===a.RGBA8_ETC2_EAC},isBC7Format:function(_){return _===a.RGBA_BC7},compressedTextureSizeInBytes:function(_,t,n){switch(_){case a.RGB_DXT1:case a.RGBA_DXT1:case a.RGB_ETC1:case a.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case a.RGBA_DXT3:case a.RGBA_DXT5:case a.RGBA_ASTC:case a.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case a.RGB_PVRTC_4BPPV1:case a.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case a.RGB_PVRTC_2BPPV1:case a.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case a.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}},textureSizeInBytes:function(_,t,n,e){_=a.componentsLength(_);return(_=T.isPacked(t)?1:_)*T.sizeInBytes(t)*n*e},alignmentInBytes:function(_,t,n){n=a.textureSizeInBytes(_,t,n,1)%4;return 0==n?4:2==n?2:1},createTypedArray:function(_,t,n,e){var G=T.sizeInBytes(t),t=G===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:G===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:G===Float32Array.BYTES_PER_ELEMENT&&t===T.FLOAT?Float32Array:Uint32Array;return new t(a.componentsLength(_)*n*e)},flipY:function(_,t,n,e,G){if(1===G)return _;for(var T=a.createTypedArray(t,n,e,G),s=a.componentsLength(t),R=e*s,E=0;E