mirror of https://github.com/axmolengine/axmol.git
fix issue#9310 issue#10151 issue#12551
This commit is contained in:
parent
77f1af91f9
commit
a1956e2210
|
@ -367,6 +367,8 @@ void Animate3D::update(float t)
|
||||||
}
|
}
|
||||||
node->setAdditionalTransform(&transform);
|
node->setAdditionalTransform(&transform);
|
||||||
}
|
}
|
||||||
|
if (onAnimateUpdate != nullptr)
|
||||||
|
onAnimateUpdate(t * getDuration(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,8 @@ public:
|
||||||
/**get animate quality*/
|
/**get animate quality*/
|
||||||
Animate3DQuality getQuality() const;
|
Animate3DQuality getQuality() const;
|
||||||
|
|
||||||
|
std::function<void(float keyTime, Animate3D* animate)> onAnimateUpdate;
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
||||||
Animate3D();
|
Animate3D();
|
||||||
|
|
|
@ -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)
|
bool Sprite3D::loadFromCache(const std::string& path)
|
||||||
{
|
{
|
||||||
auto spritedata = Sprite3DCache::getInstance()->getSpriteData(path);
|
auto spritedata = Sprite3DCache::getInstance()->getSpriteData(path);
|
||||||
|
@ -775,18 +789,7 @@ const BlendFunc& Sprite3D::getBlendFunc() const
|
||||||
|
|
||||||
AABB Sprite3D::getAABBRecursively()
|
AABB Sprite3D::getAABBRecursively()
|
||||||
{
|
{
|
||||||
AABB aabb;
|
return getAABBRecursivelyImp(this);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const AABB& Sprite3D::getAABB() const
|
const AABB& Sprite3D::getAABB() const
|
||||||
|
|
|
@ -234,6 +234,8 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
||||||
void afterAsyncLoad(void* param);
|
void afterAsyncLoad(void* param);
|
||||||
|
|
||||||
|
static AABB getAABBRecursivelyImp(Node *node);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Skeleton3D* _skeleton; //skeleton
|
Skeleton3D* _skeleton; //skeleton
|
||||||
|
|
|
@ -1032,10 +1032,12 @@ void Effect3DOutline::draw(const Mat4 &transform)
|
||||||
_glProgramState->setUniformVec4("u_color", Vec4(color.r, color.g, color.b, color.a));
|
_glProgramState->setUniformVec4("u_color", Vec4(color.r, color.g, color.b, color.a));
|
||||||
if(_sprite && _sprite->getMesh())
|
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);
|
glEnable(GL_CULL_FACE);
|
||||||
glCullFace(GL_FRONT);
|
glCullFace(cullFace);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
auto mesh = _sprite->getMesh();
|
auto mesh = _sprite->getMesh();
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, mesh->getVertexBuffer());
|
glBindBuffer(GL_ARRAY_BUFFER, mesh->getVertexBuffer());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue