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>
This commit is contained in:
Sean Harmer 2016-08-26 15:44:35 +01:00 committed by Jani Heikkinen
parent 2d191d97d3
commit 298c6ebcf6
1 changed files with 1 additions and 1 deletions

View File

@ -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;