diff options
author | Samuel Rødal <samuel.rodal@digia.com> | 2011-03-03 11:27:57 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-19 14:42:26 +0100 |
commit | 15a623b04672827802ac735d9b09163632816438 (patch) | |
tree | 4bdb35c2be32a2f65684bb9f4a0bf2b63bd477cf | |
parent | 7582b6cdde83081cae656a319b3f602989567d04 (diff) | |
download | qt3d-15a623b04672827802ac735d9b09163632816438.tar.gz |
Fix winding on quad strips that make up spheres
The winding was incorrect, which caused the QGLSphere to disappear
when back-face culling was enabled.
Task-number: QTBUG-17822
(cherry picked from commit dde93f2bdbc0b0918f0fd6608c83cb6e2f1fe2b7)
Change-Id: I1e06103b0c84fcd87e6066693f06003ab2cf723d
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/threed/geometry/qglsphere.cpp | 2 | ||||
-rw-r--r-- | tests/auto/imports/qspheremesh/tst_qspheremesh.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/threed/geometry/qglsphere.cpp b/src/threed/geometry/qglsphere.cpp index 4f10ebebf..053f79a5f 100644 --- a/src/threed/geometry/qglsphere.cpp +++ b/src/threed/geometry/qglsphere.cpp @@ -188,7 +188,7 @@ QGLBuilder& operator<<(QGLBuilder& builder, const QGLSphere& sphere) float stackSin[maxStacks]; float stackCos[maxStacks]; for (int slice = 0; slice < slices; ++slice) { - float angle = 2.0f * M_PI * slice / slices; + float angle = 2.0f * M_PI * (slices - 1 - slice) / slices; sliceSin[slice] = qFastSin(angle); sliceCos[slice] = qFastCos(angle); } diff --git a/tests/auto/imports/qspheremesh/tst_qspheremesh.cpp b/tests/auto/imports/qspheremesh/tst_qspheremesh.cpp index b9689b6c1..7000aa42f 100644 --- a/tests/auto/imports/qspheremesh/tst_qspheremesh.cpp +++ b/tests/auto/imports/qspheremesh/tst_qspheremesh.cpp @@ -162,7 +162,7 @@ void tst_QSphereMesh::testGeometry() if (triangleNormal.lengthSquared()>0.001) { triangleNormal.normalize(); float dp = QVector3D::dotProduct(triangleNormal,nn0); - QVERIFY(dp<-0.8628); + QVERIFY(dp>0.8628); } } } |