3DModelerMan wrote:Oh okay. What do the drop() and remove() functions do then?
The documentation isn't really clear on what
remove() does, so I'm going to explain it.
drop(): All objects that inherit from
IReferenceCounted have a reference count. The count goes up when
grab() is called, and it goes down when
drop() is called. When the reference count goes to zero on a call to
drop() the object deletes itself.
remove(): Scene nodes are organized into a scene graph. Calling
remove() will remove the node from the scene graph. All scene nodes are reference counted, and the parent node holds a reference to the node that is being removed. When the node is removed from the scene graph, the parent calls
drop() on it. As mentioned previously, if/when the reference count goes to zero, the node deletes itself.
The destructor is called when the scene node is destroyed. This happens when an object allocated on the free store (heap) is deleted, or when it goes out of scope.
Of these functions, only
remove() and the destructor are virtual. Non-virtual functions can be overridden, but the override won't be called if the function is invoked through a base class pointer. If you want to do something special when a scene node is removed from the scene graph, you would put it in
remove(). If you want to do something special when the object is deallocated, you'd put it in the destructor.
Travis