mirror of https://github.com/axmolengine/axmol.git
Merge pull request #140 from tangziwen/v3
fix mesh AABB incorrect calculation through using static variable
This commit is contained in:
commit
c171a8772d
|
@ -121,9 +121,9 @@ MeshVertexData* MeshVertexData::create(const MeshData& meshdata)
|
||||||
return vertexdata;
|
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;
|
stride /= 4;
|
||||||
for(const auto& it : index)
|
for(const auto& it : index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,7 +115,7 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
MeshVertexData();
|
MeshVertexData();
|
||||||
virtual ~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:
|
protected:
|
||||||
VertexData* _vertexData; //mesh vertex data
|
VertexData* _vertexData; //mesh vertex data
|
||||||
VertexBuffer* _vertexBuffer; // vertex buffer
|
VertexBuffer* _vertexBuffer; // vertex buffer
|
||||||
|
|
Loading…
Reference in New Issue