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

@@ -169,7 +169,7 @@ namespace Nz
}
});
std::shared_ptr<VertexBuffer> colliderVB = std::make_shared<VertexBuffer>(VertexDeclaration::Get(VertexLayout::XYZ), colliderVertices.size(), BufferUsage::Write, SoftwareBufferFactory, colliderVertices.data());
std::shared_ptr<VertexBuffer> colliderVB = std::make_shared<VertexBuffer>(VertexDeclaration::Get(VertexLayout::XYZ), SafeCast<UInt32>(colliderVertices.size()), BufferUsage::Write, SoftwareBufferFactory, colliderVertices.data());
std::shared_ptr<IndexBuffer> colliderIB = std::make_shared<IndexBuffer>(IndexType::U16, colliderIndices.size(), BufferUsage::Write, SoftwareBufferFactory, colliderIndices.data());
std::shared_ptr<StaticMesh> colliderSubMesh = std::make_shared<StaticMesh>(std::move(colliderVB), std::move(colliderIB));

View File

@@ -217,11 +217,11 @@ namespace Nz
Clear();
}
VertexCache(IndexIterator indices, UInt64 indexCount)
VertexCache(IndexIterator indices, UInt32 indexCount)
{
Clear();
for (UInt64 i = 0; i < indexCount; ++i)
for (UInt32 i = 0; i < indexCount; ++i)
AddVertex(*indices++);
}
@@ -252,7 +252,7 @@ namespace Nz
m_misses = 0;
}
UInt64 GetMissCount() const
UInt32 GetMissCount() const
{
return m_misses;
}
@@ -281,7 +281,7 @@ namespace Nz
}
std::array<int, 40> m_cache;
UInt64 m_misses; // cache miss count
UInt32 m_misses; // cache miss count
};
class VertexCacheOptimizer
@@ -306,7 +306,7 @@ namespace Nz
}
// stores new indices in place
Result Optimize(IndexIterator indices, UInt64 indexCount)
Result Optimize(IndexIterator indices, UInt32 indexCount)
{
if (indexCount == 0)
return Fail_NoVerts;
@@ -426,7 +426,7 @@ namespace Nz
return Success;
}
Result Init(IndexIterator indices, UInt64 indexCount, UInt64 vertexCount)
Result Init(IndexIterator indices, UInt32 indexCount, UInt32 vertexCount)
{
// clear the draw list
m_drawList.clear();
@@ -436,7 +436,7 @@ namespace Nz
m_vertices.resize(vertexCount);
m_triangles.clear();
for (UInt64 i = 0; i < indexCount; i += 3)
for (UInt32 i = 0; i < indexCount; i += 3)
{
TriangleCacheData dat;
for (unsigned int j = 0; j < 3; ++j)
@@ -447,7 +447,7 @@ namespace Nz
// copy the indices
m_indices.resize(indexCount);
for (UInt64 i = 0; i < indexCount; ++i)
for (UInt32 i = 0; i < indexCount; ++i)
m_indices[i] = indices[i];
m_vertexCache.Clear();
@@ -633,7 +633,7 @@ namespace Nz
/**********************************Compute**********************************/
Boxf ComputeAABB(SparsePtr<const Vector3f> positionPtr, UInt64 vertexCount)
Boxf ComputeAABB(SparsePtr<const Vector3f> positionPtr, UInt32 vertexCount)
{
Boxf aabb;
if (vertexCount > 0)
@@ -641,7 +641,7 @@ namespace Nz
aabb.Set(positionPtr->x, positionPtr->y, positionPtr->z, 0.f, 0.f, 0.f);
++positionPtr;
for (UInt64 i = 1; i < vertexCount; ++i)
for (UInt32 i = 1; i < vertexCount; ++i)
aabb.ExtendTo(*positionPtr++);
}
else
@@ -650,10 +650,10 @@ namespace Nz
return aabb;
}
void ComputeBoxIndexVertexCount(const Vector3ui& subdivision, UInt64* indexCount, UInt64* vertexCount)
void ComputeBoxIndexVertexCount(const Vector3ui& subdivision, UInt32* indexCount, UInt32* vertexCount)
{
UInt64 xIndexCount, yIndexCount, zIndexCount;
UInt64 xVertexCount, yVertexCount, zVertexCount;
UInt32 xIndexCount, yIndexCount, zIndexCount;
UInt32 xVertexCount, yVertexCount, zVertexCount;
ComputePlaneIndexVertexCount(Vector2ui(subdivision.y, subdivision.z), &xIndexCount, &xVertexCount);
ComputePlaneIndexVertexCount(Vector2ui(subdivision.x, subdivision.z), &yIndexCount, &yVertexCount);
@@ -666,7 +666,7 @@ namespace Nz
*vertexCount = xVertexCount*2 + yVertexCount*2 + zVertexCount*2;
}
UInt64 ComputeCacheMissCount(IndexIterator indices, UInt64 indexCount)
UInt32 ComputeCacheMissCount(IndexIterator indices, UInt32 indexCount)
{
NAZARA_USE_ANONYMOUS_NAMESPACE
@@ -674,7 +674,7 @@ namespace Nz
return cache.GetMissCount();
}
void ComputeConeIndexVertexCount(unsigned int subdivision, UInt64* indexCount, UInt64* vertexCount)
void ComputeConeIndexVertexCount(unsigned int subdivision, UInt32* indexCount, UInt32* vertexCount)
{
if (indexCount)
*indexCount = (subdivision-1)*6;
@@ -683,7 +683,7 @@ namespace Nz
*vertexCount = subdivision + 2;
}
void ComputeCubicSphereIndexVertexCount(unsigned int subdivision, UInt64* indexCount, UInt64* vertexCount)
void ComputeCubicSphereIndexVertexCount(unsigned int subdivision, UInt32* indexCount, UInt32* vertexCount)
{
// Comme tous nos plans sont identiques, on peut optimiser un peu
ComputePlaneIndexVertexCount(Vector2ui(subdivision), indexCount, vertexCount);
@@ -695,7 +695,7 @@ namespace Nz
*vertexCount *= 6;
}
void ComputeIcoSphereIndexVertexCount(unsigned int recursionLevel, UInt64* indexCount, UInt64* vertexCount)
void ComputeIcoSphereIndexVertexCount(unsigned int recursionLevel, UInt32* indexCount, UInt32* vertexCount)
{
if (indexCount)
*indexCount = 3 * 20 * IntegralPow(4, recursionLevel);
@@ -704,7 +704,7 @@ namespace Nz
*vertexCount = IntegralPow(4, recursionLevel)*10 + 2;
}
void ComputePlaneIndexVertexCount(const Vector2ui& subdivision, UInt64* indexCount, UInt64* vertexCount)
void ComputePlaneIndexVertexCount(const Vector2ui& subdivision, UInt32* indexCount, UInt32* vertexCount)
{
// Le nombre de faces appartenant à un axe est équivalent à 2 exposant la subdivision (1,2,4,8,16,32,...)
unsigned int horizontalFaceCount = (1 << subdivision.x);
@@ -721,7 +721,7 @@ namespace Nz
*vertexCount = horizontalVertexCount*verticalVertexCount;
}
void ComputeUvSphereIndexVertexCount(unsigned int sliceCount, unsigned int stackCount, UInt64* indexCount, UInt64* vertexCount)
void ComputeUvSphereIndexVertexCount(unsigned int sliceCount, unsigned int stackCount, UInt32* indexCount, UInt32* vertexCount)
{
if (indexCount)
*indexCount = (sliceCount-1) * (stackCount-1) * 6;
@@ -732,12 +732,12 @@ namespace Nz
/**********************************Generate*********************************/
void GenerateBox(const Vector3f& lengths, const Vector3ui& subdivision, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt64 indexOffset)
void GenerateBox(const Vector3f& lengths, const Vector3ui& subdivision, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
{
NAZARA_USE_ANONYMOUS_NAMESPACE
UInt64 xIndexCount, yIndexCount, zIndexCount;
UInt64 xVertexCount, yVertexCount, zVertexCount;
UInt32 xIndexCount, yIndexCount, zIndexCount;
UInt32 xVertexCount, yVertexCount, zVertexCount;
ComputePlaneIndexVertexCount(Vector2ui(subdivision.y, subdivision.z), &xIndexCount, &xVertexCount);
ComputePlaneIndexVertexCount(Vector2ui(subdivision.x, subdivision.z), &yIndexCount, &yVertexCount);
@@ -855,7 +855,7 @@ namespace Nz
}
}
void GenerateCone(float length, float radius, unsigned int subdivision, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt64 indexOffset)
void GenerateCone(float length, float radius, unsigned int subdivision, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
{
constexpr float round = 2.f * Pi<float>;
float delta = round/subdivision;
@@ -903,10 +903,10 @@ namespace Nz
}
}
void GenerateCubicSphere(float size, unsigned int subdivision, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt64 indexOffset)
void GenerateCubicSphere(float size, unsigned int subdivision, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
{
///DOC: Cette fonction va accéder aux pointeurs en écriture ET en lecture
UInt64 vertexCount;
UInt32 vertexCount;
ComputeBoxIndexVertexCount(Vector3ui(subdivision), nullptr, &vertexCount);
// On envoie une matrice identité de sorte à ce que la boîte ne subisse aucune transformation (rendant plus facile l'étape suivante)
@@ -931,7 +931,7 @@ namespace Nz
}
}
void GenerateIcoSphere(float size, unsigned int recursionLevel, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt64 indexOffset)
void GenerateIcoSphere(float size, unsigned int recursionLevel, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
{
NAZARA_USE_ANONYMOUS_NAMESPACE
@@ -939,7 +939,7 @@ namespace Nz
builder.Generate(size, recursionLevel, textureCoords, vertexPointers, indices, aabb, indexOffset);
}
void GeneratePlane(const Vector2ui& subdivision, const Vector2f& size, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt64 indexOffset)
void GeneratePlane(const Vector2ui& subdivision, const Vector2f& size, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
{
// Pour plus de facilité, on va construire notre plan en considérant que la normale est de 0,1,0
// Et appliquer ensuite une matrice "finissant le travail"
@@ -998,7 +998,7 @@ namespace Nz
aabb->Set(matrix.Transform(Vector3f(-halfSizeX, 0.f, -halfSizeY), 0.f), matrix.Transform(Vector3f(halfSizeX, 0.f, halfSizeY), 0.f));
}
void GenerateUvSphere(float size, unsigned int sliceCount, unsigned int stackCount, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt64 indexOffset)
void GenerateUvSphere(float size, unsigned int sliceCount, unsigned int stackCount, const Matrix4f& matrix, const Rectf& textureCoords, VertexPointers vertexPointers, IndexIterator indices, Boxf* aabb, UInt32 indexOffset)
{
// http://stackoverflow.com/questions/14080932/implementing-opengl-sphere-example-code
float invSliceCount = 1.f / (sliceCount-1);
@@ -1054,7 +1054,7 @@ namespace Nz
/**********************************Optimize*********************************/
void OptimizeIndices(IndexIterator indices, UInt64 indexCount)
void OptimizeIndices(IndexIterator indices, UInt32 indexCount)
{
NAZARA_USE_ANONYMOUS_NAMESPACE
@@ -1065,12 +1065,12 @@ namespace Nz
/************************************Skin***********************************/
void SkinLinearBlend(const SkinningData& skinningInfos, UInt64 startVertex, UInt64 vertexCount)
void SkinLinearBlend(const SkinningData& skinningInfos, UInt32 startVertex, UInt32 vertexCount)
{
NazaraAssert(skinningInfos.inputJointIndices, "missing input joint indices");
NazaraAssert(skinningInfos.inputJointWeights, "missing input joint weights");
UInt64 endVertex = startVertex + vertexCount - 1;
UInt32 endVertex = startVertex + vertexCount - 1;
if (skinningInfos.outputPositions || skinningInfos.outputNormals || skinningInfos.outputTangents)
{
NazaraAssert(skinningInfos.joints, "missing skeleton joints");
@@ -1088,7 +1088,7 @@ namespace Nz
bool hasNormals = skinningInfos.inputNormals && skinningInfos.outputNormals;
bool hasTangents = skinningInfos.inputTangents && skinningInfos.outputTangents;
for (UInt64 i = startVertex; i <= endVertex; ++i)
for (UInt32 i = startVertex; i <= endVertex; ++i)
{
Vector3f finalPosition = Vector3f::Zero();
Vector3f finalNormal = Vector3f::Zero();

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

View File

@@ -23,7 +23,7 @@ namespace Nz
NazaraAssert(m_buffer->GetType() == BufferType::Index, "buffer must be an index buffer");
m_endOffset = m_buffer->GetSize();
m_indexCount = m_endOffset / GetStride();
m_indexCount = SafeCast<UInt32>(m_endOffset / GetStride());
}
IndexBuffer::IndexBuffer(IndexType indexType, std::shared_ptr<Buffer> buffer, UInt64 offset, UInt64 size) :
@@ -36,10 +36,10 @@ namespace Nz
NazaraAssert(m_buffer->GetType() == BufferType::Index, "buffer must be an index buffer");
NazaraAssert(size > 0, "invalid buffer size");
m_indexCount = size / GetStride();
m_indexCount = SafeCast<UInt32>(size / GetStride());
}
IndexBuffer::IndexBuffer(IndexType indexType, UInt64 indexCount, BufferUsageFlags usage, const BufferFactory& bufferFactory, const void* initialData) :
IndexBuffer::IndexBuffer(IndexType indexType, UInt32 indexCount, BufferUsageFlags usage, const BufferFactory& bufferFactory, const void* initialData) :
m_indexType(indexType),
m_indexCount(indexCount),
m_startOffset(0)

View File

@@ -67,7 +67,7 @@ namespace Nz
}
}
IndexMapper::IndexMapper(IndexBuffer& indexBuffer, std::size_t indexCount) :
IndexMapper::IndexMapper(IndexBuffer& indexBuffer, UInt32 indexCount) :
m_indexCount((indexCount != 0) ? indexCount : indexBuffer.GetIndexCount())
{
NAZARA_USE_ANONYMOUS_NAMESPACE
@@ -127,7 +127,7 @@ namespace Nz
return m_mapper.GetBuffer();
}
std::size_t IndexMapper::GetIndexCount() const
UInt32 IndexMapper::GetIndexCount() const
{
return m_indexCount;
}

View File

@@ -89,8 +89,8 @@ namespace Nz
{
case PrimitiveType::Box:
{
UInt64 indexCount;
UInt64 vertexCount;
UInt32 indexCount;
UInt32 vertexCount;
ComputeBoxIndexVertexCount(primitive.box.subdivision, &indexCount, &vertexCount);
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -113,8 +113,8 @@ namespace Nz
case PrimitiveType::Cone:
{
UInt64 indexCount;
UInt64 vertexCount;
UInt32 indexCount;
UInt32 vertexCount;
ComputeConeIndexVertexCount(primitive.cone.subdivision, &indexCount, &vertexCount);
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -137,8 +137,8 @@ namespace Nz
case PrimitiveType::Plane:
{
UInt64 indexCount;
UInt64 vertexCount;
UInt32 indexCount;
UInt32 vertexCount;
ComputePlaneIndexVertexCount(primitive.plane.subdivision, &indexCount, &vertexCount);
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -165,8 +165,8 @@ namespace Nz
{
case SphereType::Cubic:
{
UInt64 indexCount;
UInt64 vertexCount;
UInt32 indexCount;
UInt32 vertexCount;
ComputeCubicSphereIndexVertexCount(primitive.sphere.cubic.subdivision, &indexCount, &vertexCount);
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -189,8 +189,8 @@ namespace Nz
case SphereType::Ico:
{
UInt64 indexCount;
UInt64 vertexCount;
UInt32 indexCount;
UInt32 vertexCount;
ComputeIcoSphereIndexVertexCount(primitive.sphere.ico.recursionLevel, &indexCount, &vertexCount);
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -213,8 +213,8 @@ namespace Nz
case SphereType::UV:
{
UInt64 indexCount;
UInt64 vertexCount;
UInt32 indexCount;
UInt32 vertexCount;
ComputeUvSphereIndexVertexCount(primitive.sphere.uv.sliceCount, primitive.sphere.uv.stackCount, &indexCount, &vertexCount);
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
@@ -439,22 +439,22 @@ namespace Nz
return it->second;
}
UInt64 Mesh::GetTriangleCount() const
UInt32 Mesh::GetTriangleCount() const
{
NazaraAssert(m_isValid, "Mesh should be created first");
UInt64 triangleCount = 0;
UInt32 triangleCount = 0;
for (const SubMeshData& data : m_subMeshes)
triangleCount += data.subMesh->GetTriangleCount();
return triangleCount;
}
UInt64 Mesh::GetVertexCount() const
UInt32 Mesh::GetVertexCount() const
{
NazaraAssert(m_isValid, "Mesh should be created first");
UInt64 vertexCount = 0;
UInt32 vertexCount = 0;
for (const SubMeshData& data : m_subMeshes)
vertexCount += data.subMesh->GetVertexCount();

View File

@@ -36,7 +36,7 @@ namespace Nz
return m_vertexBuffer;
}
UInt64 SkeletalMesh::GetVertexCount() const
UInt32 SkeletalMesh::GetVertexCount() const
{
return m_vertexBuffer->GetVertexCount();
}

View File

@@ -25,8 +25,8 @@ namespace Nz
VertexMapper mapper(*m_vertexBuffer);
SparsePtr<Vector3f> position = mapper.GetComponentPtr<Vector3f>(VertexComponent::Position);
UInt64 vertexCount = m_vertexBuffer->GetVertexCount();
for (UInt64 i = 0; i < vertexCount; ++i)
UInt32 vertexCount = m_vertexBuffer->GetVertexCount();
for (UInt32 i = 0; i < vertexCount; ++i)
*position++ -= offset;
m_aabb.x -= offset.x;
@@ -63,7 +63,7 @@ namespace Nz
return m_vertexBuffer;
}
UInt64 StaticMesh::GetVertexCount() const
UInt32 StaticMesh::GetVertexCount() const
{
return m_vertexBuffer->GetVertexCount();
}

View File

@@ -22,14 +22,14 @@ namespace Nz
void SubMesh::GenerateNormals()
{
VertexMapper mapper(*this);
UInt64 vertexCount = mapper.GetVertexCount();
UInt32 vertexCount = mapper.GetVertexCount();
SparsePtr<Vector3f> normals = mapper.GetComponentPtr<Vector3f>(VertexComponent::Normal);
SparsePtr<Vector3f> positions = mapper.GetComponentPtr<Vector3f>(VertexComponent::Position);
if (!normals || !positions)
return;
for (UInt64 i = 0; i < vertexCount; ++i)
for (UInt32 i = 0; i < vertexCount; ++i)
normals[i].MakeZero();
TriangleIterator iterator(*this);
@@ -55,7 +55,7 @@ namespace Nz
void SubMesh::GenerateNormalsAndTangents()
{
VertexMapper mapper(*this);
UInt64 vertexCount = mapper.GetVertexCount();
UInt32 vertexCount = mapper.GetVertexCount();
SparsePtr<Vector3f> normals = mapper.GetComponentPtr<Vector3f>(VertexComponent::Normal);
SparsePtr<Vector3f> positions = mapper.GetComponentPtr<Vector3f>(VertexComponent::Position);
@@ -64,7 +64,7 @@ namespace Nz
if (!normals || !positions || !tangents || !texCoords)
return;
for (UInt64 i = 0; i < vertexCount; ++i)
for (UInt32 i = 0; i < vertexCount; ++i)
{
normals[i].MakeZero();
tangents[i].MakeZero();
@@ -159,10 +159,10 @@ namespace Nz
return m_primitiveMode;
}
UInt64 SubMesh::GetTriangleCount() const
UInt32 SubMesh::GetTriangleCount() const
{
const std::shared_ptr<const IndexBuffer>& indexBuffer = GetIndexBuffer();
UInt64 indexCount;
UInt32 indexCount;
if (indexBuffer)
indexCount = indexBuffer->GetIndexCount();
else

View File

@@ -18,7 +18,7 @@ namespace Nz
NazaraAssert(m_buffer->GetType() == BufferType::Vertex, "buffer must be an vertex buffer");
m_endOffset = m_buffer->GetSize();
m_vertexCount = (m_vertexDeclaration) ? m_endOffset / m_vertexDeclaration->GetStride() : 0;
m_vertexCount = SafeCast<UInt32>((m_vertexDeclaration) ? m_endOffset / m_vertexDeclaration->GetStride() : 0);
}
VertexBuffer::VertexBuffer(std::shared_ptr<const VertexDeclaration> vertexDeclaration, std::shared_ptr<Buffer> buffer, UInt64 offset, UInt64 size) :
@@ -30,10 +30,10 @@ namespace Nz
NazaraAssert(m_buffer, "invalid buffer");
NazaraAssert(m_buffer->GetType() == BufferType::Vertex, "buffer must be an vertex buffer");
m_vertexCount = (m_vertexDeclaration) ? m_endOffset / m_vertexDeclaration->GetStride() : 0;
m_vertexCount = SafeCast<UInt32>((m_vertexDeclaration) ? m_endOffset / m_vertexDeclaration->GetStride() : 0);
}
VertexBuffer::VertexBuffer(std::shared_ptr<const VertexDeclaration> vertexDeclaration, UInt64 vertexCount, BufferUsageFlags usage, const BufferFactory& bufferFactory, const void* initialData) :
VertexBuffer::VertexBuffer(std::shared_ptr<const VertexDeclaration> vertexDeclaration, UInt32 vertexCount, BufferUsageFlags usage, const BufferFactory& bufferFactory, const void* initialData) :
m_vertexDeclaration(std::move(vertexDeclaration)),
m_startOffset(0),
m_vertexCount(vertexCount)
@@ -96,7 +96,7 @@ namespace Nz
{
NazaraAssert(vertexDeclaration, "Invalid vertex declaration");
m_vertexCount = (m_endOffset - m_startOffset) / vertexDeclaration->GetStride();
m_vertexCount = SafeCast<UInt32>((m_endOffset - m_startOffset) / vertexDeclaration->GetStride());
m_vertexDeclaration = std::move(vertexDeclaration);
}