summaryrefslogtreecommitdiffstats
path: root/src/glsphere.cpp
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-11-17 10:00:10 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-11-17 18:28:35 +0100
commit781b2563ea559243de28ebc357b1a3f0be1e9cb2 (patch)
treeb882d994c1a7a17029a49b091145b9d3b8771aad /src/glsphere.cpp
parentdd3049c6cd5dbd70839ceb9f2229fc03cf0e6107 (diff)
downloadMultimedia-781b2563ea559243de28ebc357b1a3f0be1e9cb2.tar.gz
Multimedia-781b2563ea559243de28ebc357b1a3f0be1e9cb2.zip
Get rid of normalized
Diffstat (limited to 'src/glsphere.cpp')
-rw-r--r--src/glsphere.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/glsphere.cpp b/src/glsphere.cpp
index 84a2c59..56144f1 100644
--- a/src/glsphere.cpp
+++ b/src/glsphere.cpp
@@ -14,8 +14,8 @@ void GLSphere::makeSurface(QVector<GLPoint> *pointContainer,
QVector3D t0 = QVector3D(0.0, 0.0, 0.0); //dummy texture
- QVector3D northpol = v_Y * m_radius;
- QVector3D southpol = -v_Y * m_radius;
+ QVector3D northpol = v_Y;
+ QVector3D southpol = -v_Y;
QVector3D point1;
QVector3D point2;
@@ -24,31 +24,31 @@ void GLSphere::makeSurface(QVector<GLPoint> *pointContainer,
for (int slice = 1; slice < m_slices; slice += 2)
{
- m_points->append(GLPoint(northpol, northpol.normalized(), t0, m_color));
+ m_points->append(GLPoint(m_radius * northpol, northpol, t0, m_color));
for (int stack = 1; stack < m_stacks; stack++)
{
point1 = calculatePoint(2 * M_PI * slice / m_slices, stack * M_PI / m_stacks);
- m_points->append(GLPoint(point1, point1.normalized(), t0, m_color));
+ m_points->append(GLPoint(m_radius * point1, point1, t0, m_color));
point2 = calculatePoint(2 * M_PI * (slice - 1) / m_slices,
stack * M_PI / m_stacks);
- m_points->append(GLPoint(point2, point2.normalized(), t0, m_color));
+ m_points->append(GLPoint(m_radius * point2, point2, t0, m_color));
}
- m_points->append(GLPoint(southpol, n0, t0, m_color));
+ m_points->append(GLPoint(m_radius * southpol, southpol, t0, m_color));
- for (int stack = m_stacks - 1; stack > 1; stack--)
+ for (int stack = m_stacks - 1; stack >= 1; stack--)
{
point1 = calculatePoint(2 * M_PI * slice / m_slices, stack * M_PI / m_stacks);
- m_points->append(GLPoint(point1, point1.normalized(), t0, m_color));
+ m_points->append(GLPoint(m_radius * point1, point1, t0, m_color));
point2 = calculatePoint(2 * M_PI * (slice + 1) / m_slices,
stack * M_PI / m_stacks);
- m_points->append(GLPoint(point2, point3.normalized(), t0, m_color));
+ m_points->append(GLPoint(m_radius * point2, point2, t0, m_color));
}
- m_points->append(GLPoint(southpol, southpol.normalized(), t0, m_color));
+ m_points->append(GLPoint(m_radius * northpol, northpol, t0, m_color));
}
m_nextPoint = m_points->size();
@@ -56,9 +56,9 @@ void GLSphere::makeSurface(QVector<GLPoint> *pointContainer,
QVector3D GLSphere::calculatePoint(double sliceRotation, double stackRotation)
{
- double x = m_radius * sin(stackRotation) * sin(sliceRotation);
- double y = m_radius * cos(stackRotation);
- double z = m_radius * sin(stackRotation) * cos(sliceRotation);
+ double x = sin(stackRotation) * sin(sliceRotation);
+ double y = cos(stackRotation);
+ double z = sin(stackRotation) * cos(sliceRotation);
return QVector3D(x, y, z);
}