mirror of https://github.com/axmolengine/axmol.git
modify getAABBRecursively
This commit is contained in:
parent
3b01222787
commit
a7a39d71f5
|
@ -820,6 +820,22 @@ const BlendFunc& Sprite3D::getBlendFunc() const
|
|||
return _blend;
|
||||
}
|
||||
|
||||
AABB Sprite3D::getAABBRecursively()
|
||||
{
|
||||
AABB aabb;
|
||||
const Vector<Node*>& children = getChildren();
|
||||
for (const auto& iter : children)
|
||||
{
|
||||
Sprite3D* child = dynamic_cast<Sprite3D*>(iter);
|
||||
if(child)
|
||||
{
|
||||
aabb.merge(child->getAABBRecursively());
|
||||
}
|
||||
}
|
||||
aabb.merge(getAABB());
|
||||
return aabb;
|
||||
}
|
||||
|
||||
const AABB& Sprite3D::getAABB() const
|
||||
{
|
||||
Mat4 nodeToWorldTransform(getNodeToWorldTransform());
|
||||
|
@ -832,6 +848,8 @@ const AABB& Sprite3D::getAABB() const
|
|||
else
|
||||
{
|
||||
_aabb.reset();
|
||||
if (_meshes.size())
|
||||
{
|
||||
Mat4 transform(nodeToWorldTransform);
|
||||
for (const auto& it : _meshes) {
|
||||
if (it->isVisible())
|
||||
|
@ -842,6 +860,7 @@ const AABB& Sprite3D::getAABB() const
|
|||
_nodeToWorldTransform = nodeToWorldTransform;
|
||||
_aabbDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
return _aabb;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public:
|
|||
* the Sprite3D don't contain any meshes, so getAABB()
|
||||
* will return a wrong value at that time.
|
||||
*/
|
||||
const AABB& getAABBRecursively();
|
||||
AABB getAABBRecursively();
|
||||
|
||||
/**
|
||||
* Executes an action, and returns the action that is executed. For Sprite3D special logic are needed to take care of Fading.
|
||||
|
|
Loading…
Reference in New Issue