Switch index/vertex count to UInt32

This commit is contained in:
SirLynix
2022-10-31 19:54:25 +01:00
parent dc6ce8427c
commit 6b8be23fa0
28 changed files with 129 additions and 128 deletions

View File

@@ -94,8 +94,8 @@ namespace Nz
{
const MD5MeshParser::Mesh& md5Mesh = meshes[i];
UInt64 indexCount = md5Mesh.triangles.size() * 3;
UInt64 vertexCount = md5Mesh.vertices.size();
UInt32 indexCount = SafeCast<UInt32>(md5Mesh.triangles.size() * 3);
UInt32 vertexCount = SafeCast<UInt32>(md5Mesh.vertices.size());
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -257,8 +257,8 @@ namespace Nz
for (UInt32 i = 0; i < meshCount; ++i)
{
const MD5MeshParser::Mesh& md5Mesh = meshes[i];
UInt64 indexCount = md5Mesh.triangles.size() * 3;
UInt64 vertexCount = md5Mesh.vertices.size();
UInt32 indexCount = SafeCast<UInt32>(md5Mesh.triangles.size() * 3);
UInt32 vertexCount = SafeCast<UInt32>(md5Mesh.vertices.size());
// Index buffer
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());

View File

@@ -246,7 +246,7 @@ namespace Nz
// Création des buffers
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
std::shared_ptr<IndexBuffer> indexBuffer = std::make_shared<IndexBuffer>((largeIndices) ? IndexType::U32 : IndexType::U16, indices.size(), parameters.indexBufferFlags, parameters.bufferFactory);
std::shared_ptr<IndexBuffer> indexBuffer = std::make_shared<IndexBuffer>((largeIndices) ? IndexType::U32 : IndexType::U16, SafeCast<UInt32>(indices.size()), parameters.indexBufferFlags, parameters.bufferFactory);
std::shared_ptr<VertexBuffer> vertexBuffer = std::make_shared<VertexBuffer>(parameters.vertexDeclaration, vertexCount, parameters.vertexBufferFlags, parameters.bufferFactory);
// Remplissage des indices