From a61fe711e294e98efa7e0fafa7de641bab69cbd8 Mon Sep 17 00:00:00 2001 From: XiaoFeng Date: Fri, 27 Nov 2015 14:01:43 +0800 Subject: [PATCH] Update --- cocos/3d/CCMesh.cpp | 2 +- cocos/3d/CCMesh.h | 2 +- cocos/3d/CCPlane.cpp | 4 ++-- cocos/3d/CCPlane.h | 2 +- cocos/3d/CCSprite3D.cpp | 29 ----------------------------- cocos/3d/CCSprite3D.h | 10 ---------- 6 files changed, 5 insertions(+), 44 deletions(-) diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index f48510e672..30d3547e02 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -662,7 +662,7 @@ GLuint Mesh::getIndexBuffer() const return _meshIndexData->getIndexBuffer()->getVBO(); } -GLuint Mesh::checkTextureName() +GLuint Mesh::getTextureName() { if (TextureCache::getInstance()->isDirty()) { diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h index ad5cff369d..964850e0e9 100644 --- a/cocos/3d/CCMesh.h +++ b/cocos/3d/CCMesh.h @@ -194,7 +194,7 @@ public: */ void setForce2DQueue(bool force2D) { _force2DQueue = force2D; } - GLuint checkTextureName(); + GLuint getTextureName(); CC_CONSTRUCTOR_ACCESS: diff --git a/cocos/3d/CCPlane.cpp b/cocos/3d/CCPlane.cpp index 5b8acc4a94..3fa0b7f8b9 100755 --- a/cocos/3d/CCPlane.cpp +++ b/cocos/3d/CCPlane.cpp @@ -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; diff --git a/cocos/3d/CCPlane.h b/cocos/3d/CCPlane.h index 650c9c8655..87509b32f3 100755 --- a/cocos/3d/CCPlane.h +++ b/cocos/3d/CCPlane.h @@ -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 diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 0e8e4198fa..f5178acc02 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -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() diff --git a/cocos/3d/CCSprite3D.h b/cocos/3d/CCSprite3D.h index be9defb3a3..fa5a23ea99 100644 --- a/cocos/3d/CCSprite3D.h +++ b/cocos/3d/CCSprite3D.h @@ -205,16 +205,6 @@ public: */ const Vector& 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();