Reverting to 32 bit indices

This commit is contained in:
Dynamitos
2024-04-07 16:33:32 +02:00
parent 7a713afdb4
commit cde48f0d15
9 changed files with 29 additions and 26 deletions
+9 -3
View File
@@ -61,20 +61,26 @@ void addTriangle(Array<Meshlet>& meshlets, Meshlet& current, Triangle tri)
}
}
void Meshlet::build(const Array<Vector>& positions, const Array<uint16>& indices, Array<Meshlet>& meshlets)
void Meshlet::build(const Array<Vector>& positions, const Array<uint32>& indices, Array<Meshlet>& meshlets)
{
Meshlet current = {
.numVertices = 0,
.numPrimitives = 0,
};
for (size_t i = 0; i < indices.size() / 3; ++i)
Array<Triangle> triangles(indices.size() / 3);
for (size_t i = 0; i < triangles.size(); ++i)
{
addTriangle(meshlets, current, Triangle{
triangles.add(Triangle{
.indices = {
indices[i * 3 + 0],
indices[i * 3 + 1],
indices[i * 3 + 2],
},
});
}
if (current.numVertices > 0)
{
completeMeshlet(meshlets, current);
}
}