New mesh policy

Former-commit-id: cc5854d55e1e4bb83e5e081434b87ec22fcb8bff
This commit is contained in:
Lynix
2013-03-02 00:17:40 +01:00
parent 347b267d43
commit 0df64e03ae
19 changed files with 132 additions and 209 deletions

View File

@@ -273,7 +273,7 @@ namespace
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);
NzVector3f position = rotationQuat * NzVector3f(vert.x*scale.x + translate.x, vert.y*scale.y + translate.y, vert.z*scale.z + translate.z);
vertex->position = position;
vertex->normal = rotationQuat * md2Normals[vert.n];

View File

@@ -239,7 +239,6 @@ bool NzMD5AnimParser::Parse(NzAnimation* animation)
}
sequenceJoint.scale = NzVector3f(1.f, 1.f, 1.f);
}
}

View File

@@ -203,10 +203,8 @@ bool NzMD5MeshParser::Parse(NzMesh* mesh)
indexMapper.Unmap();
std::unique_ptr<NzVertexBuffer> vertexBuffer(new NzVertexBuffer(NzMesh::GetDeclaration(), vertexCount, m_parameters.storage, nzBufferUsage_Dynamic));
std::unique_ptr<NzSkeletalMesh> subMesh(new NzSkeletalMesh(mesh));
if (!subMesh->Create(vertexBuffer.get(), weightCount))
if (!subMesh->Create(vertexCount, weightCount))
{
NazaraError("Failed to create skeletal mesh");
continue;
@@ -216,9 +214,6 @@ bool NzMD5MeshParser::Parse(NzMesh* mesh)
indexBuffer->SetPersistent(false);
indexBuffer.release();
vertexBuffer->SetPersistent(false);
vertexBuffer.release();
NzWeight* weights = subMesh->GetWeight();
for (unsigned int j = 0; j < weightCount; ++j)
{
@@ -306,7 +301,7 @@ bool NzMD5MeshParser::Parse(NzMesh* mesh)
indexMapper.Unmap();
// Vertex buffer
std::unique_ptr<NzVertexBuffer> vertexBuffer(new NzVertexBuffer(NzMesh::GetDeclaration(), vertexCount, m_parameters.storage, nzBufferUsage_Dynamic));
std::unique_ptr<NzVertexBuffer> vertexBuffer(new NzVertexBuffer(NzMesh::GetDeclaration(), vertexCount, m_parameters.storage));
NzBufferMapper<NzVertexBuffer> vertexMapper(vertexBuffer.get(), nzBufferAccess_WriteOnly);
NzMeshVertex* vertex = reinterpret_cast<NzMeshVertex*>(vertexMapper.GetPointer());