Fixed MD2/MD5 meshs not having normals/tangents
Former-commit-id: 9456620961fc7e75482b4fc29394934a3d695c5e
This commit is contained in:
parent
fc5b1ade9b
commit
afddcd0804
|
|
@ -269,13 +269,14 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
/// Chargement des positions
|
||||
for (unsigned int v = 0; v < header.num_vertices; ++v)
|
||||
{
|
||||
const md2_vertex& vert = vertices[v];
|
||||
NzVector3f position = rotationQuat * NzVector3f(vert.x * scale.x + translate.x, vert.y * scale.y + translate.y, vert.z * scale.z + translate.z);
|
||||
|
||||
vertex->normal = rotationQuat * md2Normals[vert.n];
|
||||
vertex->position = position;
|
||||
vertex->normal = rotationQuat * md2Normals[vert.n];
|
||||
|
||||
vertex++;
|
||||
}
|
||||
|
|
@ -287,6 +288,8 @@ namespace
|
|||
|
||||
subMesh->SetMaterialIndex(0);
|
||||
mesh->AddSubMesh(subMesh.release());
|
||||
|
||||
mesh->GenerateTangents();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -360,6 +360,8 @@ bool NzMD5MeshParser::Parse(NzMesh* mesh)
|
|||
}
|
||||
}
|
||||
|
||||
mesh->GenerateNormalsAndTangents();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue