From e1061f1766875d2d64a0f3193ef154ea3a2d3880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 13 Apr 2019 18:09:25 +0200 Subject: [PATCH] MeshTools: fix a bad corner case in compile(). Having texture coordinates *and* colors is very unusual, nevertheless it was a bug. --- doc/changelog.dox | 2 ++ src/Magnum/MeshTools/Compile.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 041a05009..db37a6b24 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -297,6 +297,8 @@ See also: (see [mosra/magnum#331](https://github.com/mosra/magnum/pull/331) - Reading of float textures on ES3 contexts using @ref DebugTools::textureSubImage() returned a zero-sized image by accident +- @ref MeshTools::compile() was producing an incorrect mesh when + @ref Trade::MeshData3D had both colors and texture coordinates - Properly zero-initializing the UTF-8 buffer in @ref Platform::GlfwApplication::textInputEvent() (see [mosra/magnum#324](https://github.com/mosra/magnum/pull/324)) diff --git a/src/Magnum/MeshTools/Compile.cpp b/src/Magnum/MeshTools/Compile.cpp index 88b677746..136cd25a8 100644 --- a/src/Magnum/MeshTools/Compile.cpp +++ b/src/Magnum/MeshTools/Compile.cpp @@ -137,7 +137,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData) { } if(meshData.hasTextureCoords2D()) { stride += sizeof(Shaders::Generic3D::TextureCoordinates::Type); - colorsOffset += sizeof(Shaders::Generic3D::Normal::Type); + colorsOffset += sizeof(Shaders::Generic3D::TextureCoordinates::Type); } if(meshData.hasColors()) stride += sizeof(Shaders::Generic3D::Color4::Type);