X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprimitivebuilder.cpp;h=dd869908d9240df76b2f48a2308a0396613a35ad;hp=22106a344a828326c7329c5f482bc2a230e56a92;hb=HEAD;hpb=4443707c752ab8ee288f1c22be08cf82f27439d7 diff --git a/source/primitivebuilder.cpp b/source/primitivebuilder.cpp deleted file mode 100644 index 22106a34..00000000 --- a/source/primitivebuilder.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2008, 2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include "primitivebuilder.h" - -namespace Msp { -namespace GL { - -PrimitiveBuilder::PrimitiveBuilder(VertexArray &a): - array(a), - vab(array), - in_batch(false) -{ } - -void PrimitiveBuilder::begin(PrimitiveType t) -{ - if(in_batch) - throw InvalidState("begin() already called"); - - type = t; - in_batch = true; - - begin_(); -} - -void PrimitiveBuilder::end() -{ - if(!in_batch) - throw InvalidState("end() called without begin()"); - - in_batch = false; - - end_(); -} - -void PrimitiveBuilder::element(unsigned i) -{ - if(!in_batch) - throw InvalidState("Element specification not between begin() and end()"); - if(i>=array.size()) - throw InvalidParameterValue("Element index out of range"); - element_(i); -} - -PrimitiveType PrimitiveBuilder::get_type() const -{ - if(!in_batch) - throw InvalidState("Not between begin() and end()"); - return type; -} - -void PrimitiveBuilder::vertex_(float x, float y, float z, float w) -{ - vab.color(col); - vab.normal(nor); - for(std::map::iterator i=texc.begin(); i!=texc.end(); ++i) - vab.multitexcoord(i->first, i->second); - for(std::map::iterator i=attr.begin(); i!=attr.end(); ++i) - vab.attrib(i->first, i->second); - vab.vertex(x, y, z, w); - - if(in_batch) - element_(array.size()-1); -} - -} // namespace GL -} // namespace Msp