Skip to content

Commit

Permalink
fix #1387, can import gltf point clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Nov 20, 2023
1 parent c42c5ec commit 4c321e1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/meshlabplugins/io_gltf/gltf_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ bool loadAttribute(
else { //if the attribute is triangle indices

//if the mode is GL_TRIANGLES and we have triangle indices
if (p.mode == 4 && p.indices >= 0 &&
if (p.mode == TINYGLTF_MODE_TRIANGLES && p.indices >= 0 &&
(unsigned int)p.indices < model.accessors.size()) {
accessor = &model.accessors[p.indices];
}
Expand Down Expand Up @@ -577,9 +577,12 @@ bool loadAttribute(
//the mesh is not indexed, and triplets of contiguous vertices
//generate triangles
else if (attr == INDICES) {
//this case is managed when passing nullptr as data
populateAttr<unsigned char>(attr, m, ivp, nullptr, 0, 0);
attrLoaded = true;
// avoid explicitly the point clouds
if (p.mode != TINYGLTF_MODE_POINTS) {
//this case is managed when passing nullptr as data
populateAttr<unsigned char>(attr, m, ivp, nullptr, 0, 0);
attrLoaded = true;
}
}
return attrLoaded;
}
Expand Down

0 comments on commit 4c321e1

Please sign in to comment.