const Standard_Integer aNbNodes = theTriangulation->NbNodes();
const Standard_Integer aNbTriangles = theTriangulation->NbTriangles();
theStream << aNbNodes << aNbTriangles << theTriangulation->HasUVNodes();
- theStream << theNeedToWriteNormals << theTriangulation->Deflection();
+ theStream << (theTriangulation->HasNormals() && theNeedToWriteNormals);
+ theStream << theTriangulation->Deflection();
// write the 3d nodes
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
theStream << theTriangulation->Node (aNodeIter);
for (Standard_Integer aTriIter = 1; aTriIter <= aNbTriangles; ++aTriIter)
theStream << theTriangulation->Triangle (aTriIter);
- if (theNeedToWriteNormals)
+ if (theTriangulation->HasNormals() && theNeedToWriteNormals)
{
gp_Vec3f aNormal;
for (Standard_Integer aNormalIter = 1; aNormalIter <= aNbNodes; ++aNormalIter)