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):
18 void PrimitiveBuilder::begin(PrimitiveType t)
21 throw InvalidState("begin() already called");
25 builder=array.modify();
30 void PrimitiveBuilder::end()
33 throw InvalidState("end() called without begin()");
41 void PrimitiveBuilder::element(unsigned i)
44 throw InvalidState("Element specification not between begin() and end()");
46 throw InvalidParameterValue("Element index out of range");
50 PrimitiveType PrimitiveBuilder::get_type() const
53 throw InvalidState("Not between begin() and end()");
57 void PrimitiveBuilder::vertex_(float x, float y, float z, float w)
59 builder->texcoord(ts, tt, tr,tq);
60 builder->color(cr, cg, cb, ca);
61 builder->normal(nx, ny, nz);
62 builder->vertex(x, y, z, w);
65 element_(array.size()-1);