Added asGroup() and asTransform() methods to osg::Node to downcast nodes
to these types without requiring an expensive dynamic_cast<>. Also added asGeometry() to osg::Drawable for the same reasons.
This commit is contained in:
@@ -229,7 +229,7 @@ bool Group::computeBound() const
|
||||
itr!=_children.end();
|
||||
++itr)
|
||||
{
|
||||
const osg::Transform* transform = dynamic_cast<const osg::Transform*>(itr->get());
|
||||
const osg::Transform* transform = (*itr)->asTransform();
|
||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_PARENTS)
|
||||
{
|
||||
bb.expandBy((*itr)->getBound());
|
||||
@@ -244,7 +244,7 @@ bool Group::computeBound() const
|
||||
itr!=_children.end();
|
||||
++itr)
|
||||
{
|
||||
const osg::Transform* transform = dynamic_cast<const osg::Transform*>(itr->get());
|
||||
const osg::Transform* transform = (*itr)->asTransform();
|
||||
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_TO_PARENTS)
|
||||
{
|
||||
_bsphere.expandRadiusBy((*itr)->getBound());
|
||||
|
||||
Reference in New Issue
Block a user