]> git.tdb.fi Git - libs/gl.git/blobdiff - source/primitivebuilder.cpp
Bind ProgramData to a Program upon construction
[libs/gl.git] / source / primitivebuilder.cpp
index 95faa3fb5f74aee13e63f392bda69e4871d700e5..42e9d39cbb71c5bf1f56eaf53975bdd140fd607d 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Copyright © 2008, 2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -21,8 +21,8 @@ void PrimitiveBuilder::begin(PrimitiveType t)
        if(in_batch)
                throw InvalidState("begin() already called");
 
-       type=t;
-       in_batch=true;
+       type = t;
+       in_batch = true;
 
        begin_();
 }
@@ -32,7 +32,7 @@ void PrimitiveBuilder::end()
        if(!in_batch)
                throw InvalidState("end() called without begin()");
 
-       in_batch=false;
+       in_batch = false;
 
        end_();
 }
@@ -53,14 +53,15 @@ PrimitiveType PrimitiveBuilder::get_type() const
        return type;
 }
 
-void PrimitiveBuilder::vertex_(float x, float y, float z, float w)
+void PrimitiveBuilder::vertex_(const Vector4 &v)
 {
-       vab.texcoord(ts, tt, tr, tq);
-       vab.color(cr, cg, cb, ca);
-       vab.normal(nx, ny, nz);
-       for(std::map<unsigned, Attrib>::iterator i=av.begin(); i!=av.end(); ++i)
-               vab.attrib(i->first, i->second.x, i->second.y, i->second.z, i->second.w);
-       vab.vertex(x, y, z, w);
+       vab.color(col);
+       vab.normal(nor);
+       for(std::map<unsigned, Vector4>::iterator i=texc.begin(); i!=texc.end(); ++i)
+               vab.multitexcoord(i->first, i->second);
+       for(std::map<unsigned, Vector4>::iterator i=attr.begin(); i!=attr.end(); ++i)
+               vab.attrib(i->first, i->second);
+       vab.vertex(v);
 
        if(in_batch)
                element_(array.size()-1);