Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/branches/images: libPNG included, and also a routine to read it, but this one is not the best i Could find.

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