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:
parent
eed90cb683
commit
1219a8053c
|
|
@ -163,6 +163,9 @@ namespace
|
||||||
subMesh->SetMaterialIndex(meshes[i].material);
|
subMesh->SetMaterialIndex(meshes[i].material);
|
||||||
subMesh->SetPrimitiveMode(nzPrimitiveMode_TriangleList);
|
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)
|
// 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)
|
if (hasNormals && hasTexCoords)
|
||||||
subMesh->GenerateTangents();
|
subMesh->GenerateTangents();
|
||||||
|
|
@ -174,18 +177,6 @@ namespace
|
||||||
mesh->AddSubMesh(meshes[i].name + '_' + materials[meshes[i].material], subMesh);
|
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());
|
mesh->SetMaterialCount(parser.GetMaterialCount());
|
||||||
|
|
||||||
model->SetMesh(mesh);
|
model->SetMesh(mesh);
|
||||||
|
|
|
||||||
|
|
@ -278,22 +278,14 @@ namespace
|
||||||
subMesh->GenerateNormalsAndTangents();
|
subMesh->GenerateNormalsAndTangents();
|
||||||
subMesh->SetMaterialIndex(i);
|
subMesh->SetMaterialIndex(i);
|
||||||
|
|
||||||
|
if (parameters.center)
|
||||||
|
subMesh->Center();
|
||||||
|
|
||||||
mesh->AddSubMesh(subMesh);
|
mesh->AddSubMesh(subMesh);
|
||||||
|
|
||||||
// Material
|
// Material
|
||||||
mesh->SetMaterial(i, baseDir + md5Mesh.shader);
|
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;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,7 @@ NzStaticMesh::~NzStaticMesh()
|
||||||
|
|
||||||
void NzStaticMesh::Center()
|
void NzStaticMesh::Center()
|
||||||
{
|
{
|
||||||
///DOC: Invalider l'AABB après ça
|
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);
|
||||||
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);
|
|
||||||
|
|
||||||
NzVertexMapper mapper(this);
|
NzVertexMapper mapper(this);
|
||||||
NzSparsePtr<NzVector3f> position = mapper.GetComponentPtr<NzVector3f>(nzVertexComponent_Position);
|
NzSparsePtr<NzVector3f> position = mapper.GetComponentPtr<NzVector3f>(nzVertexComponent_Position);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue