Unofficial OpenGL Software Development Kit: C:/Projects/distro/glsdk_0_5_1/glmesh/include/glmesh/BoostDraw.h Source File

Unofficial OpenGL Software Development Kit 0.5.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
BoostDraw.h
Go to the documentation of this file.
1
2 #ifndef GLSDK_MESH_DRAW_WITH_BOOST_H
3 #define GLSDK_MESH_DRAW_WITH_BOOST_H
4
11 #include "Draw.h"
12 #include "VertexFormat.h"
13 #include "VertexWriter.h"
14 #include <boost/fusion/algorithm.hpp>
15 #include <boost/fusion/adapted/boost_tuple.hpp>
16 #include <boost/fusion/include/boost_tuple.hpp>
17
18 namespace glmesh
19 {
20 namespace _detail
21 {
22 template<typename AttribType>
23 struct AttribTypeTraits
24 {
25 typedef AttribType value_type;
26 };
27
28 template<typename T>
29 struct AttribTypeTraits<glm::detail::tvec1<T> >
30 {
31 typedef T value_type;
32 };
33
34 template<typename T>
35 struct AttribTypeTraits<glm::detail::tvec2<T> >
36 {
37 typedef T value_type;
38 };
39
40 template<typename T>
41 struct AttribTypeTraits<glm::detail::tvec3<T> >
42 {
43 typedef T value_type;
44 };
45
46 template<typename T>
47 struct AttribTypeTraits<glm::detail::tvec4<T> >
48 {
49 typedef T value_type;
50 };
51
52
53 template<typename Sink>
54 struct WriteAttrib
55 {
56 WriteAttrib(VertexWriter<Sink> &drawable) : m_drawable(drawable) {}
57
58 template<typename AttribType>
59 void operator()(const AttribType &attribute) const
60 {
61 typedef typename glmesh::_detail::AttribTypeTraits<AttribType>::value_type GccSucks;
62 m_drawable.template Attrib<GccSucks>(attribute);
63 }
64
65 private:
66 VertexWriter<Sink> &m_drawable;
67 };
68 }
69
136 template<typename Sink, typename VertexSequence>
137 void Attrib(VertexWriter<Sink> &drawable, const VertexSequence &vertexData)
138 {
139 boost::fusion::for_each(vertexData, _detail::WriteAttrib<Sink>(drawable));
140 }
141 }
142
143
144
145 #endif //GLSDK_MESH_DRAW_WITH_BOOST_H