You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
5.9 KiB
13 lines
5.9 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define(["exports","../../core/has","./checkWebGLError","./enums","./getDataTypeBytes"],function(h,t,q,a,r){function n(b){b=b.gl;switch(b.getError()){case b.NO_ERROR:return null;case b.INVALID_ENUM:return"An unacceptable value has been specified for an enumerated argument";case b.INVALID_VALUE:return"An unacceptable value has been specified for an argument";case b.INVALID_OPERATION:return"The specified command is not allowed for the current state";case b.INVALID_FRAMEBUFFER_OPERATION:return"The currently bound framebuffer is not framebuffer complete"; |
|
case b.OUT_OF_MEMORY:return"Not enough memory is left to execute the command";case b.CONTEXT_LOST_WEBGL:return"WebGL context is lost"}return"Unknown error"}function p(b){return b[0].stride}h.bindVertexBufferLayout=function(b,k,g,d,l=0){const f=b.gl;b.bindBuffer(g);for(const c of d)if(d=k.get(c.name),void 0===d)console.warn(`There is no location for vertex attribute '${c.name}' defined.`);else{g=l*c.stride;if(4>=c.count)f.vertexAttribPointer(d,c.count,c.type,c.normalized,c.stride,c.offset+g),f.enableVertexAttribArray(d), |
|
0<c.divisor&&b.gl.vertexAttribDivisor(d,c.divisor);else if(9===c.count)for(var e=0;3>e;e++)f.vertexAttribPointer(d+e,3,c.type,c.normalized,c.stride,c.offset+12*e+g),f.enableVertexAttribArray(d+e),0<c.divisor&&b.gl.vertexAttribDivisor(d+e,c.divisor);else if(16===c.count)for(e=0;4>e;e++)f.vertexAttribPointer(d+e,4,c.type,c.normalized,c.stride,c.offset+16*e+g),f.enableVertexAttribArray(d+e),0<c.divisor&&b.gl?.vertexAttribDivisor(d+e,c.divisor);else console.error("Unsupported vertex attribute element count: "+ |
|
c.count);if(q.webglDebugEnabled()){d=n(b);e=r.getDataTypeBytes(c.type);const m=c.offset;e=Math.round(e/m)!==e/m?`. Offset not a multiple of stride. DataType requires ${e} bytes, but descriptor has an offset of ${m}`:"";d&&console.error(`Unable to bind vertex attribute "${c.name}" with baseInstanceOffset ${g}${e}:`,d,c)}}};h.getBytesPerElementFormat=function(b){switch(b){case a.PixelFormat.ALPHA:case a.PixelFormat.LUMINANCE:case a.PixelFormat.RED:case a.PixelFormat.RED_INTEGER:case a.SizedPixelFormat.R8:case a.SizedPixelFormat.R8I:case a.SizedPixelFormat.R8UI:case a.SizedPixelFormat.R8_SNORM:case a.RenderbufferFormat.STENCIL_INDEX8:return 1; |
|
case a.PixelFormat.LUMINANCE_ALPHA:case a.PixelFormat.RG:case a.PixelFormat.RG_INTEGER:case a.SizedPixelFormat.RGBA4:case a.SizedPixelFormat.R16F:case a.SizedPixelFormat.R16I:case a.SizedPixelFormat.R16UI:case a.SizedPixelFormat.RG8:case a.SizedPixelFormat.RG8I:case a.SizedPixelFormat.RG8UI:case a.SizedPixelFormat.RG8_SNORM:case a.SizedPixelFormat.RGB565:case a.SizedPixelFormat.RGB5_A1:case a.RenderbufferFormat.DEPTH_COMPONENT16:return 2;case a.PixelFormat.DEPTH_COMPONENT:case a.PixelFormat.RGB:case a.PixelFormat.RGB_INTEGER:case a.SizedPixelFormat.RGB8:case a.SizedPixelFormat.RGB8I:case a.SizedPixelFormat.RGB8UI:case a.SizedPixelFormat.RGB8_SNORM:case a.SizedPixelFormat.SRGB8:case a.RenderbufferFormat.DEPTH_COMPONENT24:return 3; |
|
case a.PixelFormat.DEPTH_STENCIL:case a.PixelFormat.DEPTH24_STENCIL8:case a.PixelFormat.RGBA:case a.PixelFormat.RGBA_INTEGER:case a.SizedPixelFormat.RGBA8:case a.SizedPixelFormat.R32F:case a.SizedPixelFormat.R11F_G11F_B10F:case a.SizedPixelFormat.RG16F:case a.SizedPixelFormat.R32I:case a.SizedPixelFormat.R32UI:case a.SizedPixelFormat.RG16I:case a.SizedPixelFormat.RG16UI:case a.SizedPixelFormat.RGBA8I:case a.SizedPixelFormat.RGBA8UI:case a.SizedPixelFormat.RGBA8_SNORM:case a.SizedPixelFormat.SRGB8_ALPHA8:case a.SizedPixelFormat.RGB9_E5:case a.SizedPixelFormat.RGB10_A2UI:case a.SizedPixelFormat.RGB10_A2:case a.RenderbufferFormat.DEPTH_STENCIL:case a.RenderbufferFormat.DEPTH_COMPONENT32F:case a.RenderbufferFormat.DEPTH24_STENCIL8:return 4; |
|
case a.RenderbufferFormat.DEPTH32F_STENCIL8:return 5;case a.SizedPixelFormat.RGB16F:case a.SizedPixelFormat.RGB16I:case a.SizedPixelFormat.RGB16UI:return 6;case a.SizedPixelFormat.RG32F:case a.SizedPixelFormat.RG32I:case a.SizedPixelFormat.RG32UI:case a.SizedPixelFormat.RGBA16F:case a.SizedPixelFormat.RGBA16I:case a.SizedPixelFormat.RGBA16UI:return 8;case a.SizedPixelFormat.RGB32F:case a.SizedPixelFormat.RGB32I:case a.SizedPixelFormat.RGB32UI:return 12;case a.SizedPixelFormat.RGBA32F:case a.SizedPixelFormat.RGBA32I:case a.SizedPixelFormat.RGBA32UI:return 16; |
|
case a.CompressedTextureFormat.COMPRESSED_RGB_S3TC_DXT1_EXT:case a.CompressedTextureFormat.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case a.CompressedTextureFormat.COMPRESSED_RGBA_S3TC_DXT3_EXT:case a.CompressedTextureFormat.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case a.CompressedTextureFormat.COMPRESSED_R11_EAC:case a.CompressedTextureFormat.COMPRESSED_SIGNED_R11_EAC:case a.CompressedTextureFormat.COMPRESSED_RGB8_ETC2:case a.CompressedTextureFormat.COMPRESSED_SRGB8_ETC2:case a.CompressedTextureFormat.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case a.CompressedTextureFormat.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5; |
|
case a.CompressedTextureFormat.COMPRESSED_RG11_EAC:case a.CompressedTextureFormat.COMPRESSED_SIGNED_RG11_EAC:case a.CompressedTextureFormat.COMPRESSED_RGBA8_ETC2_EAC:case a.CompressedTextureFormat.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0};h.getErrorString=n;h.getStride=p;h.unbindVertexBufferLayout=function(b,k,g,d){const l=b.gl;b.bindBuffer(g);for(const f of d)if(g=k.get(f.name),4>=f.count)l.disableVertexAttribArray(g),f.divisor&&0<f.divisor&&b.gl?.vertexAttribDivisor(g,0);else if(9===f.count)for(d= |
|
0;3>d;d++)l.disableVertexAttribArray(g+d),f.divisor&&0<f.divisor&&b.gl?.vertexAttribDivisor(g+d,0);else if(16===f.count)for(d=0;4>d;d++)l.disableVertexAttribArray(g+d),f.divisor&&0<f.divisor&&b.gl?.vertexAttribDivisor(g+d,0);else console.error("Unsupported vertex attribute element count: "+f.count);b.unbindBuffer(a.BufferType.ARRAY_BUFFER)};h.vertexCount=function(b,k){return b.vertexBuffers[k].usedMemory/p(b.layout[k])};Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}); |