Revert "Fixed mesh centering"

This reverts commit 504042119962c2ab55fe8ef9bb16bcc878fa1b38 [formerly fae2cf41a63c7ce599c227344478567b1f12f130].

Conflicts:
	src/Nazara/Utility/Loaders/MD5Mesh/Loader.cpp

Former-commit-id: 6bd25fd7216121cce6879d74c6c98fbba545f2cf
This commit is contained in:
Lynix 2015-01-25 23:55:36 +01:00
parent eed90cb683
commit 1219a8053c
3 changed files with 7 additions and 26 deletions

View File

@ -163,6 +163,9 @@ namespace
subMesh->SetMaterialIndex(meshes[i].material);
subMesh->SetPrimitiveMode(nzPrimitiveMode_TriangleList);
if (parameters.mesh.center)
subMesh->Center();
// Ce que nous pouvons générer dépend des données à disposition (par exemple les tangentes nécessitent des coordonnées de texture)
if (hasNormals && hasTexCoords)
subMesh->GenerateTangents();
@ -174,18 +177,6 @@ namespace
mesh->AddSubMesh(meshes[i].name + '_' + materials[meshes[i].material], subMesh);
}
if (parameters.mesh.center)
{
unsigned int subMeshCount = mesh->GetSubMeshCount();
for (unsigned int i = 0; i < subMeshCount; ++i)
{
NzStaticMesh* subMesh = static_cast<NzStaticMesh*>(mesh->GetSubMesh(i));
subMesh->Center();
}
mesh->InvalidateAABB();
}
mesh->SetMaterialCount(parser.GetMaterialCount());
model->SetMesh(mesh);

View File

@ -278,22 +278,14 @@ namespace
subMesh->GenerateNormalsAndTangents();
subMesh->SetMaterialIndex(i);
if (parameters.center)
subMesh->Center();
mesh->AddSubMesh(subMesh);
// Material
mesh->SetMaterial(i, baseDir + md5Mesh.shader);
}
if (parameters.center)
{
for (unsigned int i = 0; i < meshCount; ++i)
{
NzStaticMesh* subMesh = static_cast<NzStaticMesh*>(mesh->GetSubMesh(i));
subMesh->Center();
}
mesh->InvalidateAABB();
}
}
return true;

View File

@ -23,9 +23,7 @@ NzStaticMesh::~NzStaticMesh()
void NzStaticMesh::Center()
{
///DOC: Invalider l'AABB après ça
NzBoxf aabb(m_parent->GetAABB());
NzVector3f offset(aabb.x + aabb.width/2.f, aabb.y + aabb.height/2.f, aabb.z + aabb.depth/2.f);
NzVector3f offset(m_aabb.x + m_aabb.width/2.f, m_aabb.y + m_aabb.height/2.f, m_aabb.z + m_aabb.depth/2.f);
NzVertexMapper mapper(this);
NzSparsePtr<NzVector3f> position = mapper.GetComponentPtr<NzVector3f>(nzVertexComponent_Position);