diff --git a/cocos/3d/CCMeshVertexIndexData.cpp b/cocos/3d/CCMeshVertexIndexData.cpp index 3bb77ddefb..513805ccb2 100644 --- a/cocos/3d/CCMeshVertexIndexData.cpp +++ b/cocos/3d/CCMeshVertexIndexData.cpp @@ -121,9 +121,9 @@ MeshVertexData* MeshVertexData::create(const MeshData& meshdata) return vertexdata; } -const AABB& MeshVertexData::calculateAABB(const std::vector& vertex, int stride, const std::vector& index) +AABB MeshVertexData::calculateAABB(const std::vector& vertex, int stride, const std::vector& index) { - static AABB aabb; + AABB aabb; stride /= 4; for(const auto& it : index) { diff --git a/cocos/3d/CCMeshVertexIndexData.h b/cocos/3d/CCMeshVertexIndexData.h index 400ceaa5b2..f66f1d95aa 100644 --- a/cocos/3d/CCMeshVertexIndexData.h +++ b/cocos/3d/CCMeshVertexIndexData.h @@ -115,7 +115,7 @@ CC_CONSTRUCTOR_ACCESS: MeshVertexData(); virtual ~MeshVertexData(); - static const AABB& calculateAABB(const std::vector& vertex, int stride, const std::vector& index); + static AABB calculateAABB(const std::vector& vertex, int stride, const std::vector& index); protected: VertexData* _vertexData; //mesh vertex data VertexBuffer* _vertexBuffer; // vertex buffer