Fix reading face_colors and face_transparencies for faces without attached geometry surface

This commit is contained in:
Matthias Hochsteger 2024-07-10 10:15:55 +02:00
parent 78832cb7c5
commit da743467fb

View File

@ -1208,6 +1208,8 @@ namespace netgen
bool endmesh = false; bool endmesh = false;
bool has_facedescriptors = false;
while (infile.good() && !endmesh) while (infile.good() && !endmesh)
{ {
@ -1226,6 +1228,7 @@ namespace netgen
if (strcmp (str, "facedescriptors") == 0) if (strcmp (str, "facedescriptors") == 0)
{ {
has_facedescriptors = true;
int nfd; int nfd;
infile >> nfd; infile >> nfd;
for([[maybe_unused]] auto i : Range(nfd)) for([[maybe_unused]] auto i : Range(nfd))
@ -1610,7 +1613,11 @@ namespace netgen
surfnr--; surfnr--;
if(surfnr > 0) if(has_facedescriptors)
{
GetFaceDescriptor(i).SetSurfColour(surfcolour);
}
else if(surfnr > 0)
{ {
for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++) for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++)
{ {
@ -1637,7 +1644,14 @@ namespace netgen
double transp; double transp;
infile >> surfnr >> transp; infile >> surfnr >> transp;
surfnr--; surfnr--;
if(surfnr > 0) if(has_facedescriptors)
{
auto& fd = GetFaceDescriptor(index);
auto scol = fd.SurfColour();
scol[3] = transp;
fd.SetSurfColour(scol);
}
else if(surfnr > 0)
{ {
for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++) for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++)
{ {