/*! \file material.h \brief Contains the Material Class that handles Material for 3D-Objects. */ #ifndef _MATERIAL_H #define _MATERIAL_H extern int verbose; //!< will be obsolete soon. #include "stdincl.h" #if HAVE_CONFIG_H #include #endif /* HAVE_CONFIG_H */ #ifdef HAVE_SDL_SDL_IMAGE_H #include #else // IMAGE LIBS // #ifdef HAVE_JPEGLIB_H extern "C"{ // This has to be done, because not a c++ lib #include } #endif /* HAVE_JPEGLIB_H */ #ifdef HAVE_PNG_H #include #endif /* HAVE_PNG_H */ #endif /* HAVE_SDL_SDL_IMAGE_H */ class PathList { public: PathList(); PathList(char* pName); ~PathList(); void addPath (char* pName); char* pathName; PathList* next; }; //! Class to handle Materials. class Material { public: Material (); Material (char* mtlName); Material* addMaterial(char* mtlName); ~Material (); void init(void); Material* search (char* mtlName); bool select (void); void setName (char* mtlName); char* getName (void); void setIllum (int illum); void setIllum (char* illum); void setDiffuse (float r, float g, float b); void setDiffuse (char* rgb); void setAmbient (float r, float g, float b); void setAmbient (char* rgb); void setSpecular (float r, float g, float b); void setSpecular (char* rgb); void setShininess (float shini); void setShininess (char* shini); void setTransparency (float trans); void setTransparency (char* trans); void addTexturePath(char* pathName); char* searchTextureInPaths(char* texName) const; // MAPPING // void setDiffuseMap(char* dMap); void setAmbientMap(char* aMap); void setSpecularMap(char* sMap); void setBump(char* bump); private: struct Image { int rowSpan; GLuint width; GLuint height; GLuint bpp; GLuint type; GLubyte *data; }; char* name; int illumModel; float diffuse [4]; float ambient [4]; float specular [4]; float shininess; float transparency; static PathList* pathList; GLuint diffuseTexture; GLuint ambientTexture; GLuint specularTexture; bool diffuseTextureSet; bool ambientTextureSet; bool specularTextureSet; Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists. // TEXTURING bool loadTexToGL (Image* pImage, GLuint* texture); bool loadImage(char* imageName, GLuint* texture); #ifndef HAVE_SDL_SDL_IMAGE_H bool loadBMP (char* bmpName, GLuint* texture); bool loadJPG (char* jpgName, GLuint* texture); /// TGA /// bool loadTGA(const char * tgaName, GLuint* texture); bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture); bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture); bool loadPNG(const char* pngName, GLuint* texture); #endif }; #endif