Which is more efficient

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
machineonpointer
Kobold
Posts: 35
Joined: Fri Dec 06, 2013 4:15 am

Which is more efficient

Post by machineonpointer »

If there are many scene nodes created from same entity, which are managed dynamically at run-time, which way is more efficient to make them visible/invisible?
call function sceneNode->setVisible(visibility) only
OR
call parentNode->removeChild(sceneNode) to remove sceneNode from it's parent.

According to my understanding, if only setVisible function is called to make the nodes invisible,
then OGRE engine will need to check this node for its visibility.
But if the node is removed from its parent and becomes free, there is no such necessary. However it takes extra time to remove from it's parent, which may be time-consuming.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Re: Which is more efficient

Post by Crashy »

I think that removeChild is more efficient.
It is almost a removal from a list, and the node transform (and all it's child transform) won't be computed anymore.
With setVisible(false), the node transform will still be computed, even if it's not visible, so it is less optimal.

I'd suggest you to use setVisible if you still need the transform to be updated, and removeChild if you don't.
Follow la Moustache on Twitter or on Facebook
Image
Post Reply