summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-11-16 21:48:22 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-11-16 21:48:22 +0100
commit0846219097ff8a8bce7773fc4f0fb4f343a0fe8d (patch)
tree5d703749b59176207607fad602f200859f487d96
parent0aa9701b362f520e75c0ba417b3eea730632be26 (diff)
downloadMultimedia-0846219097ff8a8bce7773fc4f0fb4f343a0fe8d.tar.gz
Multimedia-0846219097ff8a8bce7773fc4f0fb4f343a0fe8d.zip
Add normals and color
-rw-r--r--src/glsphere.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/glsphere.cpp b/src/glsphere.cpp
index d77ef95..e5348f2 100644
--- a/src/glsphere.cpp
+++ b/src/glsphere.cpp
@@ -12,31 +12,31 @@ void GLSphere::makeSurface(QVector<GLPoint> *pointContainer,
{
GLBody::makeSurface(pointContainer, indexContainer);
- QVector3D n0 = v_XYZ; //dummy normal
QVector3D t0 = QVector3D(0.0, 0.0, 0.0); //dummy texture
QVector3D northpol = v_Y * m_radius;
QVector3D southpol = -v_Y * m_radius;
+ QVector3D point1;
+ QVector3D point2;
+
m_firstPoint = m_points->size();
for (int slice = 1; slice < m_slices; slice += 2)
{
- m_points->append(GLPoint(northpol, n0, t0, GLColorRgba::clMagenta));
+ m_points->append(GLPoint(northpol, northpol.normalized(), t0, m_color));
for (int stack = 1; stack < m_stacks; stack++)
{
- m_points->append(GLPoint(calculatePoint(2 * M_PI * slice / m_slices,
- stack * M_PI / m_stacks), n0, t0,
- m_color));
+ 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(calculatePoint(2 * M_PI * (slice - 1) / m_slices,
- stack * M_PI / m_stacks), n0, 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(southpol, n0, t0, GLColorRgba::clMagenta));
+ m_points->append(GLPoint(southpol, southpol.normalized(), t0, m_color));
}
m_nextPoint = m_points->size();