13 #ifndef OGLPLUS_SHAPES_TWISTED_TORUS_1201021336_HPP
14 #define OGLPLUS_SHAPES_TWISTED_TORUS_1201021336_HPP
29 :
public DrawingInstructionWriter
33 const GLdouble _radius_out, _radius_in, _thickness;
34 const GLdouble _r_slip_coef, _s_slip_coef;
35 const unsigned _sections, _rings, _twist;
57 ): _radius_out(rad_out)
59 , _thickness(thickness)
66 assert(_sections % 2 == 0);
67 assert(_rings % 2 == 0);
68 assert(_thickness > 0.0);
69 assert(_thickness < _radius_in);
70 assert(_radius_in < _radius_out);
79 std::vector<GLfloat> _positions(
void)
const;
81 GLuint Positions(std::vector<GLfloat>& dest)
const
91 auto v = _positions();
92 dest.assign(v.begin(), v.end());
96 std::vector<GLfloat> _normals(
void)
const;
98 GLuint Normals(std::vector<GLfloat>& dest)
const
105 template <
typename T>
109 dest.assign(v.begin(), v.end());
113 std::vector<GLfloat> _tangents(
void)
const;
115 GLuint Tangents(std::vector<GLfloat>& dest)
const
122 template <
typename T>
125 auto v = _tangents();
126 dest.assign(v.begin(), v.end());
130 std::vector<GLfloat> _bitangents(
void)
const;
132 GLuint Bitangents(std::vector<GLfloat>& dest)
const
134 dest = _bitangents();
139 template <
typename T>
142 auto v = _bitangents();
143 dest.assign(v.begin(), v.end());
147 std::vector<GLfloat> _tex_coords(
void)
const;
149 GLuint TexCoordinates(std::vector<GLfloat>& dest)
const
151 dest = _tex_coords();
156 template <
typename T>
159 auto v = _tex_coords();
160 dest.assign(v.begin(), v.end());
164 #if OGLPLUS_DOCUMENTATION_ONLY
176 typedef VertexAttribsInfo<
183 VertexTexCoordinatesTag
189 template <
typename T>
196 T(_radius_out + _thickness)
216 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
217 #include <oglplus/shapes/twisted_torus.ipp>
218 #endif // OGLPLUS_LINK_LIBRARY
220 #endif // include guard
Implementation of shape draw instructions.
IndexArray Indices(Default=Default()) const
Returns element indices that are used with the drawing instructions.
Definition: twisted_torus.hpp:204
void BoundingSphere(oglplus::Sphere< T > &bounding_sphere) const
Queries the bounding sphere coordinates and dimensions.
Definition: twisted_torus.hpp:190
DrawingInstructions Instructions(Default=Default()) const
Returns the instructions for rendering.
TwistedTorus(GLdouble rad_out, GLdouble rad_in, GLdouble thickness, unsigned sects, unsigned rings, unsigned twist)
Creates a torus with unit radius centered at the origin.
Definition: twisted_torus.hpp:50
GLuint Normals(std::vector< T > &dest) const
Makes vertex normals and returns number of values per vertex.
Definition: twisted_torus.hpp:106
FaceOrientation FaceWinding(void) const
Returns the winding direction of faces.
Definition: twisted_torus.hpp:74
FaceOrientation
Face orientation enumeration.
Definition: face_mode.hpp:62
GLuint Positions(std::vector< T > &dest) const
Makes vertex coordinates and returns number of values per vertex.
Definition: twisted_torus.hpp:89
OpenGL face type-related enumeration.
GLuint Tangents(std::vector< T > &dest) const
Makes vertex tangents and returns number of values per vertex.
Definition: twisted_torus.hpp:123
VertexAttribsInfo< TwistedTorus > VertexAttribs
Vertex attribute information for this shape builder.
Definition: twisted_torus.hpp:174
std::vector< GLuint > IndexArray
The type of index container returned by Indices()
Definition: twisted_torus.hpp:201
TwistedTorus(void)
Creates a torus with unit radius centered at the origin.
Definition: twisted_torus.hpp:38
Classes providing additional information about the shape builders.
GLuint TexCoordinates(std::vector< T > &dest) const
Makes texture coorinates and returns number of values per vertex.
Definition: twisted_torus.hpp:157
Class encapsulating the instructions for drawing of a shape.
Definition: draw.hpp:219
Class implementing sphere-related functionality.
Definition: sphere.hpp:29
GLuint Bitangents(std::vector< T > &dest) const
Makes vertex bi-tangents and returns number of values per vertex.
Definition: twisted_torus.hpp:140
Class providing vertex attributes and instructions for rendering of a Torus.
Definition: twisted_torus.hpp:28