2 lines
4.3 KiB
JavaScript
2 lines
4.3 KiB
JavaScript
|
define(["exports","./WebGLConstants-4ae0db90","./when-b60132fc"],(function(_,t,n){"use strict";var e={UNSIGNED_BYTE:t.WebGLConstants.UNSIGNED_BYTE,UNSIGNED_SHORT:t.WebGLConstants.UNSIGNED_SHORT,UNSIGNED_INT:t.WebGLConstants.UNSIGNED_INT,FLOAT:t.WebGLConstants.FLOAT,HALF_FLOAT:t.WebGLConstants.HALF_FLOAT_OES,UNSIGNED_INT_24_8:t.WebGLConstants.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:t.WebGLConstants.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:t.WebGLConstants.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:t.WebGLConstants.UNSIGNED_SHORT_5_6_5,isPacked:function(_){return _===e.UNSIGNED_INT_24_8||_===e.UNSIGNED_SHORT_4_4_4_4||_===e.UNSIGNED_SHORT_5_5_5_1||_===e.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(_){switch(_){case e.UNSIGNED_BYTE:return 1;case e.UNSIGNED_SHORT:case e.UNSIGNED_SHORT_4_4_4_4:case e.UNSIGNED_SHORT_5_5_5_1:case e.UNSIGNED_SHORT_5_6_5:case e.HALF_FLOAT:return 2;case e.UNSIGNED_INT:case e.FLOAT:case e.UNSIGNED_INT_24_8:return 4}},validate:function(_){return _===e.UNSIGNED_BYTE||_===e.UNSIGNED_SHORT||_===e.UNSIGNED_INT||_===e.FLOAT||_===e.HALF_FLOAT||_===e.UNSIGNED_INT_24_8||_===e.UNSIGNED_SHORT_4_4_4_4||_===e.UNSIGNED_SHORT_5_5_5_1||_===e.UNSIGNED_SHORT_5_6_5}},T={DEPTH_COMPONENT:t.WebGLConstants.DEPTH_COMPONENT,DEPTH_STENCIL:t.WebGLConstants.DEPTH_STENCIL,ALPHA:t.WebGLConstants.ALPHA,RGB:t.WebGLConstants.RGB,RGBA:t.WebGLConstants.RGBA,LUMINANCE:t.WebGLConstants.LUMINANCE,LUMINANCE_ALPHA:t.WebGLConstants.LUMINANCE_ALPHA,RGB_DXT1:t.WebGLConstants.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:t.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:t.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:t.WebGLConstants.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:t.WebGLConstants.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:t.WebGLConstants.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:t.WebGLConstants.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:t.WebGLConstants.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGB_ETC1:t.WebGLConstants.COMPRESSED_RGB_ETC1_WEBGL,componentsLength:function(_){switch(_){case T.RGB:return 3;case T.RGBA:return 4;case T.LUMINANCE_ALPHA:return 2;case T.ALPHA:case T.LUMINANCE:default:return 1}},validate:function(_){return _===T.DEPTH_COMPONENT||_===T.DEPTH_STENCIL||_===T.ALPHA||_===T.RGB||_===T.RGBA||_===T.LUMINANCE||_===T.LUMINANCE_ALPHA||_===T.RGB_DXT1||_===T.RGBA_DXT1||_===T.RGBA_DXT3||_===T.RGBA_DXT5||_===T.RGB_PVRTC_4BPPV1||_===T.RGB_PVRTC_2BPPV1||_===T.RGBA_PVRTC_4BPPV1||_===T.RGBA_PVRTC_2BPPV1||_===T.RGB_ETC1},isColorFormat:function(_){return _===T.ALPHA||_===T.RGB||_===T.RGBA||_===T.LUMINANCE||_===T.LUMINANCE_ALPHA},isDepthFormat:function(_){return _===T.DEPTH_COMPONENT||_===T.DEPTH_STENCIL},isCompressedFormat:function(_){return _===T.RGB_DXT1||_===T.RGBA_DXT1||_===T.RGBA_DXT3||_===T.RGBA_DXT5||_===T.RGB_PVRTC_4BPPV1||_===T.RGB_PVRTC_2BPPV1||_===T.RGBA_PVRTC_4BPPV1||_===T.RGBA_PVRTC_2BPPV1||_===T.RGB_ETC1},isDXTFormat:function(_){return _===T.RGB_DXT1||_===T.RGBA_DXT1||_===T.RGBA_DXT3||_===T.RGBA_DXT5},isPVRTCFormat:function(_){return _===T.RGB_PVRTC_4BPPV1||_===T.RGB_PVRTC_2BPPV1||_===T.RGBA_PVRTC_4BPPV1||_===T.RGBA_PVRTC_2BPPV1},isETC1Format:function(_){return _===T.RGB_ETC1},compressedTextureSizeInBytes:function(_,t,e,G){var R=n.defined(G)?G:1;switch(_){case T.RGB_DXT1:case T.RGBA_DXT1:case T.RGB_ETC1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8*R;case T.RGBA_DXT3:case T.RGBA_DXT5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16*R;case T.RGB_PVRTC_4BPPV1:case T.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(e,8)*4+7)/8)*R;case T.RGB_PVRTC_2BPPV1:case T.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(e,8)*2+7)/8)*R;default:return 0}},textureSizeInBytes:function(_,t,G,R,P){var E=n.defined(P)?P:1,N=T.componentsLength(_);return e.isPacked(t)&&(N=1),N*e.sizeInBytes(t)*G*R*E},alignmentInBytes:function(_,t,n){var e=T.textureSizeInBytes(_,t,n,1)%4;return 0===e?4:2===e?2:1},createTypedArray:function(_,t,n,G){var R=e.sizeInBytes(t);return new(R===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:R===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:R===Float32Array.BYTES_PE
|