3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include "primitivebuilder.h"
13 PrimitiveBuilder::PrimitiveBuilder(VertexArray &a):
19 void PrimitiveBuilder::begin(PrimitiveType t)
22 throw InvalidState("begin() already called");
30 void PrimitiveBuilder::end()
33 throw InvalidState("end() called without begin()");
40 void PrimitiveBuilder::element(unsigned i)
43 throw InvalidState("Element specification not between begin() and end()");
45 throw InvalidParameterValue("Element index out of range");
49 PrimitiveType PrimitiveBuilder::get_type() const
52 throw InvalidState("Not between begin() and end()");
56 void PrimitiveBuilder::vertex_(float x, float y, float z, float w)
58 vab.texcoord(ts, tt, tr,tq);
59 vab.color(cr, cg, cb, ca);
60 vab.normal(nx, ny, nz);
61 vab.vertex(x, y, z, w);
64 element_(array.size()-1);