import { BufferData , IAttribute , IAttributeInitializationOptions , IBuffer , } from '@antv/g-webgpu-core' ; import regl from 'regl' ; import ReglBuffer from './ReglBuffer' ; see https export default class ReglAttribute implements IAttribute { private attribute : regl . Attribute ; private buffer : IBuffer ; constructor ( gl , options ) { const { buffer , offset , stride , normalized , size , divisor } = options ; this . buffer = buffer ; this . attribute = { buffer : ( buffer as ReglBuffer ) . get ( ) , offset : offset || 0 , stride : stride || 0 , normalized : normalized || false , divisor : divisor || 0 , } ; if ( size ) { this . attribute . size = size ; } } public get ( ) { return this . attribute ; } public updateBuffer ( options ) { this . buffer . subData ( options ) ; } public destroy ( ) { this . buffer . destroy ( ) ; } }