Am 03.05.2014 16:43, schrieb "Ola Fosheim Grøstad" <ola.fosheim.grostad+dl...@gmail.com>":
On Saturday, 3 May 2014 at 14:31:59 UTC, Paulo Pinto wrote:
- Make all scene graph nodes IDisposable.

- Have a using(rootNode) {} on your render loop

That would work for a static scene.

But you want to mark resources ready for release when nodes are removed
from the graph dynamically. In most cases shared pointers (ref counting)
would work, but if you allow "fractal" recursion then you will get
cycles. (e.g. meshnode->scaleRND->rotateRND->stopIfTooSmall->meshnode )

Easy, you already know that you don't need the node, just call the dispose method, instead of marking for release.

Cannot release right away? Place them in a "to be removed" queue and do the cleaning in a specific controlled point.

--
Paulo

Reply via email to