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

RenderComponent - ability to dynamically add/remove MeshInstance. #6680

Open
Maksims opened this issue Jun 10, 2024 · 0 comments
Open

RenderComponent - ability to dynamically add/remove MeshInstance. #6680

Maksims opened this issue Jun 10, 2024 · 0 comments
Labels
area: graphics Graphics related issue feature request

Comments

@Maksims
Copy link
Contributor

Maksims commented Jun 10, 2024

When creating procedural meshes, sometimes it is beneficial to add them to a single render component. Currently, if you set a new array of mesh instances, previous ones will be destroyed - which is not always desirable. So adding mesh instances not in one go is not convenient atm.

I wrote a quick workaround for this:

// add MeshInstance to RenderComponent
const meshInstances = entity.render.meshInstances.slice(0);
entity.render._meshInstances = [];
meshInstances.push(this.meshInstance);
entity.render.meshInstances = meshInstances;

Of course this is not great, so it would be good to have a public API for it, something like:

entity.render.addMeshInstance(meshInstasnce);
entity.render.removeMeshInstance(meshInstance);
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue feature request
Projects
None yet
Development

No branches or pull requests

2 participants