@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.16 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{vertexLayoutHash as t}from"./shaderGraph/techniques/mesh/utils.js";import{BufferObject as e}from"../../../webgl/BufferObject.js";import{DataType as r,Usage as s,PrimitiveType as i}from"../../../webgl/enums.js";import{VertexArrayObject as o}from"../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as a}from"../../../webgl/VertexElementDescriptor.js";class n{constructor(i,n){this._rctx=i,this._attributes=[{name:"position",offset:0,type:r.SHORT,count:2}],this.layout={hash:t(this._attributes),attributes:this._attributes,stride:4},this._vertexBuffer=e.createVertex(i,s.STATIC_DRAW,new Uint16Array(n)),this._vao=new o(i,new Map([["a_position",0]]),new Map([["geometry",[new a("a_position",2,r.SHORT,0,4)]]]),new Map([["geometry",this._vertexBuffer]])),this._count=n.length/2}bind(){this._rctx.bindVAO(this._vao)}unbind(){this._rctx.bindVAO(null)}dispose(){this._vao.dispose()}draw(){this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.TRIANGLE_STRIP,0,this._count)}}export{n as default};