From 4c321e19dcd60f200e83ae614ea68d80b5a94fd3 Mon Sep 17 00:00:00 2001 From: Alessandro Muntoni Date: Mon, 20 Nov 2023 16:14:31 +0100 Subject: [PATCH] fix #1387, can import gltf point clouds --- src/meshlabplugins/io_gltf/gltf_loader.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/meshlabplugins/io_gltf/gltf_loader.cpp b/src/meshlabplugins/io_gltf/gltf_loader.cpp index eabe665e6..d050d1e75 100644 --- a/src/meshlabplugins/io_gltf/gltf_loader.cpp +++ b/src/meshlabplugins/io_gltf/gltf_loader.cpp @@ -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]; } @@ -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(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(attr, m, ivp, nullptr, 0, 0); + attrLoaded = true; + } } return attrLoaded; }