Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3096 was 3096, checked in by bensch, 19 years ago

orxonox/branches/images: compressed TGA work to

File size: 2.2 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    GLuint width;
64    GLuint height;
65    GLuint bpp;
66    GLuint type;
67    GLubyte *data;
68  };
69
70
71  char* name;
72  int illumModel;
73  float diffuse [4];
74  float ambient [4];
75  float specular [4];
76  float shininess;
77  float transparency;
78
79  GLuint diffuseTexture;
80  GLuint ambientTexture;
81  GLuint specularTexture;
82 
83  bool diffuseTextureSet;
84  bool ambientTextureSet;
85  bool specularTextureSet;
86
87  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
88
89  // TEXTURING
90  bool loadTexToGL (Image* pImage, GLuint* texture);
91
92  bool loadImage(char* imageName, GLuint* texture);
93
94  bool loadBMP (char* bmpName, GLuint* texture);
95
96  bool loadJPG (char* jpgName, GLuint* texture);
97
98  /// TGA ///
99
100  bool loadTGA(const char * tgaName, GLuint* texture);
101  bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
102  bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
103
104};
105#endif
Note: See TracBrowser for help on using the repository browser.