From d6ed1af1f766efecac59f2102fa54b0c74eb7771 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Mon, 18 Aug 2014 18:34:18 +0800 Subject: [PATCH] compute submesh aabb error --- cocos/3d/CCMesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index 309c2d2ab9..364f92aca9 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -252,9 +252,9 @@ void Mesh::buildSubMeshes() //calculate aabb for sub mesh AABB aabb; int stride = _renderdata._vertexsizeBytes / sizeof(float); - for(size_t i = 0; i < it.size(); i++) + for(const auto& index : it) { - Vec3 point = Vec3(_renderdata._vertexs[it[i * stride] ], _renderdata._vertexs[ it[i * stride + 1] ], _renderdata._vertexs[it[i * stride + 2] ]); + Vec3 point = Vec3(_renderdata._vertexs[index * stride ], _renderdata._vertexs[ index * stride + 1], _renderdata._vertexs[index * stride + 2 ]); aabb.updateMinMax(&point, 1); } subMesh->_aabb = aabb;