Index: /branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.cc	(revision 8356)
+++ /branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.cc	(revision 8357)
@@ -19,3 +19,23 @@
 
 
-using namespace std;
+namespace md3
+{
+
+
+  /**
+   * create a MD3BoneFrame object with the data coming from the specified input stream
+   */
+  MD3BoneFrame::MD3BoneFrame(int tagNum /*, DataInput din*/)
+  { /* loadBoneFrame(this, din) */ }
+
+
+  MD3BoneFrame::MD3BoneFrame(/*int tagNum*/)
+  { /* this->tags = new MD3Tag[tagNum] */ }
+
+
+  MD3BoneFrame::~MD3BoneFrame()
+  {}
+
+
+
+};
Index: /branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.h
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.h	(revision 8356)
+++ /branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.h	(revision 8357)
@@ -13,7 +13,8 @@
 #include <string>
 
+namespace md3
+{
 
 class MD3Tag;
-
 
 class MD3BoneFrame
@@ -21,6 +22,6 @@
   public:
     /** create a MD3BoneFrame object with the data coming from the specified input stream */
-    MD3BoneFrame(int tagNum /*, DataInput din*/) { /* loadBoneFrame(this, din) */ }
-    MD3BoneFrame(/*int tagNum*/) { /* this->tags = new MD3Tag[tagNum] */ }
+    MD3BoneFrame(int tagNum /*, DataInput din*/);
+    MD3BoneFrame(/*int tagNum*/);
     virtual ~MD3BoneFrame();
 
@@ -39,4 +40,5 @@
 };
 
+}
 
 #endif /* _MD3_ANIMATION_H */
Index: /branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc	(revision 8356)
+++ /branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc	(revision 8357)
@@ -17,4 +17,6 @@
 #include "md3_data.h"
 
+#include "md3_bone_frame.h"
+
 
 namespace md3
@@ -30,21 +32,5 @@
 MD3Data::MD3Data(const std::string& modelFileName, const std::string& skinFileName, float scale)
 {
-  scale *= 0.1f;
-
-  this->pVertices = NULL;
-  this->pGLCommands = NULL;
-  this->pLightNormals = NULL;
-  this->pTexCoor = NULL;
-
-  this->numFrames = 0;
-  this->numVertices = 0;
-  this->numGLCommands = 0;
-  this->numTexCoor = 0;
-
-//   this->scaleFactor = 1.0f;
-  this->scaleFactor = scale;
-
-  this->fileName = "";
-  this->skinFileName = "";
+
 
 
@@ -62,9 +48,4 @@
 {
   delete this->header;
-
-  delete [] this->pVertices;
-  delete [] this->pGLCommands;
-  delete [] this->pLightNormals;
-  delete [] this->pTexCoor;
 }
 
@@ -95,7 +76,5 @@
       return false;
     }
-  this->header = new MD3Header;
-  fread(this->header, 1, sizeof(MD3Header), pFile);
-  fileOffset += sizeof(MD3Header);
+  fileOffset += this->readHeader(pFile, fileOffset);
   /* check for the header version: make sure its a md2 file :) */
   if( unlikely(this->header->version != MD3_VERSION) && unlikely(this->header->ident != MD3_IDENT))
@@ -104,18 +83,4 @@
       return false;
     }
-
-    //header debug:
-    PRINTF(0)("MD3 Header debug section======================================\n");
-    printf("ident: %i\n", this->header->ident);
-    printf("version: %i\n", this->header->version);
-    printf("filename: %s\n", this->header->filename);
-    printf("boneFrameNum: %i\n", this->header->boneFrameNum);
-    printf("tag number: %i\n", this->header->tagNum);
-    printf("mesh number: %i\n", this->header->meshNum);
-    printf("max tex num: %i\n", this->header->maxTexNum);
-    printf("bone frame start: %i\n", this->header->boneFrameStart);
-    printf("tag start: %i\n", this->header->tagStart);
-    printf("mesh start: %i\n", this->header->meshStart);
-    printf("fileSize: %i\n", this->header->fileSize);
 
 
@@ -132,4 +97,5 @@
       while( !(bBoneFrames && bTags && bMeshes))
       {
+        printf("while\n");
         if( fileOffset == this->header->boneFrameStart && !bBoneFrames)
         {
@@ -217,16 +183,16 @@
 bool MD3Data::loadSkin(const std::string& fileName)
 {
-  if( fileName.empty())
-    {
-      this->skinFileName = "";
-      return false;
-    }
-
-  this->skinFileName = fileName;
-
-  this->material.setName("md2ModelMaterial");
-  this->material.setDiffuseMap(fileName);
-  this->material.setIllum(3);
-  this->material.setAmbient(1.0, 1.0, 1.0);
+//   if( fileName.empty())
+//     {
+//       this->skinFileName = "";
+//       return false;
+//     }
+//
+//   this->skinFileName = fileName;
+//
+//   this->material.setName("md2ModelMaterial");
+//   this->material.setDiffuseMap(fileName);
+//   this->material.setIllum(3);
+//   this->material.setAmbient(1.0, 1.0, 1.0);
 
   return true;
@@ -239,4 +205,36 @@
 int MD3Data::readHeader(FILE* pFile, int fileOffset)
 {
+  this->header = new MD3Header;
+  fread(this->header, 1, sizeof(MD3Header), pFile);
+
+    //header debug:
+  PRINTF(0)("MD3 Header debug section======================================\n");
+  printf("ident: %i\n", this->header->ident);
+  printf("version: %i\n", this->header->version);
+  printf("filename: %s\n", this->header->filename);
+  printf("boneFrameNum: %i\n", this->header->boneFrameNum);
+  printf("tag number: %i\n", this->header->tagNum);
+  printf("mesh number: %i\n", this->header->meshNum);
+  printf("max tex num: %i\n", this->header->maxTexNum);
+  printf("bone frame start: %i\n", this->header->boneFrameStart);
+  printf("tag start: %i\n", this->header->tagStart);
+  printf("mesh start: %i\n", this->header->meshStart);
+  printf("fileSize: %i\n", this->header->fileSize);
+
+
+  return sizeof(MD3Header);
+}
+
+
+/**
+ * read bone frames
+ */
+int MD3Data::readBoneFrames(FILE* pFile, int fileOffset)
+{
+  this->boneFrames = new MD3BoneFrame*[this->header->boneFrameNum];
+
+  for( int i = 0; i < this->header->boneFrameNum; i++)
+    this->boneFrames[i] = new MD3BoneFrame(i);
+
   return 0;
 }
@@ -244,7 +242,7 @@
 
 /**
- * read bone frames
- */
-int MD3Data::readBoneFrames(FILE* pFile, int fileOffset)
+ * read the tags
+ */
+int MD3Data::readTags(FILE* pFile, int fileOffset)
 {
   return 0;
@@ -253,20 +251,11 @@
 
 /**
- * read the tags
- */
-int MD3Data::readTags(FILE* pFile, int fileOffset)
+ * read meshes
+ */
+int MD3Data::readMeshes(FILE* pFile, int fileOffset)
 {
   return 0;
 }
 
-
-/**
- * read meshes
- */
-int MD3Data::readMeshes(FILE* pFile, int fileOffset)
-{
-  return 0;
-}
-
-}
-
+}
+
Index: /branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h	(revision 8356)
+++ /branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h	(revision 8357)
@@ -46,4 +46,7 @@
 {
 
+  class MD3BoneFrame;
+  class MD3Mesh;
+
 //! This holds the header information that is read in at the beginning of the file: id software definition
 struct MD3Header
@@ -87,21 +90,31 @@
 
  public:
-  int                numFrames;             //!< number of frames
-  int                numVertices;           //!< number of vertices
-  int                numTriangles;          //!< number of triangles
-  int                numTexCoor;            //!< number of texture coordinates
-  int                numGLCommands;         //!< number of gl commands in the glList (tells how to draw)
-  std::string        fileName;              //!< file name of the model File
-  std::string        skinFileName;          //!< file name of the skin file
-  MD3Header*         header;                //!< the header file
 
-  sVec3D*            pVertices;             //!< pointer to the vertices data block
-  sTriangle*         pTriangles;            //!< pointer to the triangles data
-  sTexCoor*          pTexCoor;              //!< pointer to the texture coordinate data
-  int*               pGLCommands;           //!< pointer to the gllist data block
-  int*               pLightNormals;         //!< pointer to the light normals
+  MD3Header*          header;            //!< the header file
 
-  Material           material;              //!< pointer to the material
-  float              scaleFactor;           //!< the scale factor of the model, (global)
+  std::string         filename;          //!< the name of the file as recorded in the .md3 file
+  std::string         loadFilename;      //!< filename of the actual file from which data was loaded
+
+  int                 boneFrameNum;      //!< number of anumation key fames in the models
+  int                 tagNum;            //!< number of tags
+  int                 meshNum;           //!< number of meshes
+
+  int                 maxTextureNum;     //!< maximum number of unique used in an md3 file
+  int                 boneFrameStart;    //!< starting position of bone frame data structures
+  int                 tagStart;          //!< starting position of tag-structures
+
+  int                 meshStart;         //!< starting position of mesh structures
+
+  int                 fileSize;          //!< file size
+
+
+  MD3BoneFrame**      boneFrames;        //!< array of bone frames, contains the metadata (bounding box, tags,...) for each frame
+  MD3Mesh*            meshes;            //!< array of meshes in the model. each containing the mesh for each of the animation
+
+  int                 parentTagIndex;    //!< tag index
+
+  //MD3Model*           parent;            //!< reference to the MD3Model
+
+
 };
 
Index: /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8356)
+++ /branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8357)
@@ -16,7 +16,6 @@
 {
 
-  class MD3BoneFrame;
-  class MD3Mesh;
-  class MD3Data;
+
+class MD3Data;
 
 class MD3Model : public Model
@@ -28,30 +27,8 @@
 
 
-
   private:
     MD3Data*            md3Data;           //!< reference to the md3 model data
+};
 
-    std::string         filename;          //!< the name of the file as recorded in the .md3 file
-    std::string         loadFilename;      //!< filename of the actual file from which data was loaded
-
-    int                 boneFrameNum;      //!< number of anumation key fames in the models
-    int                 tagNum;            //!< number of tags
-    int                 meshNum;           //!< number of meshes
-
-    int                 maxTextureNum;     //!< maximum number of unique used in an md3 file
-    int                 boneFrameStart;    //!< starting position of bone frame data structures
-    int                 tagStart;          //!< starting position of tag-structures
-
-    int                 meshStart;         //!< starting position of mesh structures
-
-    int                 fileSize;          //!< file size
-
-
-    MD3BoneFrame*       boneFrames;        //!< array of bone frames, contains the metadata (bounding box, tags,...) for each frame
-    MD3Mesh*            meshes;            //!< array of meshes in the model. each containing the mesh for each of the animation
-
-    int                 parentTagIndex;    //!< tag index
-    MD3Model*           parent;            //!< reference to the MD3Model
-};
 }
 
