materials.h
Go to the documentation of this file.00001 #ifndef __UTIL__MATERIALS_HPP__
00002 #define __UTIL__MATERIALS_HPP__
00003
00009 #include <config.h>
00010 #include <string>
00011 #include <qgl.h>
00012 #include <util/watchdog.h>
00013
00014 namespace util {
00027 class Materials : public FileObject {
00028 public:
00030 struct Material {
00031 bool isDefault;
00032 GLfloat ambient[4];
00033 GLfloat diffuse[4];
00034 GLfloat emission[4];
00035 GLfloat specular[4];
00036 GLfloat shiny;
00037 GLfloat transparency;
00038 };
00039
00040 Materials(std::string filename);
00041
00042 void reread();
00043
00044 void useMaterial(unsigned int index);
00045 const Material& getMaterial(unsigned int index);
00046 void blend(unsigned int ind1, unsigned int ind2, float t);
00047
00048 const std::string& getFilename() const { return filename; }
00049
00050 private:
00051 Material mats[256];
00052 };
00053 }
00054
00055 #endif