13 #ifndef OGLPLUS_SHAPES_SUBDIV_SPHERE_1309171555_HPP
14 #define OGLPLUS_SHAPES_SUBDIV_SPHERE_1309171555_HPP
28 OGLPLUS_ENUM_CLASS_BEGIN(SubdivSphereInitialShape, GLuint)
29 OGLPLUS_ENUM_CLASS_VALUE(Icosahedron, 0)
30 OGLPLUS_ENUM_CLASS_COMMA
31 OGLPLUS_ENUM_CLASS_VALUE(Octohedron, 1)
32 OGLPLUS_ENUM_CLASS_COMMA
33 OGLPLUS_ENUM_CLASS_VALUE(Tetrahedron, 2)
34 OGLPLUS_ENUM_CLASS_END(SubdivSphereInitialShape)
38 : public DrawingInstructionWriter
43 std::vector<GLdouble> _positions;
44 std::vector<GLuint> _indices;
46 typedef std::pair<GLuint, GLuint> _edge;
47 std::map<_edge, GLuint> _midpoints;
49 GLuint _midpoint(GLuint ia, GLuint ib);
50 void _subdivide(GLuint ia, GLuint ib, GLuint ic, GLuint levels);
51 void _make_face(GLuint ia, GLuint ib, GLuint ic, GLuint levels);
53 void _init_icosah(
void);
54 void _init_tetrah(
void);
55 void _init_octoh(
void);
57 typedef SubdivSphereInitialShape InitialShape;
85 dest.assign(_positions.begin(), _positions.end());
89 #if OGLPLUS_DOCUMENTATION_ONLY
97 typedef VertexAttribsInfo<
99 std::tuple<VertexPositionsTag>
104 template <
typename T>
116 return IndexArray(_indices.begin(), _indices.end());
131 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
132 #include <oglplus/shapes/subdiv_sphere.ipp>
133 #endif // OGLPLUS_LINK_LIBRARY
135 #endif // include guard
Implementation of shape draw instructions.
VertexAttribsInfo< SubdivSphere > VertexAttribs
Vertex attribute information for this shape builder.
Definition: subdiv_sphere.hpp:95
PrimitiveType
Primitive type enumeration.
Definition: primitive_type.hpp:29
FaceOrientation FaceWinding(void) const
Returns the winding direction of faces.
Definition: subdiv_sphere.hpp:74
void BoundingSphere(oglplus::Sphere< T > &bounding_sphere) const
Queries the bounding sphere coordinates and dimensions.
Definition: subdiv_sphere.hpp:105
FaceOrientation
Face orientation enumeration.
Definition: face_mode.hpp:62
OpenGL face type-related enumeration.
Class providing vertex attributes and instructions for drawing of a sphere.
Definition: subdiv_sphere.hpp:37
DrawingInstructions Instructions(Default=Default()) const
Returns the instructions for rendering of faces.
Definition: subdiv_sphere.hpp:122
Classes providing additional information about the shape builders.
std::vector< GLuint > IndexArray
The type of the index container returned by Indices()
Definition: subdiv_sphere.hpp:111
Class encapsulating the instructions for drawing of a shape.
Definition: draw.hpp:219
Class implementing sphere-related functionality.
Definition: sphere.hpp:29
GLuint Positions(std::vector< T > &dest) const
Makes the positions and returns the number of values per vertex.
Definition: subdiv_sphere.hpp:83
IndexArray Indices(Default=Default()) const
Returns element indices that are used with the drawing instructions.
Definition: subdiv_sphere.hpp:114