Skip to content
Snippets Groups Projects
Commit 0f77410c authored by Kenny Sharma's avatar Kenny Sharma
Browse files

[NRRPLT-3964] Prevent segfault in gzcoarse.

Change-Id: I26b3d4ecd663f8b49a7e3789b0e7789351fc6991
parent aad27efb
No related branches found
No related tags found
No related merge requests found
......@@ -1180,7 +1180,8 @@ void ConvertGzToGts(const gazebo::common::SubMesh *_subMesh,
}
else
{
std::cout << ": Ignoring degenerate facet!\n";
// HBP: removed spamming debug that provides little information
//std::cout << ": Ignoring degenerate facet!\n";
}
}
gts_surface_merge(_surface, subSurface);
......@@ -1233,6 +1234,25 @@ int main(int argc, char **argv)
{
const gazebo::common::SubMesh *inSubMesh = inGz->GetSubMesh(s);
// HBP: VALIDATE COLLADA FILE
//
// If a dae file does not have the proper TEXCOORD tags in it, the gazebo
// collada import will succeed, but the resulting mesh will not have any
// texCoord. This will cause a segfault in ExportTextureSource which does
// all of its calculations on vertices and then attempts to index into
// TexCoord, which will cause a segfault.
//
// We cannot try to generate an arbitrary mapping between vertices and
// the missing texture coordinates, nor can we try to run something like
// meshlab or blender since they cannot generate those values to export
// unless they were in the original collada to begin with.
if (inSubMesh->GetTexCoordCount() == 0)
{
std::cout << "Collada file does not contain valid texture coordinate "
<< "mapping. Not simplifying." << std::endl;
return -1;
}
// GAZEBO to GTS
GtsSurface *inOutGts;
inOutGts = gts_surface_new(gts_surface_class(), gts_face_class(),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment