Skip to content

Commit 379db47

Browse files
author
aardgoose
committed
implemenet destroyAttribute()
1 parent 2b8971b commit 379db47

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

examples/jsm/renderers/webgl/WebGLBackend.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import WebGLTextureUtils from './utils/WebGLTextureUtils.js';
1010
import WebGLExtensions from './utils/WebGLExtensions.js';
1111
import WebGLCapabilities from './utils/WebGLCapabilities.js';
1212
import { DepthFormat } from '../../../../src/constants.js';
13+
import { attribute } from '../../nodes/Nodes.js';
1314

1415
//
1516

@@ -893,9 +894,9 @@ class WebGLBackend extends Backend {
893894

894895
}
895896

896-
destroyAttribute( /*attribute*/ ) {
897+
destroyAttribute( attribute ) {
897898

898-
console.warn( 'Abstract class.' );
899+
this.attributeUtils.destroyAttribute( attribute );
899900

900901
}
901902

examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,25 @@ class WebGLAttributeUtils {
134134

135135
}
136136

137+
destroyAttribute( attribute ) {
138+
139+
const backend = this.backend;
140+
const { gl } = backend;
141+
142+
if ( attribute.isInterleavedBufferAttribute ) {
143+
144+
backend.delete( attribute.data );
145+
146+
}
147+
148+
const attributeData = backend.get( attribute );
149+
150+
gl.deleteBuffer( attributeData.bufferGPU );
151+
152+
backend.delete( attribute );
153+
154+
}
155+
137156
async getArrayBufferAsync( attribute ) {
138157

139158
const backend = this.backend;

0 commit comments

Comments
 (0)