13 #ifndef OGLPLUS_SHAPES_TETRAHEDRONS_1201311347_HPP
14 #define OGLPLUS_SHAPES_TETRAHEDRONS_1201311347_HPP
30 :
public DrawingInstructionWriter
46 , _divisions(divisions)
49 assert(divisions > 0);
62 const unsigned n = _divisions + 1;
64 dest.resize(n*n*n*3+3);
70 GLdouble step = _side / _divisions;
72 for(
unsigned z=0; z!=n; ++z)
73 for(
unsigned y=0; y!=n; ++y)
74 for(
unsigned x=0; x!=n; ++x)
76 dest[k++] =
T(x*step);
77 dest[k++] =
T(y*step);
78 dest[k++] =
T(z*step);
80 assert(k == dest.size());
88 const unsigned n = _divisions + 1;
90 dest.resize(n*n*n*3+3);
96 GLdouble step = 1.0 / _divisions;
98 for(
unsigned z=0; z!=n; ++z)
99 for(
unsigned y=0; y!=n; ++y)
100 for(
unsigned x=0; x!=n; ++x)
102 dest[k++] =
T(x*step);
103 dest[k++] =
T(y*step);
104 dest[k++] =
T(z*step);
106 assert(k == dest.size());
110 #if OGLPLUS_DOCUMENTATION_ONLY
119 typedef VertexAttribsInfo<
123 VertexTexCoordinatesTag
129 template <
typename T>
147 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
148 #include <oglplus/shapes/tetrahedrons.ipp>
149 #endif //OGLPLUS_LINK_LIBRARY
151 #endif // include guard
Implementation of shape draw instructions.
IndexArray Indices(WithAdjacency=WithAdjacency()) const
Returns element indices that are used with the drawing instructions.
FaceOrientation
Face orientation enumeration.
Definition: face_mode.hpp:62
OpenGL face type-related enumeration.
GLuint Positions(std::vector< T > &dest) const
Makes vertex coordinates and returns number of values per vertex.
Definition: tetrahedrons.hpp:60
GLuint TexCoordinates(std::vector< T > &dest) const
Makes texture coorinates and returns number of values per vertex.
Definition: tetrahedrons.hpp:86
Tetrahedrons(void)
Makes a unit sized tetrahedra filled cube with 10 divisions.
Definition: tetrahedrons.hpp:38
std::vector< GLuint > IndexArray
The type of index container returned by Indices()
Definition: tetrahedrons.hpp:135
Provides data and instructions for rendering of cube filling tetrahedrons.
Definition: tetrahedrons.hpp:29
FaceOrientation FaceWinding(void) const
Returns the winding direction of faces.
Definition: tetrahedrons.hpp:53
Tetrahedrons(GLdouble side, unsigned divisions)
Makes a cube with the specified side and number of divisions.
Definition: tetrahedrons.hpp:44
Classes providing additional information about the shape builders.
Class encapsulating the instructions for drawing of a shape.
Definition: draw.hpp:219
DrawingInstructions Instructions(WithAdjacency=WithAdjacency()) const
Returns the instructions for rendering.
Class implementing sphere-related functionality.
Definition: sphere.hpp:29
VertexAttribsInfo< Tetrahedrons > VertexAttribs
Vertex attribute information for this shape builder.
Definition: tetrahedrons.hpp:117