Printing type name in static assert
Martin Cejp
minexew at gmail.com
Sat Jan 25 03:55:12 PST 2014
alias Field = typeof(__traits(getMember, Vertex, fieldName));
const bool normalized = HasAnnotation!(Vertex, fieldName,
Normalized);
const int fieldOffset = __traits(getMember, Vertex.init,
fieldName).offsetof;
int i = GetAnnotationInstance!(Vertex, fieldName, Position).pos;
glVertexAttribPointer(i, cast(GLint) numElements!Field,
TypeToGLEnum!(ElementType!Field),
normalized ? GL_TRUE : GL_FALSE, Vertex.sizeof,
cast(void*) fieldOffset);
glEnableVertexAttribArray(i);
I'm starting to like this language :-)
More information about the Digitalmars-d
mailing list