#include "Vectorbuffer.hpp"


Vectorbuffer::Vectorbuffer()
{
}


Vectorbuffer::~Vectorbuffer()
{
    if (values)
        delete [] values;
}

void Vectorbuffer::start()
{
    this->list = new Lista2();
    this->count = 0;
}

void Vectorbuffer::add(Vector &v)
{
    Vector *t = new Vector(v.x, v.y, v.z);
    this->list->add(t);
}

void Vectorbuffer::finalize()
{
    int i;
    list->goToStart();
    this->count = list->getNodeCount();

    this->values = new Vector[this->count];
    for (i=0;i<count;i++)
    {
        Vector *c = (Vector *)this->list->getCurrent();
        this->values[i] = *c;
        list->goForward();
    }
    delete this->list;
}



