00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GLMATERIAL_H
00019 #define GLMATERIAL_H
00020
00021 #include <GL/gl.h>
00022 #include <fstream>
00023 #include "glscene.h"
00024
00031 namespace GLScene
00032 {
00033
00034 class GLMaterial: public GLRenderState
00035 {
00036
00037 protected:
00038 GLfloat specular[4];
00039 GLfloat emission[4];
00040 GLfloat diffuse[4];
00041 GLfloat ambient[4];
00042 GLfloat shininess;
00043 GLenum face;
00044
00045 public:
00046 SML_TAG(material);
00047
00048
00049
00050
00051
00052 GLMaterial();
00053 virtual ~GLMaterial();
00054 void setSpecular(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00055 void setEmission(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00056 void setDiffuse(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00057 void setAmbient(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
00058 void setShininess(GLfloat s);
00059 void setFace(GLenum f);
00060
00061 inline const GLfloat* getSpecular() { return specular; }
00062 inline const GLfloat* getDiffuse() { return diffuse; }
00063 inline const GLfloat* getEmission() { return emission; }
00064 inline const GLfloat* getAmbient() { return ambient; }
00065 inline GLfloat getShininess() { return shininess; }
00066 inline GLenum getFace() { return face; }
00067
00068 virtual void use();
00069
00070 virtual void render();
00071
00072
00073
00074
00075
00076
00077
00078 };
00079
00080 };
00081
00082 #endif