Skip to content

Commit e9b0029

Browse files
committed
gltfpack: Only enable sparse mode for non-empty indices
Point clouds use empty indices, so indices.size() would be less than the vertex count. The actual code that would execute then is a no-op, as it would leave sparse empty, but if the mechanism of enabling sparse mode changes in the future this may regress, so add a condition to be explicit.
1 parent 4415305 commit e9b0029

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gltf/parsegltf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static void parseMeshesGltf(cgltf_data* data, std::vector<Mesh>& meshes, std::ve
216216
std::vector<unsigned int> sparse;
217217

218218
// if the index data is very sparse, switch to deindexing on the fly to avoid the excessive cost of reading large accessors
219-
if (result.indices.size() < vertex_count / 2)
219+
if (!result.indices.empty() && result.indices.size() < vertex_count / 2)
220220
{
221221
sparse = result.indices;
222222

0 commit comments

Comments
 (0)