2 #include "primitivebuilder.h"
9 PrimitiveBuilder::PrimitiveBuilder(VertexArray &a):
16 void PrimitiveBuilder::begin(PrimitiveType t)
19 throw invalid_operation("PrimitiveBuilder::begin");
27 void PrimitiveBuilder::end()
30 throw invalid_operation("PrimitiveBuilder::end");
37 void PrimitiveBuilder::offset(unsigned o)
40 throw out_of_range("PrimitiveBuilder::offset");
44 void PrimitiveBuilder::element(unsigned i)
47 throw invalid_operation("PrimitiveBuilder::element");
48 if(offs+i>=array.size())
49 throw out_of_range("PrimitiveBuilder::element");
53 PrimitiveType PrimitiveBuilder::get_type() const
56 throw invalid_operation("PrimitiveBuilder::get_type");
60 void PrimitiveBuilder::vertex_(const Vector4 &v)
62 const VertexFormat &format = array.get_format();
63 for(const unsigned char *a=format.begin(); a!=format.end(); ++a)
65 unsigned sem = get_attribute_semantic(*a);
67 vab.attrib(sem, attr[sem]);
72 element_(array.size()-1);