summaryrefslogtreecommitdiffstats
path: root/src/glsphere.h
blob: f8841170aec4fd228bd5b34afcd4f58f0248f6f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef GLSPHERE_H
#define GLSPHERE_H

#include <cmath>

#include "glbody.h"


class GLSphere : public GLBody
{
public:
    GLSphere(double radius = 1.0, int stacks = 10, int slices = 10);
    virtual void makeSurface(QVector<GLPoint> *pointContainer,
                             QVector<GLshort> *indexContainer);

private:
    /**
     * @brief calculatePoint
     * @param zRotation
     * @param yRotation
     * @return
     */
    QVector3D calculatePoint(double sliceRotation, double stackRotation);

    QVector<QVector3D> calculateRow(int slice);

    int m_stacks;
    int m_slices;
    QVector<QVector3D> firstRow;
};

#endif // GLSPHERE_H