3 This file is part of libmspgl
4 Copyright © 2008, 2010 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_(const Vector4 &v)
60 for(std::map<unsigned, Vector4>::iterator i=texc.begin(); i!=texc.end(); ++i)
61 vab.multitexcoord(i->first, i->second);
62 for(std::map<unsigned, Vector4>::iterator i=attr.begin(); i!=attr.end(); ++i)
63 vab.attrib(i->first, i->second);
67 element_(array.size()-1);