From f0043ebc363af0572e89c9c73dc7e59d319b91de Mon Sep 17 00:00:00 2001 From: cutealien Date: Wed, 22 Jul 2020 22:30:25 +0000 Subject: [PATCH] Tiny refactoring in ply mesh loader. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6134 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 2 +- source/Irrlicht/CPLYMeshFileLoader.cpp | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/changes.txt b/changes.txt index 507cd14d..4023ccf8 100644 --- a/changes.txt +++ b/changes.txt @@ -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) diff --git a/source/Irrlicht/CPLYMeshFileLoader.cpp b/source/Irrlicht/CPLYMeshFileLoader.cpp index 26541e10..f963ab94 100644 --- a/source/Irrlicht/CPLYMeshFileLoader.cpp +++ b/source/Irrlicht/CPLYMeshFileLoader.cpp @@ -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; }