1 #include "vertexarray.h"
2 #include "vertexarraybuilder.h"
7 VertexArrayBuilder::VertexArrayBuilder(VertexArray &a):
11 void VertexArrayBuilder::vertex_(const Vector4 &v)
13 float *ptr = array.append();
14 for(const unsigned char *c=array.get_format().begin(); c!=array.get_format().end(); ++c)
16 unsigned sz = (*c&3)+1;
23 if(sz>=3) *ptr++ = v.z;
24 if(sz>=4) *ptr++ = v.w;
34 union { unsigned char c[4]; float f; } u;
35 u.c[0] = static_cast<unsigned char>(col.r*255);
36 u.c[1] = static_cast<unsigned char>(col.g*255);
37 u.c[2] = static_cast<unsigned char>(col.b*255);
38 u.c[3] = static_cast<unsigned char>(col.a*255);
46 if(sz>=4) *ptr++ = col.a;
50 const Vector4 &a = (t<11 ? texc[t-3] : attr[t-11]);
52 if(sz>=2) *ptr++ = a.y;
53 if(sz>=3) *ptr++ = a.z;
54 if(sz>=4) *ptr++ = a.w;