mirror of https://github.com/axmolengine/axmol.git
Update
This commit is contained in:
parent
09606e96cd
commit
a61fe711e2
|
@ -662,7 +662,7 @@ GLuint Mesh::getIndexBuffer() const
|
|||
return _meshIndexData->getIndexBuffer()->getVBO();
|
||||
}
|
||||
|
||||
GLuint Mesh::checkTextureName()
|
||||
GLuint Mesh::getTextureName()
|
||||
{
|
||||
if (TextureCache::getInstance()->isDirty())
|
||||
{
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
*/
|
||||
void setForce2DQueue(bool force2D) { _force2DQueue = force2D; }
|
||||
|
||||
GLuint checkTextureName();
|
||||
GLuint getTextureName();
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
|
|
|
@ -92,10 +92,10 @@ PointSide Plane::getSide(const Vec3& point) const
|
|||
return PointSide::IN_PLANE;
|
||||
}
|
||||
|
||||
PointSide Plane::getSide(const Vec3& point, const Vec3& halfSize) const
|
||||
PointSide Plane::getSide(const Vec3& point, const Vec3& tolerance) const
|
||||
{
|
||||
float dist = dist2Plane(point);
|
||||
float maxAbsDist = fabs(_normal.x * halfSize.x) + fabs(_normal.y * halfSize.y) + fabs(_normal.z * halfSize.z);
|
||||
float maxAbsDist = fabs(_normal.x * tolerance.x) + fabs(_normal.y * tolerance.y) + fabs(_normal.z * tolerance.z);
|
||||
|
||||
if (dist > maxAbsDist)
|
||||
return PointSide::FRONT_PLANE;
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
/**
|
||||
* Return the side where the point is.
|
||||
*/
|
||||
PointSide getSide(const Vec3& point, const Vec3& halfSize) const;
|
||||
PointSide getSide(const Vec3& point, const Vec3& tolerance) const;
|
||||
|
||||
protected:
|
||||
Vec3 _normal; // the normal line of the plane
|
||||
|
|
|
@ -895,35 +895,6 @@ void Sprite3D::setForce2DQueue(bool force2D)
|
|||
}
|
||||
}
|
||||
|
||||
const AABB& Sprite3D::getAABB(bool world) const
|
||||
{
|
||||
_aabbDirty = true;
|
||||
|
||||
Mat4 nodeToWorldTransform(getNodeToWorldTransform());
|
||||
|
||||
// If nodeToWorldTransform matrix isn't changed, we don't need to transform aabb.
|
||||
if (memcmp(_nodeToWorldTransform.m, nodeToWorldTransform.m, sizeof(Mat4)) == 0 && !_aabbDirty)
|
||||
{
|
||||
return _aabb;
|
||||
}
|
||||
else
|
||||
{
|
||||
_aabb.reset();
|
||||
Mat4 transform(nodeToWorldTransform);
|
||||
for (const auto& it : _meshes) {
|
||||
if (it->isVisible())
|
||||
_aabb.merge(it->getAABB());
|
||||
}
|
||||
|
||||
if (world)
|
||||
_aabb.transform(transform);
|
||||
|
||||
_nodeToWorldTransform = nodeToWorldTransform;
|
||||
}
|
||||
|
||||
return _aabb;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
Sprite3DCache* Sprite3DCache::_cacheInstance = nullptr;
|
||||
Sprite3DCache* Sprite3DCache::getInstance()
|
||||
|
|
|
@ -205,16 +205,6 @@ public:
|
|||
*/
|
||||
const Vector<Mesh*>& getMeshes() const { return _meshes; }
|
||||
|
||||
/*
|
||||
* Get AABB
|
||||
* If the sprite has animation, it can't be calculated accurately,
|
||||
* because bone can drive the vertices, we just use the origin vertices
|
||||
* to calculate the AABB.
|
||||
*
|
||||
* @param world Use world transform or not.
|
||||
*/
|
||||
const AABB& getAABB(bool world) const;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
Sprite3D();
|
||||
|
|
Loading…
Reference in New Issue