Tiny refactoring in ply mesh loader.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6134 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-07-22 22:30:25 +00:00
parent a1b9e8c2ed
commit f0043ebc36
2 changed files with 12 additions and 11 deletions

@ -1,6 +1,6 @@
--------------------------
Changes in 1.9 (not yet released)
- ply meshloader now also supports textures with names texture_u/texture_v.
- ply meshloader now also supports textures with uv-labels named texture_u/texture_v.
Thx @acy for bugreport and test-model (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=4&t=52646)
- Fix potential reading/writing 1 byte behind it's own buffer in PLY loader.
Thanks @wolfgang for report and patch (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52627&p=305573#p305573)

@ -368,14 +368,15 @@ bool CPLYMeshFileLoader::readFace(const SPLYElement &Element, scene::CDynamicMes
for (u32 i=0; i < Element.Properties.size(); ++i)
{
if ( (Element.Properties[i].Name == "vertex_indices" ||
Element.Properties[i].Name == "vertex_index") && Element.Properties[i].Type == EPLYPT_LIST)
const SPLYProperty& property = Element.Properties[i];
if ( (property.Name == "vertex_indices" || property.Name == "vertex_index")
&& property.Type == EPLYPT_LIST)
{
// get count
s32 count = getInt(Element.Properties[i].Data.List.CountType);
u32 a = getInt(Element.Properties[i].Data.List.ItemType),
b = getInt(Element.Properties[i].Data.List.ItemType),
c = getInt(Element.Properties[i].Data.List.ItemType);
s32 count = getInt(property.Data.List.CountType);
u32 a = getInt(property.Data.List.ItemType),
b = getInt(property.Data.List.ItemType),
c = getInt(property.Data.List.ItemType);
s32 j = 3;
mb->getIndexBuffer().push_back(a);
@ -385,19 +386,19 @@ bool CPLYMeshFileLoader::readFace(const SPLYElement &Element, scene::CDynamicMes
for (; j < count; ++j)
{
b = c;
c = getInt(Element.Properties[i].Data.List.ItemType);
c = getInt(property.Data.List.ItemType);
mb->getIndexBuffer().push_back(a);
mb->getIndexBuffer().push_back(c);
mb->getIndexBuffer().push_back(b);
}
}
else if (Element.Properties[i].Name == "intensity")
else if (property.Name == "intensity")
{
// todo: face intensity
skipProperty(Element.Properties[i]);
skipProperty(property);
}
else
skipProperty(Element.Properties[i]);
skipProperty(property);
}
return true;
}