mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
write transparency in mesh file and also read it if avail
The indexing is a little weird but consistent to before so leave it like this
This commit is contained in:
parent
ec96feb7f4
commit
e6a6ab89e6
@ -259,12 +259,12 @@ namespace netgen
|
|||||||
if(bc_index == 0)
|
if(bc_index == 0)
|
||||||
{
|
{
|
||||||
PrintMessage(3, "BC Property: ",DEFAULT_BCNUM);
|
PrintMessage(3, "BC Property: ",DEFAULT_BCNUM);
|
||||||
// PrintMessage(3, " RGB Face Colour = ",ref_colour,"","\n");
|
PrintMessage(3, " RGB Face Colour = ",Vec3d{ref_colour[0], ref_colour[1], ref_colour[2]},"","\n");
|
||||||
}
|
}
|
||||||
else if(bc_used.Elem(bc_index))
|
else if(bc_used.Elem(bc_index))
|
||||||
{
|
{
|
||||||
PrintMessage(3, "BC Property: ",bc_num.Elem(bc_index));
|
PrintMessage(3, "BC Property: ",bc_num.Elem(bc_index));
|
||||||
// PrintMessage(3, " RGB Face Colour = ",ref_colour,"","\n");
|
PrintMessage(3, " RGB Face Colour = ",Vec3d{ref_colour[0], ref_colour[1], ref_colour[2]},"","\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ namespace netgen
|
|||||||
PrintMessage(3, "BC Property: ",i + DEFAULT_BCNUM);
|
PrintMessage(3, "BC Property: ",i + DEFAULT_BCNUM);
|
||||||
PrintMessage(3, " Nr. of Surface Elements = ", faces_sorted[i]);
|
PrintMessage(3, " Nr. of Surface Elements = ", faces_sorted[i]);
|
||||||
PrintMessage(3, " Colour Index = ", colours_sorted[i]);
|
PrintMessage(3, " Colour Index = ", colours_sorted[i]);
|
||||||
// PrintMessage(3, " RGB Face Colour = ",ref_colour,"","\n");
|
PrintMessage(3, " RGB Face Colour = ",Vec3d{ref_colour[0], ref_colour[1], ref_colour[2]},"","\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,6 +1080,15 @@ namespace netgen
|
|||||||
outfile << GetFaceDescriptor(i).SurfColour()[2];
|
outfile << GetFaceDescriptor(i).SurfColour()[2];
|
||||||
outfile << endl;
|
outfile << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outfile << "face_transparencies" << endl << cnt_facedesc << endl;
|
||||||
|
for(i = 1; i <= cnt_facedesc; i++)
|
||||||
|
{
|
||||||
|
outfile.width(8);
|
||||||
|
outfile << GetFaceDescriptor(i).SurfNr()+1 << " ";
|
||||||
|
outfile.width(12);
|
||||||
|
outfile << GetFaceDescriptor(i).SurfColour()[3] << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outfile << endl << endl << "endmesh" << endl << endl;
|
outfile << endl << endl << "endmesh" << endl << endl;
|
||||||
@ -1570,6 +1579,36 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp (str, "face_transparencies") == 0)
|
||||||
|
{
|
||||||
|
int cnt_facedesc = GetNFD();
|
||||||
|
infile >> n;
|
||||||
|
int index = 1;
|
||||||
|
if(n == cnt_facedesc)
|
||||||
|
{
|
||||||
|
for(int index = 1; index <= n; index++)
|
||||||
|
{
|
||||||
|
int surfnr;
|
||||||
|
double transp;
|
||||||
|
infile >> surfnr >> transp;
|
||||||
|
surfnr--;
|
||||||
|
if(surfnr > 0)
|
||||||
|
{
|
||||||
|
for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++)
|
||||||
|
{
|
||||||
|
if(surfnr == GetFaceDescriptor(facedesc).SurfNr())
|
||||||
|
{
|
||||||
|
auto& fd = GetFaceDescriptor(facedesc);
|
||||||
|
auto scol = fd.SurfColour();
|
||||||
|
scol[3] = transp;
|
||||||
|
fd.SetSurfColour(scol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp (str, "endmesh") == 0)
|
if (strcmp (str, "endmesh") == 0)
|
||||||
endmesh = true;
|
endmesh = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user