Skip to content

Commit 763076e

Browse files
authored
[Core] DrawMesh<Hexahedron>: add quick test for quads when drawing hexa (#6152)
* add quick test for quads when drawing hexa * add tests for triangles/tetra too
1 parent a79c82a commit 763076e

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

  • Sofa/framework/Core/src/sofa/core/visual

Sofa/framework/Core/src/sofa/core/visual/DrawMesh.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,17 @@ struct SOFA_CORE_API DrawElementMesh<sofa::geometry::Tetrahedron>
328328
const auto& elements = topology->getTetrahedra();
329329
const auto& facets = topology->getTriangles();
330330

331+
if(facets.empty())
332+
{
333+
static bool firstTime = true;
334+
if (firstTime)
335+
{
336+
msg_error("DrawElementMesh<Tetrahedron>") << "Drawing tetrahedra needs the associated triangles in the topology.";
337+
firstTime = false;
338+
}
339+
return;
340+
}
341+
331342
for ( auto& p : renderedPoints)
332343
{
333344
p.resize(elementIndices.size() * sofa::geometry::Triangle::NumberOfNodes);
@@ -474,6 +485,17 @@ struct SOFA_CORE_API DrawElementMesh<sofa::geometry::Hexahedron>
474485
const auto& elements = topology->getHexahedra();
475486
const auto& facets = topology->getQuads();
476487

488+
if(facets.empty())
489+
{
490+
static bool firstTime = true;
491+
if (firstTime)
492+
{
493+
msg_error("DrawElementMesh<Hexahedron>") << "Drawing hexahedra needs the associated quads in the topology.";
494+
firstTime = false;
495+
}
496+
return;
497+
}
498+
477499
for ( auto& p : renderedPoints)
478500
{
479501
p.resize(elementIndices.size() * sofa::geometry::Quad::NumberOfNodes);

0 commit comments

Comments
 (0)