summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-08-26 15:44:35 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2016-10-10 05:41:33 +0000
commit298c6ebcf6d763080d1fce14d1482cea95c08d9a (patch)
tree07e6ce24c912759999babf67bd3cb628c86cdbc9
parent2d191d97d36008c3e51071d347baa2acfde5fce3 (diff)
Fix off by one error in torus texture coordinate generation
Prevents interpolation from (1-dv) to 0 over the final ring of triangles of the torus. Now we only reach v = 1 at the same point in space where we began creating the torus. Change-Id: I68630c623483bf2993ef24dbef98cca5a9ae26fd Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
-rw-r--r--src/extras/geometries/qtorusgeometry.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/extras/geometries/qtorusgeometry.cpp b/src/extras/geometries/qtorusgeometry.cpp
index bcfe420de..aab466b13 100644
--- a/src/extras/geometries/qtorusgeometry.cpp
+++ b/src/extras/geometries/qtorusgeometry.cpp
@@ -67,7 +67,7 @@ QByteArray createTorusVertexData(double radius, double minorRadius,
float* fptr = reinterpret_cast<float*>(bufferBytes.data());
const float ringFactor = (M_PI * 2) / static_cast<float>( rings );
- const float sideFactor = (M_PI * 2) / static_cast<float>( sides );
+ const float sideFactor = (M_PI * 2) / static_cast<float>( sides - 1 );
for (int ring = 0; ring <= rings; ++ring) {
const float u = ring * ringFactor;