CXMeshFileLoader: initialize normals (and other S3DVertex values ) to 0 when loading

Thanks @sfan5 for patch in Minetest: 0500a7798b
Changed it slightly as more value were not initialized than just normals.
Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819&p=306518#p306518


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6354 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-04-21 21:11:48 +00:00
parent 8fcc572845
commit df17e52a05

@ -760,10 +760,12 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
// read vertices // read vertices
mesh.Vertices.set_used(nVertices); mesh.Vertices.set_used(nVertices);
irr::video::S3DVertex vertex; // set_used doesn't call constructor, so we initalize it explicit here
vertex.Color = 0xFFFFFFFF;
for (u32 n=0; n<nVertices; ++n) for (u32 n=0; n<nVertices; ++n)
{ {
readVector3(mesh.Vertices[n].Pos); readVector3(vertex.Pos);
mesh.Vertices[n].Color=0xFFFFFFFF; mesh.Vertices[n] = vertex;
} }
if (!checkForTwoFollowingSemicolons()) if (!checkForTwoFollowingSemicolons())