Index: /orxonox/branches/images/importer/material.cc
===================================================================
--- /orxonox/branches/images/importer/material.cc	(revision 3084)
+++ /orxonox/branches/images/importer/material.cc	(revision 3085)
@@ -93,240 +93,4 @@
   
 }
-
-/**
-   \brief Set the Name of the Material. (Important for searching)
-   \param mtlName the Name of the Material to be set.
-*/ 
-void Material::setName (char* mtlName)
-{
-  //  if (verbose >= 3)
-    printf("setting Material Name to %s.\n", mtlName);
-  name = new char [strlen(mtlName)];
-  strcpy(name, mtlName);
-  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
-
-}
-/**
-   \returns The Name of The Material
-*/
-char* Material::getName (void)
-{
-  return name;
-}
-
-/**
-   \brief Sets the Material Illumination Model. 
-   \brief illu illumination Model in int form
-*/
-void Material::setIllum (int illum)
-{
-  if (verbose >= 3)
-    printf("setting illumModel of Material %s to %i", name, illum);
-  illumModel = illum;
-  //  printf ("setting illumModel to: %i\n", illumModel);
-}
-/**
-   \brief Sets the Material Illumination Model. 
-   \brief illu illumination Model in char* form
-*/void Material::setIllum (char* illum)
-{
-  setIllum (atoi(illum));
-}
-
-/**
-   \brief Sets the Material Diffuse Color.
-   \param r Red Color Channel.
-   \param g Green Color Channel.
-   \param b Blue Color Channel.
-*/
-void Material::setDiffuse (float r, float g, float b)
-{
-  if (verbose >= 3)
-    printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", name, r, g, b);
-  diffuse[0] = r;
-  diffuse[1] = g;
-  diffuse[2] = b;  
-  diffuse[3] = 1.0;
-
-}
-/**
-   \brief Sets the Material Diffuse Color.
-   \param rgb The red, green, blue channel in char format (with spaces between them)
-*/
-void Material::setDiffuse (char* rgb)
-{
-  char r[20],g[20],b[20];
-  sscanf (rgb, "%s %s %s", r, g, b);
-  setDiffuse (atof(r), atof(g), atof(b));
-}
-
-/**
-   \brief Sets the Material Ambient Color. 
-   \param r Red Color Channel.
-   \param g Green Color Channel.
-   \param b Blue Color Channel.
-*/
-void Material::setAmbient (float r, float g, float b)
-{
-  if (verbose >=3)
-    printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", name, r, g, b);
-  ambient[0] = r;
-  ambient[1] = g;
-  ambient[2] = b;
-  ambient[3] = 1.0;
-}
-/**
-   \brief Sets the Material Ambient Color.
-   \param rgb The red, green, blue channel in char format (with spaces between them)
-*/
-void Material::setAmbient (char* rgb)
-{
-  char r[20],g[20],b[20];
-  sscanf (rgb, "%s %s %s", r, g, b);
-  setAmbient (atof(r), atof(g), atof(b));
-}
-
-/**
-   \brief Sets the Material Specular Color. 
-   \param r Red Color Channel.
-   \param g Green Color Channel.
-   \param b Blue Color Channel.
-*/
-void Material::setSpecular (float r, float g, float b)
-{
-  if (verbose >= 3)
-    printf ("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", name, r, g, b);
-  specular[0] = r;
-  specular[1] = g;
-  specular[2] = b;
-  specular[3] = 1.0;
- }
-/**
-   \brief Sets the Material Specular Color.
-   \param rgb The red, green, blue channel in char format (with spaces between them)
-*/
-void Material::setSpecular (char* rgb)
-{
-  char r[20],g[20],b[20];
-  sscanf (rgb, "%s %s %s", r, g, b);
-  setSpecular (atof(r), atof(g), atof(b));
-}
-
-/**
-   \brief Sets the Material Shininess.
-   \param shini stes the Shininess from float.
-*/
-void Material::setShininess (float shini)
-{
-  shininess = shini;
-}
-/**
-   \brief Sets the Material Shininess.
-   \param shini stes the Shininess from char*.
-*/
-void Material::setShininess (char* shini)
-{
-  setShininess (atof(shini));
-}
-
-/**
-   \brief Sets the Material Transparency.
-   \param trans stes the Transparency from int.
-*/
-void Material::setTransparency (float trans)
-{
-  if (verbose >= 3)
-    printf ("setting Transparency of Material %s to %f.\n", name, trans);
-  transparency = trans;
-}
-/**
-   \brief Sets the Material Transparency.
-   \param trans stes the Transparency from char*.
-*/
-void Material::setTransparency (char* trans)
-{
-  char tr[20];
-  sscanf (trans, "%s", tr);
-  setTransparency (atof(tr));
-}
-
-// MAPPING //
-
-/**
-   \brief Sets the Materials Diffuse Map
-   \param dMap the Name of the Image to Use
-*/
-void Material::setDiffuseMap(char* dMap)
-{
-  if (verbose>=2)
-    printf ("setting Diffuse Map %s\n", dMap);
-
-  diffuseTextureSet = loadBMP(dMap, &diffuseTexture);
-
-}
-
-/**
-   \brief Sets the Materials Ambient Map
-   \param aMap the Name of the Image to Use
-*/
-void Material::setAmbientMap(char* aMap)
-{
-  SDL_Surface* ambientMap;
-
-}
-
-/**
-   \brief Sets the Materials Specular Map
-   \param sMap the Name of the Image to Use
-*/
-void Material::setSpecularMap(char* sMap)
-{
-  SDL_Surface* specularMap;
-
-}
-
-/**
-   \brief Sets the Materials Bumpiness
-   \param bump the Name of the Image to Use
-*/
-void Material::setBump(char* bump)
-{
-
-}
-
-/**
-   \brief reads in a Windows BMP-file, and imports it to openGL.
-   \param bmpName The name of the Image to load.
-   \param texture A pointer to the Texture which should be read to.
-*/
-bool Material::loadBMP (char* bmpName, GLuint* texture)
-{
-  SDL_Surface* map;
-  if (map = SDL_LoadBMP(bmpName))
-    {
-
-      glGenTextures( 1, texture );
-      /* Typical Texture Generation Using Data From The Bitmap */
-      glBindTexture( GL_TEXTURE_2D, *texture );
-      
-      /* Generate The Texture */
-      glTexImage2D( GL_TEXTURE_2D, 0, 3, map->w,
-		    map->h, 0, GL_BGR,
-		    GL_UNSIGNED_BYTE, map->pixels );
-      
-      /* Linear Filtering */
-      glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
-      glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-      if ( map )
-	SDL_FreeSurface( map );
-
-      return true;
-    }
-  else
-    return false;
-}
-
-
-
 
 /**
@@ -385,2 +149,240 @@
   
 }
+
+
+/**
+   \brief Set the Name of the Material. (Important for searching)
+   \param mtlName the Name of the Material to be set.
+*/ 
+void Material::setName (char* mtlName)
+{
+  //  if (verbose >= 3)
+    printf("setting Material Name to %s.\n", mtlName);
+  name = new char [strlen(mtlName)];
+  strcpy(name, mtlName);
+  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
+
+}
+/**
+   \returns The Name of The Material
+*/
+char* Material::getName (void)
+{
+  return name;
+}
+
+/**
+   \brief Sets the Material Illumination Model. 
+   \brief illu illumination Model in int form
+*/
+void Material::setIllum (int illum)
+{
+  if (verbose >= 3)
+    printf("setting illumModel of Material %s to %i", name, illum);
+  illumModel = illum;
+  //  printf ("setting illumModel to: %i\n", illumModel);
+}
+/**
+   \brief Sets the Material Illumination Model. 
+   \brief illu illumination Model in char* form
+*/void Material::setIllum (char* illum)
+{
+  setIllum (atoi(illum));
+}
+
+/**
+   \brief Sets the Material Diffuse Color.
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setDiffuse (float r, float g, float b)
+{
+  if (verbose >= 3)
+    printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", name, r, g, b);
+  diffuse[0] = r;
+  diffuse[1] = g;
+  diffuse[2] = b;  
+  diffuse[3] = 1.0;
+
+}
+/**
+   \brief Sets the Material Diffuse Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setDiffuse (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setDiffuse (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Ambient Color. 
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setAmbient (float r, float g, float b)
+{
+  if (verbose >=3)
+    printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", name, r, g, b);
+  ambient[0] = r;
+  ambient[1] = g;
+  ambient[2] = b;
+  ambient[3] = 1.0;
+}
+/**
+   \brief Sets the Material Ambient Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setAmbient (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setAmbient (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Specular Color. 
+   \param r Red Color Channel.
+   \param g Green Color Channel.
+   \param b Blue Color Channel.
+*/
+void Material::setSpecular (float r, float g, float b)
+{
+  if (verbose >= 3)
+    printf ("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", name, r, g, b);
+  specular[0] = r;
+  specular[1] = g;
+  specular[2] = b;
+  specular[3] = 1.0;
+ }
+/**
+   \brief Sets the Material Specular Color.
+   \param rgb The red, green, blue channel in char format (with spaces between them)
+*/
+void Material::setSpecular (char* rgb)
+{
+  char r[20],g[20],b[20];
+  sscanf (rgb, "%s %s %s", r, g, b);
+  setSpecular (atof(r), atof(g), atof(b));
+}
+
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from float.
+*/
+void Material::setShininess (float shini)
+{
+  shininess = shini;
+}
+/**
+   \brief Sets the Material Shininess.
+   \param shini stes the Shininess from char*.
+*/
+void Material::setShininess (char* shini)
+{
+  setShininess (atof(shini));
+}
+
+/**
+   \brief Sets the Material Transparency.
+   \param trans stes the Transparency from int.
+*/
+void Material::setTransparency (float trans)
+{
+  if (verbose >= 3)
+    printf ("setting Transparency of Material %s to %f.\n", name, trans);
+  transparency = trans;
+}
+/**
+   \brief Sets the Material Transparency.
+   \param trans stes the Transparency from char*.
+*/
+void Material::setTransparency (char* trans)
+{
+  char tr[20];
+  sscanf (trans, "%s", tr);
+  setTransparency (atof(tr));
+}
+
+// MAPPING //
+
+/**
+   \brief Sets the Materials Diffuse Map
+   \param dMap the Name of the Image to Use
+*/
+void Material::setDiffuseMap(char* dMap)
+{
+  if (verbose>=2)
+    printf ("setting Diffuse Map %s\n", dMap);
+
+  diffuseTextureSet = loadBMP(dMap, &diffuseTexture);
+
+}
+
+/**
+   \brief Sets the Materials Ambient Map
+   \param aMap the Name of the Image to Use
+*/
+void Material::setAmbientMap(char* aMap)
+{
+  SDL_Surface* ambientMap;
+
+}
+
+/**
+   \brief Sets the Materials Specular Map
+   \param sMap the Name of the Image to Use
+*/
+void Material::setSpecularMap(char* sMap)
+{
+  SDL_Surface* specularMap;
+
+}
+
+/**
+   \brief Sets the Materials Bumpiness
+   \param bump the Name of the Image to Use
+*/
+void Material::setBump(char* bump)
+{
+
+}
+
+/**
+   \brief reads in a Windows BMP-file, and imports it to openGL.
+   \param bmpName The name of the Image to load.
+   \param texture A pointer to the Texture which should be read to.
+*/
+bool Material::loadBMP (char* bmpName, GLuint* texture)
+{
+  SDL_Surface* map;
+  if (map = SDL_LoadBMP(bmpName))
+    {
+
+      glGenTextures( 1, texture );
+      /* Typical Texture Generation Using Data From The Bitmap */
+      glBindTexture( GL_TEXTURE_2D, *texture );
+      
+      /* Generate The Texture */
+      glTexImage2D( GL_TEXTURE_2D, 0, 3, map->w,
+		    map->h, 0, GL_BGR,
+		    GL_UNSIGNED_BYTE, map->pixels );
+      
+      /* Linear Filtering */
+      glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+      glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+      if ( map )
+	SDL_FreeSurface( map );
+
+      return true;
+    }
+  else
+    return false;
+}
+
+
+
+
Index: /orxonox/branches/images/importer/material.h
===================================================================
--- /orxonox/branches/images/importer/material.h	(revision 3084)
+++ /orxonox/branches/images/importer/material.h	(revision 3085)
@@ -15,4 +15,7 @@
 #include <fstream>
 
+// IMAGE LIBS //
+#include <jpeglib.h>
+
 //! Class to handle Materials.
 class Material
@@ -22,7 +25,9 @@
   Material (char* mtlName);
   Material* addMaterial(char* mtlName);
+  ~Material ();
+  void init(void);
 
-  void init(void);
-  ~Material ();
+  Material* search (char* mtlName);
+  bool select (void);
 
   GLuint diffuseTexture;
@@ -49,4 +54,7 @@
   void setTransparency (char* trans);
 
+
+
+
   // MAPPING //
   void setDiffuseMap(char* dMap);
@@ -55,12 +63,6 @@
   void setBump(char* bump);
 
+  // TEXTURING
   bool loadBMP (char* bmpName, GLuint* texture);
-
-
-  Material* search (char* mtlName);
-
-  bool select (void);
-
-  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
 
  private:
@@ -72,4 +74,5 @@
   float shininess;
   float transparency;
+  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
 
 };
