]> git.tdb.fi Git - libs/gl.git/blob - source/sphere.h
Explicitly define the number of mipmap levels in textures
[libs/gl.git] / source / sphere.h
1 #ifndef MSP_GL_SPHERE_H_
2 #define MSP_GL_SPHERE_H_
3
4 #include "geometrybuilder.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class UvSphereBuilder: public GeometryBuilder
10 {
11 private:
12         float radius;
13         unsigned segments;
14         unsigned rings;
15
16 public:
17         UvSphereBuilder(float, unsigned, unsigned = 0);
18
19         using GeometryBuilder::build;
20         virtual void build(PrimitiveBuilder &) const;
21 };
22
23
24 class IcoSphereBuilder: public GeometryBuilder
25 {
26 private:
27         float radius;
28         unsigned subdivision;
29
30         static float base_vertices[];
31         static unsigned base_triangles[];
32         static unsigned base_edges[];
33         static unsigned base_tri_edges[];
34
35 public:
36         IcoSphereBuilder(float, unsigned);
37 private:
38         static void initialize_edges();
39
40 public:
41         using GeometryBuilder::build;
42         virtual void build(PrimitiveBuilder &) const;
43
44 private:
45         unsigned edge_vertex(unsigned, unsigned) const;
46 };
47
48 } // namespace GL
49 } // namespace Msp
50
51 #endif