Rastar Posted January 5, 2015 Share Posted January 5, 2015 I would like to have a hook function getting called for every entity in the scene, without explicitly registering it for every entity. There is a hook in the Map::Load function, but my guess is that would not work for dynamically created entities (?) Is there a method for that? Quote Link to comment Share on other sites More sharing options...
Roland Posted January 6, 2015 Share Posted January 6, 2015 Hi. You can see me doing that in this video at around 17:00 http://youtu.be/Utb3z4hs79Q?t=17m14s 1 Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Rastar Posted January 6, 2015 Author Share Posted January 6, 2015 Hi Roland, thanks for answering! Yes, that should work for entities loaded with the map, but I would also like to hook into events for dynamically created entities. And since I am writing some sort of generic, reusable C++ library that doesn't know about entity creation by other parts of the code, I cannot simply hard-code a hook registration after e.g. a call to Model::Create(). So I was looking for a possibility to generically hook into events for any entity, not just map-based ones. I would like to write some information about every entity in the scene after it has been rendered (using DrawHook) into GPU buffers, for later usage in the post-processing. Is there such a registration call? I am thinking of something like World::EntityInstantiatedHook (which obviously doesn't exist). Quote Link to comment Share on other sites More sharing options...
Rick Posted January 6, 2015 Share Posted January 6, 2015 I think you'd have to loop over the world->entities list to get all entities loaded (this will be via the map or manual load it doesn't matter. if it got loaded and a world was created it'll be part of that world). So basically you can make your own function like you describe if you like via this method. Quote Link to comment Share on other sites More sharing options...
Rastar Posted January 6, 2015 Author Share Posted January 6, 2015 Thanks Rick, that's a good idea. Especially since I can make good use of the World::ForEachEntityInAABBDo variant for my use case. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.