Index: trunk/src/lib/graphics/importer/vertex_array_model.cc
===================================================================
--- trunk/src/lib/graphics/importer/vertex_array_model.cc	(revision 6309)
+++ trunk/src/lib/graphics/importer/vertex_array_model.cc	(revision 6310)
@@ -64,5 +64,8 @@
   actcBeginInput(tc);
   for(unsigned int i = 0; i < model.getTriangleCount(); i++)
-      actcAddTriangle(tc, model.getTriangles()[i].indexToVertices[0], model.getTriangles()[i].indexToVertices[1], model.getTriangles()[i].indexToVertices[2]);
+      actcAddTriangle(tc,
+                      model.getTriangles()[i].indexToVertices[0],
+                      model.getTriangles()[i].indexToVertices[1],
+                      model.getTriangles()[i].indexToVertices[2]);
   actcEndInput(tc);
 
@@ -72,16 +75,22 @@
   for (unsigned int i = 0; i < model.getVertexCount(); i+=3)
     this->addVertex(model.getVertexArray()[i], model.getVertexArray()[i+1], model.getVertexArray()[i+2]);
+  for (unsigned int i = 0; i < model.getVertexCount(); i+=3)
+    this->addColor(model.getVertexArray()[i], model.getVertexArray()[i+1], model.getVertexArray()[i+2]);
   for (unsigned int i = 0; i < model.getNormalsCount(); i+=3)
     this->addNormal(model.getNormalsArray()[i], model.getNormalsArray()[i+1], model.getNormalsArray()[i+2]);
-  for (unsigned int i = 0; i < model.getTexCoordCount(); i+=2)
-    this->addTexCoor(model.getTexCoordArray()[i], model.getTexCoordArray()[i+1]);
+//   for (unsigned int i = 0; i < model.getTexCoordCount(); i+=2)
+//     this->addTexCoor(model.getTexCoordArray()[i], model.getTexCoordArray()[i+1]);
+  for (unsigned int i = 0; i < model.getVertexCount(); i+=3)
+    this->addTexCoor(1,2);
 
 
   int prim;
-  unsigned int v1, v2, v3;
+  uint v1, v2, v3;
 
   actcBeginOutput(tc);
   while((prim = actcStartNextPrim(tc, &v1, &v2) != ACTC_DATABASE_EMPTY))
   {
+    this->newStripe();
+
     this->addIndice(v1);
     this->addIndice(v2);
@@ -95,9 +104,9 @@
       printf("%d\n", v3);
     }
-    this->newStripe();
   }
   actcEndOutput(tc);
 
   this->finalize();
+  this->debug();
 }
 
@@ -129,23 +138,22 @@
 void VertexArrayModel::draw() const
 {
-  PRINTF(4)("drawing the 3D-VertexArrayModels\n");
-
-  glEnableClientState(GL_VERTEX_ARRAY |
-		      GL_TEXTURE_COORD_ARRAY |
-		      GL_NORMAL_ARRAY);
-  //  glEnableClientState(GL_INDEX_ARRAY);
-
-  glVertexPointer(3, GL_FLOAT, 0, this->vertices.getArray());
-  glNormalPointer(GL_FLOAT, 0, this->normals.getArray());
-  glTexCoordPointer(2, GL_FLOAT, 0, this->texCoords.getArray());
+  PRINTF(4)("drawing 3D-VertexArrayModel %s\n", this->getName());
+  glEnableClientState(GL_VERTEX_ARRAY );
+  glEnableClientState(GL_TEXTURE_COORD_ARRAY );
+  glEnableClientState(GL_NORMAL_ARRAY );
+  glEnableClientState(GL_COLOR_ARRAY );
+
+
+  glVertexPointer(3, GL_FLOAT, 0, &this->vertices[0]);
+  glNormalPointer(GL_FLOAT, 0, &this->normals[0]);
+  glTexCoordPointer(2, GL_FLOAT, 0, &this->texCoords[0]);
+  glColorPointer(3, GL_FLOAT, 0, &this->colors[0]);
 
   for (GLuint i = 1; i < this->stripes.size(); ++i)
     {
-      glDrawRangeElements(GL_TRIANGLE_STRIP,
-			  this->stripes[i-1],
-			  this->stripes[i],
-			  this->indices.getCount(),
-			  GL_UNSIGNED_BYTE,
-			  this->indices.getArray());
+      glDrawElements( GL_TRIANGLE_STRIP,
+                      this->stripes[i] - this->stripes[i-1],
+                      GL_UNSIGNED_INT,
+                      &this->indices[this->stripes[i-1]] );
     }
 }
@@ -160,5 +168,7 @@
 void VertexArrayModel::newStripe()
 {
-  this->stripes.push_back(this->vertices.getCount()-1);
+  // no stripes of size 0
+  if (this->stripes.empty() || this->indices.size() != this->stripes.back())
+    this->stripes.push_back(this->indices.size());
 }
 
@@ -172,5 +182,7 @@
 void VertexArrayModel::addVertex(float x, float y, float z)
 {
-  this->vertices.addEntry(x, y, z);
+  this->vertices.push_back(x);
+  this->vertices.push_back(y);
+  this->vertices.push_back(z);
   this->pModelInfo.numVertices++;
 }
@@ -187,5 +199,7 @@
 void VertexArrayModel::addNormal(float x, float y, float z)
 {
-  this->normals.addEntry(x, y, z);
+  this->normals.push_back(x);
+  this->normals.push_back(y);
+  this->normals.push_back(z);
   this->pModelInfo.numNormals++;
 }
@@ -193,5 +207,5 @@
 
 /**
- *  adds a Texture Coordinate
+ * @brief adds a Texture Coordinate
  * @param u The u coordinate of the TextureCoordinate.
  * @param v The y coordinate of the TextureCoordinate.
@@ -201,7 +215,21 @@
 void VertexArrayModel::addTexCoor(float u, float v)
 {
-  this->texCoords.addEntry(u);
-  this->texCoords.addEntry(v);
+  this->texCoords.push_back(u);
+  this->texCoords.push_back(v);
   this->pModelInfo.numTexCoor++;
+}
+
+/**
+ * @brief adds a new Color
+ * @param r the Red Component of the VertexColor to add.
+ * @param g the Green Component of the VertexColor to add.
+ * @param b the Blue of the VertexColor to add.
+ */
+void VertexArrayModel::addColor(float r, float g, float b)
+{
+  this->colors.push_back(r);
+  this->colors.push_back(g);
+  this->colors.push_back(b);
+  // FIXME
 }
 
@@ -212,7 +240,7 @@
  * @param type The information Passed with each Vertex
 */
-void VertexArrayModel::addIndice(GLubyte indice)
-{
-  this->indices.addEntry(indice);
+void VertexArrayModel::addIndice(GLuint indice)
+{
+  this->indices.push_back(indice);
 }
 
@@ -224,19 +252,8 @@
 {
   // finalize the Arrays
-  this->vertices.finalizeArray();
-  this->texCoords.finalizeArray();
-  this->normals.finalizeArray();
-  this->indices.finalizeArray();
-
   this->newStripe();
-
-  /*
-    glEnableClientState(GL_VERTEX_ARRAY |
-    GL_TEXTURE_COORD_ARRAY |
-    GL_NORMAL_ARRAY);
-  */
-
   this->bFinalized = true;
 }
+
 
 
@@ -246,25 +263,114 @@
 /////////////
 /**
- * @brief Includes a default model
- *
- * This will inject a Cube, because this is the most basic model.
- */
-void VertexArrayModel::planeModel()
-{
-  unsigned int i, j;
-  for (i = 0; i < 20; i++)
-    {
-      for (j = 0; j < 20; j++)
-	{
-	  this->addVertex(i* 50, .5, (j)*50);
-	  this->addNormal(0, 1, 0);
-	  this->addTexCoor((float)i/20.0, (float)j/20.0);
-
-	}
-    }
-  for (i = 0; i < 20; i++)
-    {
-      this->addIndice(i);
-      this->addIndice(i+20);
-    }
-}
+* @brief Includes a default model
+*
+* This will inject a Cube, because this is the most basic model.
+*/
+void VertexArrayModel::planeModel(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY)
+{
+  GLuint i, j;
+  for (i = 0; i < resolutionY; i++)
+    {
+      for (j = 0; j < resolutionX; j++)
+        {
+          this->addVertex((float)i - (float)sizeY/2.0, 0.0, (float)j - (float)sizeX/2.0);
+          this->addNormal(0.0, 1, 0.0);
+          this->addTexCoor((float)i/(float)resolutionY, (float)j/(float)resolutionY);
+          this->addColor((float)i/20.0, 0.0, (float)j/20.0);
+        }
+    }
+
+  for (i = 0; i < resolutionY-1; i++)
+  {
+    for (j = 0; j < resolutionX; j++)
+    {
+      this->addIndice( resolutionY*i + j );
+      this->addIndice( resolutionY*(i+1) + j );
+    }
+    this->newStripe();
+  }
+}
+
+#include <cmath>
+
+/**
+ * @brief builds a Triangle Stripped sphere
+ * @param radius: radius
+ * @param loops: the count of loops
+ * @param segmentsPerLoop how many Segments per loop
+ */
+void VertexArrayModel::spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop)
+{
+  for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+  {
+    float theta = 0;
+    float phi = loopSegmentNumber * 2 * PI / segmentsPerLoop;
+    float sinTheta = std::sin(theta);
+    float sinPhi = std::sin(phi);
+    float cosTheta = std::cos(theta);
+    float cosPhi = std::cos(phi);
+    this->addVertex(radius * cosPhi * sinTheta, radius * sinPhi * sinTheta, radius * cosTheta);
+    this->addNormal(radius * cosPhi * sinTheta, radius * sinPhi * sinTheta, radius * cosTheta);
+    this->addTexCoor(0,0); /// FIXME
+    this->addColor(.125,.436,.246); ///FIXME
+  }
+  for (unsigned int loopNumber = 0; loopNumber <= loops; ++loopNumber)
+  {
+    for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+    {
+      float theta = (loopNumber * PI / loops) + ((PI * loopSegmentNumber) / (segmentsPerLoop * loops));
+      if (loopNumber == loops)
+      {
+        theta = PI;
+      }
+      float phi = loopSegmentNumber * 2 * PI / segmentsPerLoop;
+      float sinTheta = std::sin(theta);
+      float sinPhi = std::sin(phi);
+      float cosTheta = std::cos(theta);
+      float cosPhi = std::cos(phi);
+      this->addVertex(radius * cosPhi * sinTheta, radius * sinPhi * sinTheta, radius * cosTheta);
+      this->addNormal(radius * cosPhi * sinTheta, radius * sinPhi * sinTheta, radius * cosTheta);
+      this->addTexCoor(0,0); //FIXME
+      this->addColor(.125,.436,.246);
+
+    }
+  }
+  for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+  {
+    this->addIndice(loopSegmentNumber);
+    this->addIndice(segmentsPerLoop + loopSegmentNumber);
+  }
+  for (unsigned int loopNumber = 0; loopNumber < loops; ++loopNumber)
+  {
+    for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+    {
+      this->addIndice( ((loopNumber + 1) * segmentsPerLoop) + loopSegmentNumber);
+      this->addIndice( ((loopNumber + 2) * segmentsPerLoop) + loopSegmentNumber);
+    }
+  }
+}
+
+
+/**
+ * @brief print out some nice debug information about this VertexArrayModel.
+ */
+void VertexArrayModel::debug() const
+{
+  PRINT(0)("VertexArrayModel (%s): debug\n", this->getName());
+  PRINT(0)("Stripes: %d; Indices: %d; Vertices: %d; Normals %d; TextCoords %d; Colors %d\n",
+            this->stripes.size(),
+            this->indices.size(),
+            this->vertices.size()/3,
+            this->normals.size()/3,
+            this->texCoords.size()/2,
+            this->colors.size() )/3;
+  for (GLuint i = 1; i < this->stripes.size(); ++i)
+  {
+    PRINT(0)("Stripe-%d (s:%d:e:%d):: ", i, this->stripes[i-1], this->stripes[i]);
+    for (GLuint j = this->stripes[i-1] ; j < this->stripes[i]; j++)
+    {
+      PRINT(0)("%d->", this->indices[j]);
+    }
+    PRINT(0)("\n");
+  }
+}
Index: trunk/src/lib/graphics/importer/vertex_array_model.h
===================================================================
--- trunk/src/lib/graphics/importer/vertex_array_model.h	(revision 6309)
+++ trunk/src/lib/graphics/importer/vertex_array_model.h	(revision 6310)
@@ -11,5 +11,4 @@
 #include "glincl.h"
 
-#include "array.h"
 #include <vector>
 
@@ -40,10 +39,15 @@
   void addNormal(float x, float y, float z);
   void addTexCoor(float u, float v);
-  void addIndice(GLubyte indice);
+  void addColor(float r, float g, float b);
+
+  void addIndice(GLuint indice);
 
   void finalize();
 
   //
-  void planeModel();
+  void planeModel(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY);
+  void spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop);
+
+  void debug() const;
 
  private:
@@ -53,9 +57,10 @@
   bool                       bFinalized;       //!< Sets the Object to be finalized.
 
-  tArray<GLfloat>            vertices;        //!< The Array that handles the Vertices.
-  tArray<GLfloat>            normals;         //!< The Array that handles the Normals.
-  tArray<GLfloat>            texCoords;       //!< The Array that handles the VertexTextureCoordinates.
+  std::vector<GLfloat>       vertices;        //!< The Array that handles the Vertices.
+  std::vector<GLfloat>       normals;         //!< The Array that handles the Normals.
+  std::vector<GLfloat>       texCoords;       //!< The Array that handles the VertexTextureCoordinates.
+  std::vector<GLfloat>       colors;          //!< The Array that handles Colors.
 
-  tArray<GLubyte>            indices;         //!< The Array that tells us what Vertex is connected to which other one.
+  std::vector<GLuint>        indices;         //!< The Array that tells us what Vertex is connected to which other one.
 
   std::vector<GLuint>        stripes;         //!< A lsit of Stripes of this Model.
