-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
improvements to EntityManagers and Filament APIs #7302
Conversation
- we used to to this by deleting operator delete, but this prevented the internal "F" classes from being virtual; which can be useful when using EntityManger::Listener. now we just make the destructor protected in each class. - EntityManger::Listener now has a virtual destructor so that objects could be correctly destroyed from Listener*
- all component managers now have the same "base" API - getComponentCount() - empty() - getEntity() - getEntities() - Scene now has getEntityCount() - EntityManager now has getEntityCount() - all component manager implement gc() the same way, by calling destroy() - SingleInstanceComponentManager::gc() that calls removeComponent() has been removed because it's dangerous. removeComponent() is often not enough, some additional cleanup might be needed.
// prevent heap allocation | ||
~DebugRegistry() = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make FilamentAPI
's destructor protected
instead of individually on all the subclasses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that doesn't help, because the destructor is still public: https://godbolt.org/z/7P19eWsP5
* prevent public classes from being created on the stack - we used to to this by deleting operator delete, but this prevented the internal "F" classes from being virtual; which can be useful when using EntityManger::Listener. now we just make the destructor protected in each class. - EntityManger::Listener now has a virtual destructor so that objects could be correctly destroyed from Listener* * improve EntityManger and Component managers - all component managers now have the same "base" API - getComponentCount() - empty() - getEntity() - getEntities() - Scene now has getEntityCount() - EntityManager now has getEntityCount() - all component manager implement gc() the same way, by calling destroy() - SingleInstanceComponentManager::gc() that calls removeComponent() has been removed because it's dangerous. removeComponent() is often not enough, some additional cleanup might be needed.
* prevent public classes from being created on the stack - we used to to this by deleting operator delete, but this prevented the internal "F" classes from being virtual; which can be useful when using EntityManger::Listener. now we just make the destructor protected in each class. - EntityManger::Listener now has a virtual destructor so that objects could be correctly destroyed from Listener* * improve EntityManger and Component managers - all component managers now have the same "base" API - getComponentCount() - empty() - getEntity() - getEntities() - Scene now has getEntityCount() - EntityManager now has getEntityCount() - all component manager implement gc() the same way, by calling destroy() - SingleInstanceComponentManager::gc() that calls removeComponent() has been removed because it's dangerous. removeComponent() is often not enough, some additional cleanup might be needed.
* prevent public classes from being created on the stack - we used to to this by deleting operator delete, but this prevented the internal "F" classes from being virtual; which can be useful when using EntityManger::Listener. now we just make the destructor protected in each class. - EntityManger::Listener now has a virtual destructor so that objects could be correctly destroyed from Listener* * improve EntityManger and Component managers - all component managers now have the same "base" API - getComponentCount() - empty() - getEntity() - getEntities() - Scene now has getEntityCount() - EntityManager now has getEntityCount() - all component manager implement gc() the same way, by calling destroy() - SingleInstanceComponentManager::gc() that calls removeComponent() has been removed because it's dangerous. removeComponent() is often not enough, some additional cleanup might be needed.
we used to to this by deleting operator delete, but this prevented
the internal "F" classes from being virtual; which can be useful
when using EntityManger::Listener.
now we just make the destructor protected in each class.
EntityManger::Listener now has a virtual destructor so that
objects could be correctly destroyed from Listener*
all component managers now have the same "base" API
Scene now has getEntityCount()
EntityManager now has getEntityCount()
all component manager implement gc() the same way, by calling destroy()
SingleInstanceComponentManager::gc() that calls removeComponent() has
been removed because it's dangerous. removeComponent() is often
not enough, some additional cleanup might be needed.