I used the CTerrainSceneNode as a reference, but i dont see it storing or removing any mesh buffers to a cache. Now please correct me if im wrong, but isnt it so that you can optionally add meshes to the mesh cache and if you do then you should make sure you remove them when dropping the mesh (when you want to completely remove it)?
*Edit:
I think i found the answer to the above question. un less you set the EHM_NEVER the drawmeshbuffer call will decide whether it is usefull to create a hardware buffer.
Also my issue with the meshbuffers randomly not being dropped because the ref count is 1, this is still a bit wierd to me. Since I drop all the mesh buffers using the same code i would expect either all meshbuffers being dropped correctly or all of them not dropping.
Killing reference counted objects
Re: Killing reference counted objects
All that stuff should be done by using RAII.
Imho its horrible that users are responsible to drop the object, reference counting is better done with smart-pointers like std::shared_ptr/boost::shared_ptr.
That is a guarantee to avoid memory leaks and it has absolutly no overhead compared to calling drop manually.
Imho its horrible that users are responsible to drop the object, reference counting is better done with smart-pointers like std::shared_ptr/boost::shared_ptr.
That is a guarantee to avoid memory leaks and it has absolutly no overhead compared to calling drop manually.