From 7fac9341eef92f47e86038c2ae70905ebe49e54f Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 3 Jan 2017 13:42:32 +0100 Subject: [PATCH 1/2] Fixed: V coordinates are inverted --HG-- branch : develop --- code/nel/tools/3d/textures_tool/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/textures_tool/main.cpp b/code/nel/tools/3d/textures_tool/main.cpp index b7bbaa114..bd6e0caf6 100644 --- a/code/nel/tools/3d/textures_tool/main.cpp +++ b/code/nel/tools/3d/textures_tool/main.cpp @@ -312,7 +312,8 @@ int main(int argc, char **argv) NLMISC::fromString(tokens[1], u); NLMISC::fromString(tokens[2], v); - verticeTextureCoords.push_back(NLMISC::CUV(u * (float)TextureSize, v * (float)TextureSize)); + // V coordinates are inverted + verticeTextureCoords.push_back(NLMISC::CUV(u * (float)TextureSize, (1.f - v) * (float)TextureSize)); } else { From ca5a4f6788c9239440652bd7922c06caf852fcdd Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 3 Jan 2017 13:43:31 +0100 Subject: [PATCH 2/2] Changed: Use NLMISC::drawFullLine instead of NLMISC::drawLine for better render --HG-- branch : develop --- code/nel/tools/3d/textures_tool/main.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/code/nel/tools/3d/textures_tool/main.cpp b/code/nel/tools/3d/textures_tool/main.cpp index bd6e0caf6..997557ffc 100644 --- a/code/nel/tools/3d/textures_tool/main.cpp +++ b/code/nel/tools/3d/textures_tool/main.cpp @@ -378,12 +378,20 @@ int main(int argc, char **argv) NLMISC::CUV uv1 = verticeTextureCoords[face.indices[1]]; NLMISC::CUV uv2 = verticeTextureCoords[face.indices[2]]; - std::vector > pixels; + std::vector > pixels, temp; // draw the triangle with vertices UV coordinates - NLMISC::drawLine(uv0.U, uv0.V, uv1.U, uv1.V, pixels); - NLMISC::drawLine(uv1.U, uv1.V, uv2.U, uv2.V, pixels); - NLMISC::drawLine(uv2.U, uv2.V, uv0.U, uv0.V, pixels); + NLMISC::drawFullLine(uv0.U, uv0.V, uv1.U, uv1.V, pixels); + + // append pixels + NLMISC::drawFullLine(uv1.U, uv1.V, uv2.U, uv2.V, temp); + pixels.reserve(pixels.size() + temp.size()); + pixels.insert(pixels.end(), temp.begin(), temp.end()); + + // append pixels + NLMISC::drawFullLine(uv2.U, uv2.V, uv0.U, uv0.V, temp); + pixels.reserve(pixels.size() + temp.size()); + pixels.insert(pixels.end(), temp.begin(), temp.end()); // for each pixels, set them to black for (uint j = 0, jlen = pixels.size(); j < jlen; ++j)