pex-gl / pex-renderer

Physically based renderer (PBR) and scene graph for PEX.
https://pex-gl.github.io/pex-renderer/examples/index.html
MIT License
236 stars 16 forks source link

Geometry dispose doesn't delete buffers #202

Closed dmnsgn closed 1 year ago

dmnsgn commented 5 years ago

See glTF example where changing models keeps increasing the numbers of buffers.

dmnsgn commented 5 years ago

Current workaround:

function cleanUpGeometryBuffers(ctx, geometry) {
  if (geometry._indices.buffer) ctx.dispose(geometry._indices.buffer)

  Object.values(geometry._attributes).forEach((attribute) => {
    if (attribute.buffer) ctx.dispose(attribute.buffer)
  });
}
dmnsgn commented 1 year ago

v4: we have no dispose implemented anywhere

vorg commented 1 year ago

New World and RenderEngine classes implements dispose by calling dispose on all the system

dmnsgn commented 1 year ago

Added option to pass entities to render engine too in 12adc6c