agargaro / instanced-mesh

Enhanced InstancedMesh with frustum culling, fast raycasting (using BVH), sorting, visibility management, LOD and more.
MIT License
132 stars 9 forks source link

Create/remove InstancedEntity API #13

Open tobiascornille opened 1 month ago

tobiascornille commented 1 month ago

I'm converting part of an existing app to use instancing. In different parts of the codebase, the same object is created, so I'd like to replace those with instances. I figured out I can create InstancedEntities myself and use a shared InstancedMesh2. However, I still have to manage the current instance index when adding instances,and I still have to swap instances when removing an instance.

Would you be open for an API addition on InstancedMesh2 that'd allow users to add and remove InstancedEntities explicitly? If so, I could prepare a PR.

agargaro commented 1 month ago

I have actually already started working on this.

I would like to be able to handle the array of instances in the same way that arrays are handled in javascript.

If you'd like we can write to each other on discord (there is the server linked in the README), so you can help me implement and decide the API if you want 😄

tobiascornille commented 1 month ago

Awesome, will join indeed ❤️