27d69715 |
#include <cstddef>
#include <glm/glm.hpp>
#include <glbase.hpp>
#include <gltraits.hpp>
template<
|
5ee00b59 |
typename T,
|
27d69715 |
typename Value,
|
23a16d29 |
std::size_t offset,
typename... Members
|
27d69715 |
>
void vertex_setup(
|
23a16d29 |
GLTraits::Members<T, GLTraits::Member<Value, offset>, Members...>,
GLint location = 0
|
27d69715 |
)
{
|
5ee00b59 |
GLTraits::Value<Value>::vertex_attrib_pointer(location, offset, sizeof(T));
|
27d69715 |
vertex_setup(
|
23a16d29 |
GLTraits::Members<T, Members...>{},
|
27d69715 |
location + GLTraits::Value<Value>::columns
);
}
|
5ee00b59 |
template<typename T>
|
23a16d29 |
void vertex_setup(GLTraits::Members<T>, GLint)
|
27d69715 |
{}
int main()
{
struct Vertex
{
glm::vec3 position;
glm::vec2 tex_coord;
glm::mat3 tbn;
glm::ivec4 bone_indices;
glm::vec4 bone_weights;
GLubyte flags;
GLdouble unaligned;
};
|
5ee00b59 |
vertex_setup(GLTraits::members<Vertex>());
|
27d69715 |
}
|