]> git.tdb.fi Git - libs/gl.git/blobdiff - source/primitivebuilder.cpp
Add append() method and and operator[] to VertexArray
[libs/gl.git] / source / primitivebuilder.cpp
index 92b2cb0eb0b76ef97c73875bd00f14651409c3b8..6a4d9bf0b866ccd1585a68ef05acf9b1c42df682 100644 (file)
@@ -12,6 +12,7 @@ namespace GL {
 
 PrimitiveBuilder::PrimitiveBuilder(VertexArray &a):
        array(a),
+       vab(array),
        in_batch(false)
 { }
 
@@ -22,7 +23,6 @@ void PrimitiveBuilder::begin(PrimitiveType t)
 
        type=t;
        in_batch=true;
-       builder=array.modify();
 
        begin_();
 }
@@ -32,7 +32,6 @@ void PrimitiveBuilder::end()
        if(!in_batch)
                throw InvalidState("end() called without begin()");
 
-       builder=0;
        in_batch=false;
 
        end_();
@@ -56,10 +55,10 @@ PrimitiveType PrimitiveBuilder::get_type() const
 
 void PrimitiveBuilder::vertex_(float x, float y, float z, float w)
 {
-       builder->texcoord(ts, tt, tr,tq);
-       builder->color(cr, cg, cb, ca);
-       builder->normal(nx, ny, nz);
-       builder->vertex(x, y, z, w);
+       vab.texcoord(ts, tt, tr,tq);
+       vab.color(cr, cg, cb, ca);
+       vab.normal(nx, ny, nz);
+       vab.vertex(x, y, z, w);
 
        if(in_batch)
                element_(array.size()-1);