Merge pull request #140 from tangziwen/v3

fix mesh AABB incorrect calculation through using static variable
This commit is contained in:
XiaoYang 2014-10-14 09:23:13 +08:00
commit c171a8772d
2 changed files with 3 additions and 3 deletions

View File

@ -121,9 +121,9 @@ MeshVertexData* MeshVertexData::create(const MeshData& meshdata)
return vertexdata;
}
const AABB& MeshVertexData::calculateAABB(const std::vector<float>& vertex, int stride, const std::vector<unsigned short>& index)
AABB MeshVertexData::calculateAABB(const std::vector<float>& vertex, int stride, const std::vector<unsigned short>& index)
{
static AABB aabb;
AABB aabb;
stride /= 4;
for(const auto& it : index)
{

View File

@ -115,7 +115,7 @@ CC_CONSTRUCTOR_ACCESS:
MeshVertexData();
virtual ~MeshVertexData();
static const AABB& calculateAABB(const std::vector<float>& vertex, int stride, const std::vector<unsigned short>& index);
static AABB calculateAABB(const std::vector<float>& vertex, int stride, const std::vector<unsigned short>& index);
protected:
VertexData* _vertexData; //mesh vertex data
VertexBuffer* _vertexBuffer; // vertex buffer