Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/images/importer/material.h @ 3093

Last change on this file since 3093 was 3093, checked in by bensch, 20 years ago

orxonox/branches/images: moved things to where they belong

File size: 2.0 KB
Line 
1/*!
2  \file material.h
3  \brief Contains the Material Class that handles Material for 3D-Objects.
4*/
5
6#ifndef _MATERIAL_H
7#define _MATERIAL_H
8
9extern int verbose; //!< will be obsolete soon.
10
11#include <GL/gl.h>
12#include <GL/glu.h>
13#include <SDL/SDL.h>
14#include <stdlib.h>
15#include <fstream>
16
17// IMAGE LIBS //
18extern "C"{         // This has to be done, because not a c++ lib
19#include <jpeglib.h>
20}
21//! Class to handle Materials.
22class Material
23{
24 public:
25  Material ();
26  Material (char* mtlName);
27  Material* addMaterial(char* mtlName);
28  ~Material ();
29  void init(void);
30
31  Material* search (char* mtlName);
32  bool select (void);
33
34  void setName (char* mtlName);
35  char* getName (void);
36  void setIllum (int illum);
37  void setIllum (char* illum);
38  void setDiffuse (float r, float g, float b);
39  void setDiffuse (char* rgb);
40  void setAmbient (float r, float g, float b);
41  void setAmbient (char* rgb);
42  void setSpecular (float r, float g, float b);
43  void setSpecular (char* rgb);
44  void setShininess (float shini);
45  void setShininess (char* shini);
46  void setTransparency (float trans);
47  void setTransparency (char* trans);
48
49
50
51
52  // MAPPING //
53  void setDiffuseMap(char* dMap);
54  void setAmbientMap(char* aMap);
55  void setSpecularMap(char* sMap);
56  void setBump(char* bump);
57
58
59 private:
60  struct Image
61  {
62    int rowSpan;
63    unsigned long sizeX;
64    unsigned long sizeY;
65    GLubyte *data;
66  };
67
68
69  char* name;
70  int illumModel;
71  float diffuse [4];
72  float ambient [4];
73  float specular [4];
74  float shininess;
75  float transparency;
76
77  GLuint diffuseTexture;
78  GLuint ambientTexture;
79  GLuint specularTexture;
80 
81  bool diffuseTextureSet;
82  bool ambientTextureSet;
83  bool specularTextureSet;
84
85  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
86
87  // TEXTURING
88  bool loadImage(char* imageName, GLuint* texture);
89
90  bool loadBMP (char* bmpName, GLuint* texture);
91
92  bool loadJPG (char* jpgName, GLuint* texture);
93  void decodeJPG(jpeg_decompress_struct* cinfo, Image *pImageData);
94
95  bool loadTexToGL (Image* pImage, GLuint* texture);
96};
97#endif
Note: See TracBrowser for help on using the repository browser.