Index: /orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
===================================================================
--- /orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc	(revision 4226)
+++ /orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc	(revision 4227)
@@ -532,5 +532,5 @@
 {
   FILE *pFile;                            //file stream
-  tMd2Header header;
+  //tMd2Header header;
   char* buffer;                           //buffer for frame data
   sFrame* frame;                          //temp frame
@@ -544,5 +544,5 @@
       return false;
     }
-  fread(&header, 1, sizeof(tMd2Header), pFile);
+  fread(header, 1, sizeof(tMd2Header), pFile);
   /* check for the header version: make sure its a md2 file :) */
   if( unlikely(header.version != MD2_VERSION) && unlikely(header.ident != MD2_IDENT))
@@ -553,19 +553,19 @@
 
   /* got the data: map it to locals */
-  this->numFrames = header.numFrames;
-  this->numVertices = header.numVertices;
-  this->numTriangles = header.numTriangles;
-  this->numGLCommands = header.numGlCommands;
+  this->numFrames = this->header->numFrames;
+  this->numVertices = this->header->numVertices;
+  this->numTriangles = this->header->numTriangles;
+  this->numGLCommands = this->header->numGlCommands;
   /* allocate memory for the data storage */
   this->pVertices = new sVec3D[this->numVertices * this->numFrames];
   this->pGLCommands = new int[this->numGLCommands];
   this->pLightNormals = new int[this->numVertices * this->numFrames];
-  buffer = new char[this->numFrames * header.frameSize];
+  buffer = new char[this->numFrames * this->header->frameSize];
 
   /* read frame data from the file to a temp buffer */
-  fseek(pFile, header.offsetFrames, SEEK_SET);
-  fread(buffer, header.frameSize, this->numFrames, pFile);
+  fseek(pFile, this->header->offsetFrames, SEEK_SET);
+  fread(buffer, this->header->frameSize, this->numFrames, pFile);
   /* read opengl commands */
-  fseek(pFile, header.offsetGlCommands, SEEK_SET);
+  fseek(pFile, this->header->offsetGlCommands, SEEK_SET);
   fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile);
 
@@ -574,9 +574,9 @@
       /*
       faster but evt. buggy
-      frame = (sFrame*)(buffer + header.frameSize * i); 
+      frame = (sFrame*)(buffer + this->header->frameSize * i); 
       pVertex = this->pVertices + this->numVertices  * i;
       pNormals = this->pLightNormals + this->numVertices * i;
       */
-      frame = (sFrame *)&buffer[header.frameSize * i];
+      frame = (sFrame *)&buffer[this->header->frameSize * i];
       pVertex = &this->pVertices[this->numVertices * i];
       pNormals = &this->pLightNormals[this->numVertices * i];
@@ -645,5 +645,5 @@
 
 	//printf("  pVertices %f, %f, %f\n", pVertices[i][0], pVertices[i][1], pVertices[i][2]);
-	//printf("  list:     %f, %f, %f \n", verticesList[i][0], verticesList[i][1], verticesList[i][2]);      
+	printf("  list:     %f, %f, %f \n", verticesList[i][0], verticesList[i][1], verticesList[i][2]);      
       }
 }
@@ -792,2 +792,34 @@
 }
 
+
+void MD2Model2::debug()
+{
+  PRINT(0)("==========================| MD2Model2::debug() |===");
+  PRINT(0)("= Model Name: %s", this->);
+  PRINT(0)(" Position:      %f/%f/%f\n", this->lightPosition[0], this->lightPosition[1], this->lightPosition[2]);
+  PRINT(0)(" DiffuseColor:  %f/%f/%f\n", this->diffuseColor[0], this->diffuseColor[1], this->diffuseColor[2]);
+  PRINT(0)(" SpecularColor: %f/%f/%f\n", this->specularColor[0], this->specularColor[1], this->specularColor[2]);
+  PRINT(0)(" Attenuation: constant=%f linear=%f quadratic=%f\n", this->constantAttenuation, this->linearAttenuation, this->quadraticAttenuation);
+}
+
+
+  int ident;			        //!< This is used to identify the file
+   int version;			        //!< The version number of the file (Must be 8)
+    
+   int skinWidth;			//!< The skin width in pixels
+   int skinHeight;			//!< The skin height in pixels
+   int frameSize;			//!< The size in bytes the frames are
+   
+   int numSkins;		        //!< The number of skins associated with the model
+   int numVertices;			//!< The number of vertices (constant for each frame)
+   int numTexCoords;			//!< The number of texture coordinates
+   int numTriangles;			//!< The number of faces (polygons)
+   int numGlCommands;			//!< The number of gl commands
+   int numFrames;			//!< The number of animation frames
+   
+   int offsetSkins;			//!< The offset in the file for the skin data
+   int offsetTexCoords;			//!< The offset in the file for the texture data
+   int offsetTriangles;			//!< The offset in the file for the face data
+   int offsetFrames;			//!< The offset in the file for the frames data
+   int offsetGlCommands;		//!< The offset in the file for the gl commands data
+   int offsetEnd;			//!< The end of the file offset
Index: /orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h
===================================================================
--- /orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h	(revision 4226)
+++ /orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h	(revision 4227)
@@ -174,55 +174,4 @@
 
 
-
-//! This is a MD2 Model class
-class MD2Model2 : public AbstractModel {
-
-public:
-  MD2Model2();
-  virtual ~MD2Model2();
-  
-  bool loadModel(const char* filename);
-  bool loadSkin(const char* filename);
-  
-  void drawFrame(int frame);
-  void draw();
-  void draw2();
-  
-  void setAnim(int type);
-  void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
-
-  void tick(float dtS);
-
-
-private:
-  void animate();  
-  void processLighting();
-  void interpolate(sVec3D* verticesList);
-  void renderFrame();
-
- public:
-  /* these variables are static, because they are all the same for every model */
-  static sVec3D anorms[NUM_VERTEX_NORMALS];
-  static float anormsDots[SHADEDOT_QUANT][256];
-  static sAnim animationList[21];
-
- private:
-  int numFrames;
-  int numVertices;
-  int numTriangles;
-  int numGLCommands;
-
-  sVec3D* pVertices;
-  int* pGLCommands;
-  int* pLightNormals;
-
-  unsigned int textureID;
-  Material* material;
-  sAnimState animationState;
-  float scaleFactor;
-  //tMd2Header* header;
-};
-
-
 //! A class that handles all of the loading code
 class MD2Loader : public BaseObject {
@@ -250,3 +199,57 @@
 
 
+//! This is a MD2 Model class
+class MD2Model2 : public AbstractModel {
+
+public:
+  MD2Model2();
+  virtual ~MD2Model2();
+  
+  bool loadModel(const char* filename);
+  bool loadSkin(const char* filename);
+  
+  void drawFrame(int frame);
+  void draw();
+  void draw2();
+  
+  void setAnim(int type);
+  void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
+
+  void tick(float dtS);
+  void debug();
+
+
+private:
+  void animate();  
+  void processLighting();
+  void interpolate(sVec3D* verticesList);
+  void renderFrame();
+
+ public:
+  /* these variables are static, because they are all the same for every model */
+  static sVec3D anorms[NUM_VERTEX_NORMALS];
+  static float anormsDots[SHADEDOT_QUANT][256];
+  static sAnim animationList[21];
+
+ private:
+  int numFrames;
+  int numVertices;
+  int numTriangles;
+  int numGLCommands;
+
+  sVec3D* pVertices;
+  int* pGLCommands;
+  int* pLightNormals;
+
+  unsigned int textureID;
+  Material* material;
+  sAnimState animationState;
+  float scaleFactor;
+  tMd2Header* header;
+};
+
+
+
+
+
 #endif /* _MD2MODEL_H */
