3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include "vertexarray.h"
9 #include "vertexarraybuilder.h"
14 VertexArrayBuilder::VertexArrayBuilder(VertexArray &a):
18 VertexArrayBuilder::~VertexArrayBuilder()
23 void VertexArrayBuilder::vertex_(float x, float y, float z, float w)
25 float *ptr=array.append();
26 for(uint fmt=array.get_format(); fmt; fmt>>=4)
44 if(size>=2) *+ptr++=tt;
45 if(size>=3) *+ptr++=tr;
46 if(size>=4) *+ptr++=tq;
51 union { ubyte c[4]; float f; } u;
52 u.c[0]=static_cast<ubyte>(cr*255);
53 u.c[1]=static_cast<ubyte>(cg*255);
54 u.c[2]=static_cast<ubyte>(cb*255);
55 u.c[3]=static_cast<ubyte>(ca*255);
63 if(size>=4) *+ptr++=ca;