mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/super626/cocos2d-x into v3
This commit is contained in:
commit
d23eb83ba1
|
@ -87,6 +87,7 @@ static const char* TRANSLATION = "translation";
|
||||||
static const char* ROTATION = "rotation";
|
static const char* ROTATION = "rotation";
|
||||||
static const char* SCALE = "scale";
|
static const char* SCALE = "scale";
|
||||||
static const char* KEYTIME = "keytime";
|
static const char* KEYTIME = "keytime";
|
||||||
|
static const char* AABBS = "aabb";
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -431,8 +432,23 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
|
||||||
}
|
}
|
||||||
meshData->subMeshIndices.push_back(indexArray);
|
meshData->subMeshIndices.push_back(indexArray);
|
||||||
meshData->numIndex = (int)meshData->subMeshIndices.size();
|
meshData->numIndex = (int)meshData->subMeshIndices.size();
|
||||||
|
//meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
||||||
|
if (_version != "0.3" && _version != "0.4" && _version != "0.5")
|
||||||
|
{
|
||||||
|
//read mesh aabb
|
||||||
|
float aabb[6];
|
||||||
|
if (_binaryReader.read(aabb, 4, 6) != 6)
|
||||||
|
{
|
||||||
|
CCLOG("warning: Failed to read meshdata: aabb '%s'.", _path.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
meshData->subMeshAABB.push_back(AABB(Vec3(aabb[0], aabb[1], aabb[2]), Vec3(aabb[3], aabb[4], aabb[5])));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
meshdatas.meshDatas.push_back(meshData);
|
meshdatas.meshDatas.push_back(meshData);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -710,8 +726,20 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas)
|
||||||
|
|
||||||
meshData->subMeshIndices.push_back(indexArray);
|
meshData->subMeshIndices.push_back(indexArray);
|
||||||
meshData->numIndex = (int)meshData->subMeshIndices.size();
|
meshData->numIndex = (int)meshData->subMeshIndices.size();
|
||||||
|
|
||||||
|
//meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
||||||
|
const rapidjson::Value& mesh_part_aabb = mesh_part[AABBS];
|
||||||
|
if (mesh_part.HasMember(AABBS) && mesh_part_aabb.Size() == 6)
|
||||||
|
{
|
||||||
|
Vec3 min = Vec3(mesh_part_aabb[(rapidjson::SizeType)0].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)1].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)2].GetDouble());
|
||||||
|
Vec3 max = Vec3(mesh_part_aabb[(rapidjson::SizeType)3].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)4].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)5].GetDouble());
|
||||||
|
meshData->subMeshAABB.push_back(AABB(min, max));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
meshData->subMeshAABB.push_back(calculateAABB(meshData->vertex, meshData->getPerVertexSize(), indexArray));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
meshdatas.meshDatas.push_back(meshData);
|
meshdatas.meshDatas.push_back(meshData);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue