fix issue#9310 issue#10151 issue#12551

This commit is contained in:
songchengjiang 2015-07-09 18:05:47 +08:00
parent 77f1af91f9
commit a1956e2210
5 changed files with 25 additions and 14 deletions

View File

@ -367,6 +367,8 @@ void Animate3D::update(float t)
}
node->setAdditionalTransform(&transform);
}
if (onAnimateUpdate != nullptr)
onAnimateUpdate(t * getDuration(), this);
}
}
}

View File

@ -118,6 +118,8 @@ public:
/**get animate quality*/
Animate3DQuality getQuality() const;
std::function<void(float keyTime, Animate3D* animate)> onAnimateUpdate;
CC_CONSTRUCTOR_ACCESS:

View File

@ -175,6 +175,20 @@ void Sprite3D::afterAsyncLoad(void* param)
}
}
AABB Sprite3D::getAABBRecursivelyImp(Node *node)
{
AABB aabb;
for (auto iter : node->getChildren()){
aabb.merge(getAABBRecursivelyImp(iter));
}
Sprite3D *sprite3d = dynamic_cast<Sprite3D*>(node);
if (sprite3d)
aabb.merge(sprite3d->getAABB());
return aabb;
}
bool Sprite3D::loadFromCache(const std::string& path)
{
auto spritedata = Sprite3DCache::getInstance()->getSpriteData(path);
@ -775,18 +789,7 @@ const BlendFunc& Sprite3D::getBlendFunc() const
AABB Sprite3D::getAABBRecursively()
{
AABB aabb;
const auto children = getChildren();
for (const auto iter: children)
{
Sprite3D* child = dynamic_cast<Sprite3D*>(iter);
if(child)
{
aabb.merge(child->getAABBRecursively());
}
}
aabb.merge(getAABB());
return aabb;
return getAABBRecursivelyImp(this);
}
const AABB& Sprite3D::getAABB() const

View File

@ -233,6 +233,8 @@ CC_CONSTRUCTOR_ACCESS:
void onAABBDirty() { _aabbDirty = true; }
void afterAsyncLoad(void* param);
static AABB getAABBRecursivelyImp(Node *node);
protected:

View File

@ -1032,10 +1032,12 @@ void Effect3DOutline::draw(const Mat4 &transform)
_glProgramState->setUniformVec4("u_color", Vec4(color.r, color.g, color.b, color.a));
if(_sprite && _sprite->getMesh())
{
GLenum cullFace = GL_FRONT;
if (_sprite->getScaleX() < 0.0f || _sprite->getScaleY() < 0.0f || _sprite->getScaleZ() < 0.0f)
cullFace = GL_BACK;
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glCullFace(cullFace);
glEnable(GL_DEPTH_TEST);
auto mesh = _sprite->getMesh();
glBindBuffer(GL_ARRAY_BUFFER, mesh->getVertexBuffer());