From 8697cf33e6cab00be9997d64a01b85b5a8373af5 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 6 Jan 2018 02:46:51 +0100 Subject: [PATCH] Utility/OBJParser: Fix relative offsets loading --- ChangeLog.md | 1 + src/Nazara/Utility/Formats/OBJParser.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index c795d5c19..291c62742 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -47,6 +47,7 @@ Nazara Engine: - Fix potential bug on SocketImpl::Connect (used by TcpClient::Connect) on POSIX platforms - It is now possible to initialize a StackArray with a size of zero on every platforms (this was not possible on non-Windows platforms before) - Calling PlacementDestroy on a null pointer is now a no-op (was triggering an undefined behavior) +- Fix OBJParser relative offsets handling Nazara Development Kit: - Added ImageWidget (#139) diff --git a/src/Nazara/Utility/Formats/OBJParser.cpp b/src/Nazara/Utility/Formats/OBJParser.cpp index 95d7fa6ce..d0cd5cf71 100644 --- a/src/Nazara/Utility/Formats/OBJParser.cpp +++ b/src/Nazara/Utility/Formats/OBJParser.cpp @@ -227,7 +227,7 @@ namespace Nz if (p < 0) { - p += static_cast(m_positions.size() - 1); + p += static_cast(m_positions.size()); if (p < 0) { Error("Vertex index out of range (" + String::Number(p) + " < 0"); @@ -238,7 +238,7 @@ namespace Nz if (n < 0) { - n += static_cast(m_normals.size() - 1); + n += static_cast(m_normals.size()); if (n < 0) { Error("Normal index out of range (" + String::Number(n) + " < 0"); @@ -249,7 +249,7 @@ namespace Nz if (t < 0) { - t += static_cast(m_texCoords.size() - 1); + t += static_cast(m_texCoords.size()); if (t < 0) { Error("Texture coordinates index out of range (" + String::Number(t) + " < 0");