Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dispose() to BufferAttribute #15261

Closed
3 of 13 tasks
yaoyao-cn opened this issue Nov 16, 2018 · 4 comments
Closed
3 of 13 tasks

add dispose() to BufferAttribute #15261

yaoyao-cn opened this issue Nov 16, 2018 · 4 comments

Comments

@yaoyao-cn
Copy link
Contributor

is it possible to add a dispose() method to BufferAttribute?

i need to dispose buffer attribute directly, not through the buffer geometry.
so i will change BufferAttribute and WebGLAttributes a bit, but i am not sure whether i am right.

i will change like this:
1.Make BufferAttribute as a sub classs of EventDispatcher to dispatch the dispose event
2.Handle dispose event in WebGLAttributes

am i right? thank you !

Three.js version
  • Dev
  • r98
  • ...
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, ...)
@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 16, 2018

i need to dispose buffer attribute directly, not through the buffer geometry.

Can you please explain your use case a bit? How does your workflow look like?

@yaoyao-cn
Copy link
Contributor Author

@Mugen87
ok, let me try to explain my workflow.

i am developing a GIS system like goole earth web and i need to render the whole earth with DOM and DEM. the earth is renderd through dynamic tiles which are subdivided autometically base on the camera distance.
every tile is a buffer geometry initialized with no buffer attributes and index buffer. the buffer attributes and index buffer are set by the tile manager every frame. so the shape of the tile can change every frame depending on the incoming DOM and DEM data from internet.

tiles are cached, every frame the tile manager pick some free tiles, set the buffer attribute, construct meshes(meshes are also cached) and then add the meshes to the threejs scene. after the render process, the tile manager remove the meshes from threejs scene and mark the tiles used as free tiles again.

in a word. meshes , buffer geometries and buffer attributes are separated objects for the system. the system know how to dispose all of them. buffer attributes and index buffers are shared between buffer geometries.

so, i need a dispose method of buffer attribute. just like the Texture.dispose() of material.

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 25, 2018

I think that sounds reasonable.

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 3, 2020

Closing, see #17063 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants