diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/glsphere.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/glsphere.cpp b/src/glsphere.cpp index 15f745a..8fedd0e 100644 --- a/src/glsphere.cpp +++ b/src/glsphere.cpp @@ -35,6 +35,31 @@ void GLSphere::makeSurface(QVector<GLPoint> *pointContainer, m_points->append(GLPoint(m_radius * southpol, southpol, t0, m_color)); m_nextPoint = m_points->size(); + + m_firstIndex = m_indices->size(); + + for (int slice = 1; slice < m_slices - 1; slice += 2) + { + m_indices->append(m_firstPoint); + + for (int stack = 0; stack < m_stacks - 1; stack++) + { + m_indices->append((m_firstPoint + 1) + stack + ((m_stacks - 1) * (slice - 1))); + m_indices->append((m_firstPoint + 1) + stack + ((m_stacks - 1) * slice)); + } + + m_indices->append(m_nextPoint - 1); + + for (int stack = m_stacks - 2; stack >= 0; stack--) + { + m_indices->append((m_firstPoint + 1) + stack + ((m_stacks - 1) * (slice + 1))); + m_indices->append((m_firstPoint + 1) + stack + ((m_stacks - 1) * slice)); + } + + m_indices->append(m_firstPoint); + } + + m_nextIndex = m_indices->size(); } QVector3D GLSphere::calculatePoint(double sliceRotation, double stackRotation) |
