import { gl , IElements , IElementsInitializationOptions , } from '@antv/g-webgpu-core' ; import regl from 'regl' ; import { dataTypeMap , usageMap } from './constants' ; see https export default class ReglElements implements IElements { private elements : regl . Elements ; constructor ( reGl , options ) { const { data , usage , type , count } = options ; this . elements = reGl . elements ( { data , usage : usageMap [ usage || gl . STATIC_DRAW ] , type : dataTypeMap [ type || gl . UNSIGNED_BYTE ] as 'uint8' | 'uint16' | 'uint32' , count , } ) ; } public get ( ) { return this . elements ; } public subData ( { data , } ) { this . elements . subdata ( data ) ; } public destroy ( ) { this . elements . destroy ( ) ; } }