@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.01 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{vertexLayoutHash as t}from"./shaderGraph/techniques/mesh/utils.js";import{DataType as s,PrimitiveType as e}from"../../../webgl/enums.js";import{VertexArrayObject as r}from"../../../webgl/VertexArrayObject.js";import{VertexBuffer as i}from"../../../webgl/VertexBuffer.js";import{VertexElementDescriptor as o}from"../../../webgl/VertexElementDescriptor.js";class a{constructor(e,a){this._rctx=e,this._attributes=[{name:"position",offset:0,type:s.SHORT,count:2}],this.layout={hash:t(this._attributes),attributes:this._attributes,stride:4},this._vertexBuffer=new i(e,[new o("a_position",2,s.SHORT,0,4)],new Uint16Array(a)),this._vao=new r(e,this._vertexBuffer),this._count=a.length/2}get locations(){return this._vao.locations}bind(){this._rctx.bindVAO(this._vao)}unbind(){this._rctx.bindVAO(null)}dispose(){this._vao.dispose()}draw(){this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.TRIANGLE_STRIP,0,this._count)}}export{a as default};