diff options
author | Sergey Dubitskiy <sergey.dubitskiy@nokia.com> | 2012-03-19 10:42:27 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-19 04:00:46 +0100 |
commit | c0fdc5bacf5b562eb41cf41ca0e15ff7941c1267 (patch) | |
tree | c8746b9b0cc490ea497ac38e428ec2fae44f2c7f | |
parent | 65b0d8f27ce0ab88895e9942d478797c085d7ddd (diff) |
Shapes are more consistent now.
Cube, Quad, Sphere and Cylinder have unified size now.
Capsule has unit-long unit-diameter cylinder part,
plus two hemispheric caps.
For those shapes, their centers were moved to each shape's barycenter.
Teapot now has unit height, and nose pointed to Z+ direction.
Teapot naturally sits on it's base.
Task-number: QTBUG-20443
Change-Id: I066d1513c34623f2adb944f3b662d57ddb457469
Reviewed-by: Danny Pope <daniel.pope@nokia.com>
-rw-r--r-- | src/imports/shapes/capsulemesh.cpp | 8 | ||||
-rw-r--r-- | src/imports/shapes/cylindermesh.cpp | 2 | ||||
-rw-r--r-- | src/imports/shapes/spheremesh.cpp | 2 | ||||
-rw-r--r-- | src/imports/shapes/teapot.bez | 612 | ||||
-rw-r--r-- | src/threed/geometry/qglcylinder.cpp | 1 | ||||
-rw-r--r-- | tests/auto/threed/qglcylinder/tst_qglcylinder.cpp | 22 |
6 files changed, 325 insertions, 322 deletions
diff --git a/src/imports/shapes/capsulemesh.cpp b/src/imports/shapes/capsulemesh.cpp index 5b0c068d2..6c7e99967 100644 --- a/src/imports/shapes/capsulemesh.cpp +++ b/src/imports/shapes/capsulemesh.cpp @@ -132,8 +132,8 @@ QT_BEGIN_NAMESPACE CapsuleMeshPrivate::CapsuleMeshPrivate() : topNode(new QGLSceneNode) , currentCapsule(0) - , radius(1.0f) - , length(1.0f) + , radius(0.5f) + , length(2.0f) , lod(5) , sceneSet(false) { @@ -309,13 +309,11 @@ void CapsuleMesh::createGeometry() s->setObjectName("Cylinder"); builder << QGLCylinder(diameter, diameter, cylinderHeight, facets, layers, false, false); - QMatrix4x4 translateMatrix; - translateMatrix.translate(0, 0, -offset); - builder.currentNode()->setLocalTransform(translateMatrix); s = builder.newNode(); s->setObjectName("LeftEndCap"); builder << QGLDome(diameter, divisions, false); + QMatrix4x4 translateMatrix; translateMatrix.setToIdentity(); translateMatrix.rotate(180, 0, 1,0); translateMatrix.translate(0, 0, offset); diff --git a/src/imports/shapes/cylindermesh.cpp b/src/imports/shapes/cylindermesh.cpp index ee814009e..04a5db04b 100644 --- a/src/imports/shapes/cylindermesh.cpp +++ b/src/imports/shapes/cylindermesh.cpp @@ -125,7 +125,7 @@ CylinderMeshPrivate::CylinderMeshPrivate() : topNode(new QGLSceneNode) , currentCylinder(0) , scale(0) - , radius(1.0f) + , radius(0.5f) , length(1.0f) , lod(5) , sceneSet(false) diff --git a/src/imports/shapes/spheremesh.cpp b/src/imports/shapes/spheremesh.cpp index 72bf1dee8..0780897aa 100644 --- a/src/imports/shapes/spheremesh.cpp +++ b/src/imports/shapes/spheremesh.cpp @@ -152,7 +152,7 @@ SphereMeshPrivate::SphereMeshPrivate() , currentSphere(0) , rot(0) , scale(0) - , radius(1.0f) + , radius(0.5f) , lod(5) , axis(Qt::ZAxis) , sceneSet(false) diff --git a/src/imports/shapes/teapot.bez b/src/imports/shapes/teapot.bez index 02b2ac447..406b4fd2d 100644 --- a/src/imports/shapes/teapot.bez +++ b/src/imports/shapes/teapot.bez @@ -32,309 +32,309 @@ 270,270,270,270,291,298,299,300,288,295,296,297,285,292,293,294,4 270,270,270,270,300,305,306,279,297,303,304,275,294,301,302,271,4 306 -0.700000,0.450000,-0.000000 -0.700000,0.450000,0.392000 -0.392000,0.450000,0.700000 -0.000000,0.450000,0.700000 -0.668750,0.515625,-0.000000 -0.668750,0.515625,0.374500 -0.374500,0.515625,0.668750 -0.000000,0.515625,0.668750 -0.718750,0.515625,-0.000000 -0.718750,0.515625,0.402500 -0.402500,0.515625,0.718750 -0.000000,0.515625,0.718750 -0.750000,0.450000,-0.000000 -0.750000,0.450000,0.420000 -0.420000,0.450000,0.750000 -0.000000,0.450000,0.750000 --0.392000,0.450000,0.700000 --0.700000,0.450000,0.392000 --0.700000,0.450000,-0.000000 --0.374500,0.515625,0.668750 --0.668750,0.515625,0.374500 --0.668750,0.515625,-0.000000 --0.402500,0.515625,0.718750 --0.718750,0.515625,0.402500 --0.718750,0.515625,-0.000000 --0.420000,0.450000,0.750000 --0.750000,0.450000,0.420000 --0.750000,0.450000,-0.000000 --0.700000,0.450000,-0.392000 --0.392000,0.450000,-0.700000 -0.000000,0.450000,-0.700000 --0.668750,0.515625,-0.374500 --0.374500,0.515625,-0.668750 -0.000000,0.515625,-0.668750 --0.718750,0.515625,-0.402500 --0.402500,0.515625,-0.718750 -0.000000,0.515625,-0.718750 --0.750000,0.450000,-0.420000 --0.420000,0.450000,-0.750000 -0.000000,0.450000,-0.750000 -0.392000,0.450000,-0.700000 -0.700000,0.450000,-0.392000 -0.374500,0.515625,-0.668750 -0.668750,0.515625,-0.374500 -0.402500,0.515625,-0.718750 -0.718750,0.515625,-0.402500 -0.420000,0.450000,-0.750000 -0.750000,0.450000,-0.420000 -0.875000,0.187500,-0.000000 -0.875000,0.187500,0.490000 -0.490000,0.187500,0.875000 -0.000000,0.187500,0.875000 -1.000000,-0.075000,-0.000000 -1.000000,-0.075000,0.560000 -0.560000,-0.075000,1.000000 -0.000000,-0.075000,1.000000 -1.000000,-0.300000,-0.000000 -1.000000,-0.300000,0.560000 -0.560000,-0.300000,1.000000 -0.000000,-0.300000,1.000000 --0.490000,0.187500,0.875000 --0.875000,0.187500,0.490000 --0.875000,0.187500,-0.000000 --0.560000,-0.075000,1.000000 --1.000000,-0.075000,0.560000 --1.000000,-0.075000,-0.000000 --0.560000,-0.300000,1.000000 --1.000000,-0.300000,0.560000 --1.000000,-0.300000,-0.000000 --0.875000,0.187500,-0.490000 --0.490000,0.187500,-0.875000 -0.000000,0.187500,-0.875000 --1.000000,-0.075000,-0.560000 --0.560000,-0.075000,-1.000000 -0.000000,-0.075000,-1.000000 --1.000000,-0.300000,-0.560000 --0.560000,-0.300000,-1.000000 -0.000000,-0.300000,-1.000000 -0.490000,0.187500,-0.875000 -0.875000,0.187500,-0.490000 -0.560000,-0.075000,-1.000000 -1.000000,-0.075000,-0.560000 -0.560000,-0.300000,-1.000000 -1.000000,-0.300000,-0.560000 -1.000000,-0.525000,-0.000000 -1.000000,-0.525000,0.560000 -0.560000,-0.525000,1.000000 -0.000000,-0.525000,1.000000 -0.750000,-0.637500,-0.000000 -0.750000,-0.637500,0.420000 -0.420000,-0.637500,0.750000 -0.000000,-0.637500,0.750000 -0.750000,-0.675000,-0.000000 -0.750000,-0.675000,0.420000 -0.420000,-0.675000,0.750000 -0.000000,-0.675000,0.750000 --0.560000,-0.525000,1.000000 --1.000000,-0.525000,0.560000 --1.000000,-0.525000,-0.000000 --0.420000,-0.637500,0.750000 --0.750000,-0.637500,0.420000 --0.750000,-0.637500,-0.000000 --0.420000,-0.675000,0.750000 --0.750000,-0.675000,0.420000 --0.750000,-0.675000,-0.000000 --1.000000,-0.525000,-0.560000 --0.560000,-0.525000,-1.000000 -0.000000,-0.525000,-1.000000 --0.750000,-0.637500,-0.420000 --0.420000,-0.637500,-0.750000 -0.000000,-0.637500,-0.750000 --0.750000,-0.675000,-0.420000 --0.420000,-0.675000,-0.750000 -0.000000,-0.675000,-0.750000 -0.560000,-0.525000,-1.000000 -1.000000,-0.525000,-0.560000 -0.420000,-0.637500,-0.750000 -0.750000,-0.637500,-0.420000 -0.420000,-0.675000,-0.750000 -0.750000,-0.675000,-0.420000 --0.800000,0.262500,-0.000000 --0.800000,0.262500,0.150000 --0.750000,0.375000,0.150000 --0.750000,0.375000,-0.000000 --1.150000,0.262500,-0.000000 --1.150000,0.262500,0.150000 --1.250000,0.375000,0.150000 --1.250000,0.375000,-0.000000 --1.350000,0.262500,-0.000000 --1.350000,0.262500,0.150000 --1.500000,0.375000,0.150000 --1.500000,0.375000,-0.000000 --1.350000,0.150000,-0.000000 --1.350000,0.150000,0.150000 --1.500000,0.150000,0.150000 --1.500000,0.150000,-0.000000 --0.750000,0.375000,-0.150000 --0.800000,0.262500,-0.150000 --1.250000,0.375000,-0.150000 --1.150000,0.262500,-0.150000 --1.500000,0.375000,-0.150000 --1.350000,0.262500,-0.150000 --1.500000,0.150000,-0.150000 --1.350000,0.150000,-0.150000 --1.350000,0.037500,-0.000000 --1.350000,0.037500,0.150000 --1.500000,-0.075000,0.150000 --1.500000,-0.075000,-0.000000 --1.250000,-0.187500,-0.000000 --1.250000,-0.187500,0.150000 --1.325000,-0.281250,0.150000 --1.325000,-0.281250,-0.000000 --1.000000,-0.300000,0.150000 --0.950000,-0.450000,0.150000 --0.950000,-0.450000,-0.000000 --1.500000,-0.075000,-0.150000 --1.350000,0.037500,-0.150000 --1.325000,-0.281250,-0.150000 --1.250000,-0.187500,-0.150000 --0.950000,-0.450000,-0.150000 --1.000000,-0.300000,-0.150000 -0.850000,-0.037500,-0.000000 -0.850000,-0.037500,0.330000 -0.850000,-0.450000,0.330000 -0.850000,-0.450000,-0.000000 -1.300000,-0.037500,-0.000000 -1.300000,-0.037500,0.330000 -1.550000,-0.337500,0.330000 -1.550000,-0.337500,-0.000000 -1.150000,0.300000,-0.000000 -1.150000,0.300000,0.125000 -1.200000,0.262500,0.125000 -1.200000,0.262500,-0.000000 -1.350000,0.450000,-0.000000 -1.350000,0.450000,0.125000 -1.650000,0.450000,0.125000 -1.650000,0.450000,-0.000000 -0.850000,-0.450000,-0.330000 -0.850000,-0.037500,-0.330000 -1.550000,-0.337500,-0.330000 -1.300000,-0.037500,-0.330000 -1.200000,0.262500,-0.125000 -1.150000,0.300000,-0.125000 -1.650000,0.450000,-0.125000 -1.350000,0.450000,-0.125000 -1.400000,0.487500,-0.000000 -1.400000,0.487500,0.125000 -1.762500,0.496875,0.125000 -1.762500,0.496875,-0.000000 -1.450000,0.487500,-0.000000 -1.450000,0.487500,0.075000 -1.725000,0.506250,0.075000 -1.725000,0.506250,-0.000000 -1.400000,0.450000,-0.000000 -1.400000,0.450000,0.075000 -1.600000,0.450000,0.075000 -1.600000,0.450000,-0.000000 -1.762500,0.496875,-0.125000 -1.400000,0.487500,-0.125000 -1.725000,0.506250,-0.075000 -1.450000,0.487500,-0.075000 -1.600000,0.450000,-0.075000 -1.400000,0.450000,-0.075000 -0.000000,0.825000,-0.000000 -0.000000,0.825000,0.001000 -0.001000,0.825000,-0.000000 -0.400000,0.825000,-0.000000 -0.400000,0.825000,0.225000 -0.225000,0.825000,0.400000 -0.000000,0.825000,0.400000 -0.000000,0.675000,-0.000000 -0.100000,0.600000,-0.000000 -0.100000,0.600000,0.056000 -0.056000,0.600000,0.100000 -0.000000,0.600000,0.100000 --0.001000,0.825000,-0.000000 --0.225000,0.825000,0.400000 --0.400000,0.825000,0.225000 --0.400000,0.825000,-0.000000 --0.056000,0.600000,0.100000 --0.100000,0.600000,0.056000 --0.100000,0.600000,-0.000000 -0.000000,0.825000,-0.001000 --0.400000,0.825000,-0.225000 --0.225000,0.825000,-0.400000 -0.000000,0.825000,-0.400000 --0.100000,0.600000,-0.056000 --0.056000,0.600000,-0.100000 -0.000000,0.600000,-0.100000 -0.225000,0.825000,-0.400000 -0.400000,0.825000,-0.225000 -0.056000,0.600000,-0.100000 -0.100000,0.600000,-0.056000 -0.200000,0.525000,-0.000000 -0.200000,0.525000,0.112000 -0.112000,0.525000,0.200000 -0.000000,0.525000,0.200000 -0.650000,0.525000,-0.000000 -0.650000,0.525000,0.364000 -0.364000,0.525000,0.650000 -0.000000,0.525000,0.650000 -0.650000,0.450000,-0.000000 -0.650000,0.450000,0.364000 -0.364000,0.450000,0.650000 -0.000000,0.450000,0.650000 --0.112000,0.525000,0.200000 --0.200000,0.525000,0.112000 --0.200000,0.525000,-0.000000 --0.364000,0.525000,0.650000 --0.650000,0.525000,0.364000 --0.650000,0.525000,-0.000000 --0.364000,0.450000,0.650000 --0.650000,0.450000,0.364000 --0.650000,0.450000,-0.000000 --0.200000,0.525000,-0.112000 --0.112000,0.525000,-0.200000 -0.000000,0.525000,-0.200000 --0.650000,0.525000,-0.364000 --0.364000,0.525000,-0.650000 -0.000000,0.525000,-0.650000 --0.650000,0.450000,-0.364000 --0.364000,0.450000,-0.650000 -0.000000,0.450000,-0.650000 -0.112000,0.525000,-0.200000 -0.200000,0.525000,-0.112000 -0.364000,0.525000,-0.650000 -0.650000,0.525000,-0.364000 -0.364000,0.450000,-0.650000 -0.650000,0.450000,-0.364000 -0.000000,-0.750000,-0.000000 -0.750000,-0.675000,-0.000000 -0.750000,-0.675000,-0.420000 -0.420000,-0.675000,-0.750000 -0.000000,-0.675000,-0.750000 -0.750000,-0.712500,-0.000000 -0.750000,-0.712500,-0.420000 -0.420000,-0.712500,-0.750000 -0.000000,-0.712500,-0.750000 -0.712500,-0.750000,-0.000000 -0.712500,-0.750000,-0.399000 -0.399000,-0.750000,-0.712500 -0.000000,-0.750000,-0.712500 --0.420000,-0.675000,-0.750000 --0.750000,-0.675000,-0.420000 --0.750000,-0.675000,-0.000000 --0.420000,-0.712500,-0.750000 --0.750000,-0.712500,-0.420000 --0.750000,-0.712500,-0.000000 --0.399000,-0.750000,-0.712500 --0.712500,-0.750000,-0.399000 --0.712500,-0.750000,-0.000000 --0.750000,-0.675000,0.420000 --0.420000,-0.675000,0.750000 -0.000000,-0.675000,0.750000 --0.750000,-0.712500,0.420000 --0.420000,-0.712500,0.750000 -0.000000,-0.712500,0.750000 --0.712500,-0.750000,0.399000 --0.399000,-0.750000,0.712500 -0.000000,-0.750000,0.712500 -0.420000,-0.675000,0.750000 -0.750000,-0.675000,0.420000 -0.420000,-0.712500,0.750000 -0.750000,-0.712500,0.420000 -0.399000,-0.750000,0.712500 -0.712500,-0.750000,0.399000 +0.000000,0.761905,0.444444 +-0.248889,0.761905,0.444444 +-0.444444,0.761905,0.248889 +-0.444444,0.761905,0.000000 +0.000000,0.803571,0.424603 +-0.237778,0.803571,0.424603 +-0.424603,0.803571,0.237778 +-0.424603,0.803571,0.000000 +0.000000,0.803571,0.456349 +-0.255556,0.803571,0.456349 +-0.456349,0.803571,0.255556 +-0.456349,0.803571,0.000000 +0.000000,0.761905,0.476190 +-0.266667,0.761905,0.476190 +-0.476190,0.761905,0.266667 +-0.476190,0.761905,0.000000 +-0.444444,0.761905,-0.248889 +-0.248889,0.761905,-0.444444 +0.000000,0.761905,-0.444444 +-0.424603,0.803571,-0.237778 +-0.237778,0.803571,-0.424603 +0.000000,0.803571,-0.424603 +-0.456349,0.803571,-0.255556 +-0.255556,0.803571,-0.456349 +0.000000,0.803571,-0.456349 +-0.476190,0.761905,-0.266667 +-0.266667,0.761905,-0.476190 +0.000000,0.761905,-0.476190 +0.248889,0.761905,-0.444444 +0.444444,0.761905,-0.248889 +0.444444,0.761905,0.000000 +0.237778,0.803571,-0.424603 +0.424603,0.803571,-0.237778 +0.424603,0.803571,0.000000 +0.255556,0.803571,-0.456349 +0.456349,0.803571,-0.255556 +0.456349,0.803571,0.000000 +0.266667,0.761905,-0.476190 +0.476190,0.761905,-0.266667 +0.476190,0.761905,0.000000 +0.444444,0.761905,0.248889 +0.248889,0.761905,0.444444 +0.424603,0.803571,0.237778 +0.237778,0.803571,0.424603 +0.456349,0.803571,0.255556 +0.255556,0.803571,0.456349 +0.476190,0.761905,0.266667 +0.266667,0.761905,0.476190 +0.000000,0.595238,0.555556 +-0.311111,0.595238,0.555556 +-0.555556,0.595238,0.311111 +-0.555556,0.595238,0.000000 +0.000000,0.428571,0.634921 +-0.355556,0.428571,0.634921 +-0.634921,0.428571,0.355556 +-0.634921,0.428571,0.000000 +0.000000,0.285714,0.634921 +-0.355556,0.285714,0.634921 +-0.634921,0.285714,0.355556 +-0.634921,0.285714,0.000000 +-0.555556,0.595238,-0.311111 +-0.311111,0.595238,-0.555556 +0.000000,0.595238,-0.555556 +-0.634921,0.428571,-0.355556 +-0.355556,0.428571,-0.634921 +0.000000,0.428571,-0.634921 +-0.634921,0.285714,-0.355556 +-0.355556,0.285714,-0.634921 +0.000000,0.285714,-0.634921 +0.311111,0.595238,-0.555556 +0.555556,0.595238,-0.311111 +0.555556,0.595238,0.000000 +0.355556,0.428571,-0.634921 +0.634921,0.428571,-0.355556 +0.634921,0.428571,0.000000 +0.355556,0.285714,-0.634921 +0.634921,0.285714,-0.355556 +0.634921,0.285714,0.000000 +0.555556,0.595238,0.311111 +0.311111,0.595238,0.555556 +0.634921,0.428571,0.355556 +0.355556,0.428571,0.634921 +0.634921,0.285714,0.355556 +0.355556,0.285714,0.634921 +0.000000,0.142857,0.634921 +-0.355556,0.142857,0.634921 +-0.634921,0.142857,0.355556 +-0.634921,0.142857,0.000000 +0.000000,0.071429,0.476190 +-0.266667,0.071429,0.476190 +-0.476190,0.071429,0.266667 +-0.476190,0.071429,0.000000 +0.000000,0.047619,0.476190 +-0.266667,0.047619,0.476190 +-0.476190,0.047619,0.266667 +-0.476190,0.047619,0.000000 +-0.634921,0.142857,-0.355556 +-0.355556,0.142857,-0.634921 +0.000000,0.142857,-0.634921 +-0.476190,0.071429,-0.266667 +-0.266667,0.071429,-0.476190 +0.000000,0.071429,-0.476190 +-0.476190,0.047619,-0.266667 +-0.266667,0.047619,-0.476190 +0.000000,0.047619,-0.476190 +0.355556,0.142857,-0.634921 +0.634921,0.142857,-0.355556 +0.634921,0.142857,0.000000 +0.266667,0.071429,-0.476190 +0.476190,0.071429,-0.266667 +0.476190,0.071429,0.000000 +0.266667,0.047619,-0.476190 +0.476190,0.047619,-0.266667 +0.476190,0.047619,0.000000 +0.634921,0.142857,0.355556 +0.355556,0.142857,0.634921 +0.476190,0.071429,0.266667 +0.266667,0.071429,0.476190 +0.476190,0.047619,0.266667 +0.266667,0.047619,0.476190 +0.000000,0.642857,-0.507937 +-0.095238,0.642857,-0.507937 +-0.095238,0.714286,-0.476190 +0.000000,0.714286,-0.476190 +0.000000,0.642857,-0.730159 +-0.095238,0.642857,-0.730159 +-0.095238,0.714286,-0.793651 +0.000000,0.714286,-0.793651 +0.000000,0.642857,-0.857143 +-0.095238,0.642857,-0.857143 +-0.095238,0.714286,-0.952381 +0.000000,0.714286,-0.952381 +0.000000,0.571429,-0.857143 +-0.095238,0.571429,-0.857143 +-0.095238,0.571429,-0.952381 +0.000000,0.571429,-0.952381 +0.095238,0.714286,-0.476190 +0.095238,0.642857,-0.507937 +0.095238,0.714286,-0.793651 +0.095238,0.642857,-0.730159 +0.095238,0.714286,-0.952381 +0.095238,0.642857,-0.857143 +0.095238,0.571429,-0.952381 +0.095238,0.571429,-0.857143 +0.000000,0.500000,-0.857143 +-0.095238,0.500000,-0.857143 +-0.095238,0.428571,-0.952381 +0.000000,0.428571,-0.952381 +0.000000,0.357143,-0.793651 +-0.095238,0.357143,-0.793651 +-0.095238,0.297619,-0.841270 +0.000000,0.297619,-0.841270 +-0.095238,0.285714,-0.634921 +-0.095238,0.190476,-0.603175 +0.000000,0.190476,-0.603175 +0.095238,0.428571,-0.952381 +0.095238,0.500000,-0.857143 +0.095238,0.297619,-0.841270 +0.095238,0.357143,-0.793651 +0.095238,0.190476,-0.603175 +0.095238,0.285714,-0.634921 +0.000000,0.452381,0.539683 +-0.209524,0.452381,0.539683 +-0.209524,0.190476,0.539683 +0.000000,0.190476,0.539683 +0.000000,0.452381,0.825397 +-0.209524,0.452381,0.825397 +-0.209524,0.261905,0.984127 +0.000000,0.261905,0.984127 +0.000000,0.666667,0.730159 +-0.079365,0.666667,0.730159 +-0.079365,0.642857,0.761905 +0.000000,0.642857,0.761905 +0.000000,0.761905,0.857143 +-0.079365,0.761905,0.857143 +-0.079365,0.761905,1.047619 +0.000000,0.761905,1.047619 +0.209524,0.190476,0.539683 +0.209524,0.452381,0.539683 +0.209524,0.261905,0.984127 +0.209524,0.452381,0.825397 +0.079365,0.642857,0.761905 +0.079365,0.666667,0.730159 +0.079365,0.761905,1.047619 +0.079365,0.761905,0.857143 +0.000000,0.785714,0.888889 +-0.079365,0.785714,0.888889 +-0.079365,0.791667,1.119048 +0.000000,0.791667,1.119048 +0.000000,0.785714,0.920635 +-0.047619,0.785714,0.920635 +-0.047619,0.797619,1.095238 +0.000000,0.797619,1.095238 +0.000000,0.761905,0.888889 +-0.047619,0.761905,0.888889 +-0.047619,0.761905,1.015873 +0.000000,0.761905,1.015873 +0.079365,0.791667,1.119048 +0.079365,0.785714,0.888889 +0.047619,0.797619,1.095238 +0.047619,0.785714,0.920635 +0.047619,0.761905,1.015873 +0.047619,0.761905,0.888889 +0.000000,1.000000,0.000000 +-0.000635,1.000000,0.000000 +0.000000,1.000000,0.000635 +0.000000,1.000000,0.253968 +-0.142857,1.000000,0.253968 +-0.253968,1.000000,0.142857 +-0.253968,1.000000,0.000000 +0.000000,0.904762,0.000000 +0.000000,0.857143,0.063492 +-0.035556,0.857143,0.063492 +-0.063492,0.857143,0.035556 +-0.063492,0.857143,0.000000 +0.000000,1.000000,-0.000635 +-0.253968,1.000000,-0.142857 +-0.142857,1.000000,-0.253968 +0.000000,1.000000,-0.253968 +-0.063492,0.857143,-0.035556 +-0.035556,0.857143,-0.063492 +0.000000,0.857143,-0.063492 +0.000635,1.000000,0.000000 +0.142857,1.000000,-0.253968 +0.253968,1.000000,-0.142857 +0.253968,1.000000,0.000000 +0.035556,0.857143,-0.063492 +0.063492,0.857143,-0.035556 +0.063492,0.857143,0.000000 +0.253968,1.000000,0.142857 +0.142857,1.000000,0.253968 +0.063492,0.857143,0.035556 +0.035556,0.857143,0.063492 +0.000000,0.809524,0.126984 +-0.071111,0.809524,0.126984 +-0.126984,0.809524,0.071111 +-0.126984,0.809524,0.000000 +0.000000,0.809524,0.412698 +-0.231111,0.809524,0.412698 +-0.412698,0.809524,0.231111 +-0.412698,0.809524,0.000000 +0.000000,0.761905,0.412698 +-0.231111,0.761905,0.412698 +-0.412698,0.761905,0.231111 +-0.412698,0.761905,0.000000 +-0.126984,0.809524,-0.071111 +-0.071111,0.809524,-0.126984 +0.000000,0.809524,-0.126984 +-0.412698,0.809524,-0.231111 +-0.231111,0.809524,-0.412698 +0.000000,0.809524,-0.412698 +-0.412698,0.761905,-0.231111 +-0.231111,0.761905,-0.412698 +0.000000,0.761905,-0.412698 +0.071111,0.809524,-0.126984 +0.126984,0.809524,-0.071111 +0.126984,0.809524,0.000000 +0.231111,0.809524,-0.412698 +0.412698,0.809524,-0.231111 +0.412698,0.809524,0.000000 +0.231111,0.761905,-0.412698 +0.412698,0.761905,-0.231111 +0.412698,0.761905,0.000000 +0.126984,0.809524,0.071111 +0.071111,0.809524,0.126984 +0.412698,0.809524,0.231111 +0.231111,0.809524,0.412698 +0.412698,0.761905,0.231111 +0.231111,0.761905,0.412698 +0.000000,0.000000,0.000000 +0.000000,0.047619,0.476190 +0.266667,0.047619,0.476190 +0.476190,0.047619,0.266667 +0.476190,0.047619,0.000000 +0.000000,0.023810,0.476190 +0.266667,0.023810,0.476190 +0.476190,0.023810,0.266667 +0.476190,0.023810,0.000000 +0.000000,0.000000,0.452381 +0.253333,0.000000,0.452381 +0.452381,0.000000,0.253333 +0.452381,0.000000,0.000000 +0.476190,0.047619,-0.266667 +0.266667,0.047619,-0.476190 +0.000000,0.047619,-0.476190 +0.476190,0.023810,-0.266667 +0.266667,0.023810,-0.476190 +0.000000,0.023810,-0.476190 +0.452381,0.000000,-0.253333 +0.253333,0.000000,-0.452381 +0.000000,0.000000,-0.452381 +-0.266667,0.047619,-0.476190 +-0.476190,0.047619,-0.266667 +-0.476190,0.047619,0.000000 +-0.266667,0.023810,-0.476190 +-0.476190,0.023810,-0.266667 +-0.476190,0.023810,0.000000 +-0.253333,0.000000,-0.452381 +-0.452381,0.000000,-0.253333 +-0.452381,0.000000,0.000000 +-0.476190,0.047619,0.266667 +-0.266667,0.047619,0.476190 +-0.476190,0.023810,0.266667 +-0.266667,0.023810,0.476190 +-0.452381,0.000000,0.253333 +-0.253333,0.000000,0.452381 diff --git a/src/threed/geometry/qglcylinder.cpp b/src/threed/geometry/qglcylinder.cpp index 76f5fc75a..ee07f13c1 100644 --- a/src/threed/geometry/qglcylinder.cpp +++ b/src/threed/geometry/qglcylinder.cpp @@ -354,6 +354,7 @@ QGLBuilder& operator<<(QGLBuilder& builder, const QGLCylinder& cylinder) qreal radiusIncrement = qreal(bottomRadius-topRadius)/ numLayers; qreal height = qreal(cylinder.height()); qreal heightDecrement = height/numLayers; + height *= 0.5; qreal textureHeight = 1.0; qreal textureDecrement = 1.0/numLayers; diff --git a/tests/auto/threed/qglcylinder/tst_qglcylinder.cpp b/tests/auto/threed/qglcylinder/tst_qglcylinder.cpp index ba6da836c..edc62b72c 100644 --- a/tests/auto/threed/qglcylinder/tst_qglcylinder.cpp +++ b/tests/auto/threed/qglcylinder/tst_qglcylinder.cpp @@ -179,20 +179,20 @@ void tst_QGLCylinder::modify() // top and bottom diameters for the cylinder. bool tst_QGLCylinder::validateCylinder(QGLSceneNode *node, qreal topDiameter, qreal baseDiameter, qreal height, bool topAttached, bool baseAttached) { - QGLSceneNode *lid = node->findChild<QGLSceneNode *>("Cylinder Top"); + QGLSceneNode *top = node->findChild<QGLSceneNode *>("Cylinder Top"); QGLSceneNode *sides = node->findChild<QGLSceneNode *>("Cylinder Sides"); QGLSceneNode *base = node->findChild<QGLSceneNode *>("Cylinder Base"); //Top of the cylinder - test the normals and vertical position if (topAttached) { - if (!lid) { + if (!top) { return false; } - QGeometryData dataTop = lid->geometry(); - int start = lid->start(); - int count = lid->count(); + QGeometryData dataTop = top->geometry(); + int start = top->start(); + int count = top->count(); if (count <= 0) { return false; @@ -202,7 +202,7 @@ bool tst_QGLCylinder::validateCylinder(QGLSceneNode *node, qreal topDiameter, qr for (int index = 0; index < count; ++index) { QVector3D v = dataTop.vertexAt(indices.at(index + start)); QVector3D n = dataTop.normalAt(indices.at(index + start)); - if (v.z()!=height) { + if (v.z()!=0.5*height) { return false; } QVector2D p(v.x(), v.y()); @@ -220,15 +220,19 @@ bool tst_QGLCylinder::validateCylinder(QGLSceneNode *node, qreal topDiameter, qr { if (!base) return false; - QGeometryData dataBase = sides->geometry(); - int start = sides->start(); - int count = sides->count(); + QGeometryData dataBase = base->geometry(); + int start = base->start(); + int count = base->count(); if (count <= 0) return false; QGL::IndexArray indices = dataBase.indices(); for (int index = 0; index < count; ++index) { QVector3D v = dataBase.vertexAt(indices.at(index + start)); QVector3D n = dataBase.normalAt(indices.at(index + start)); + if (v.z()!=-0.5*height) { + return false; + } + QVector2D p(v.x(), v.y()); if (qAbs(p.length())>(baseDiameter/2.0)) { return false; |