Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/branches/images: test for jpeg and png libs in configure.ac and material.cc/h

File size: 2.6 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
[3103]17#if HAVE_CONFIG_H
18#include <config.h> 
[3110]19#endif /* HAVE_CONFIG_H */
[3103]20
21#ifdef HAVE_SDL_SDL_IMAGE_H
22#include <SDL/SDL_image.h>
[3104]23#else
[3085]24// IMAGE LIBS //
[3110]25#ifdef HAVE_JPEGLIB_H
[3086]26extern "C"{         // This has to be done, because not a c++ lib
[3085]27#include <jpeglib.h>
[3086]28}
[3110]29#endif /* HAVE_JPEGLIB_H */
30#ifdef HAVE_PNG_H
[3098]31#include <png.h>
[3110]32#endif /* HAVE_PNG_H */
33#endif /* HAVE_SDL_SDL_IMAGE_H */
[3104]34
[2842]35//! Class to handle Materials.
[2776]36class Material
37{
38 public:
39  Material ();
40  Material (char* mtlName);
[2778]41  Material* addMaterial(char* mtlName);
[3085]42  ~Material ();
[2776]43  void init(void);
[2778]44
[3085]45  Material* search (char* mtlName);
46  bool select (void);
47
[2776]48  void setName (char* mtlName);
[2778]49  char* getName (void);
[2776]50  void setIllum (int illum);
51  void setIllum (char* illum);
52  void setDiffuse (float r, float g, float b);
53  void setDiffuse (char* rgb);
54  void setAmbient (float r, float g, float b);
55  void setAmbient (char* rgb);
56  void setSpecular (float r, float g, float b);
57  void setSpecular (char* rgb);
[2836]58  void setShininess (float shini);
59  void setShininess (char* shini);
[2776]60  void setTransparency (float trans);
61  void setTransparency (char* trans);
62
[3085]63
64
65
[3070]66  // MAPPING //
67  void setDiffuseMap(char* dMap);
68  void setAmbientMap(char* aMap);
69  void setSpecularMap(char* sMap);
70  void setBump(char* bump);
71
72
[2776]73 private:
[3090]74  struct Image
[3086]75  {
76    int rowSpan;
[3094]77    GLuint width;
78    GLuint height;
79    GLuint bpp;
80    GLuint type;
[3089]81    GLubyte *data;
[3086]82  };
83
84
[3069]85  char* name;
[2776]86  int illumModel;
[2780]87  float diffuse [4];
88  float ambient [4];
89  float specular [4];
[2836]90  float shininess;
[2776]91  float transparency;
[3093]92
93  GLuint diffuseTexture;
94  GLuint ambientTexture;
95  GLuint specularTexture;
96 
97  bool diffuseTextureSet;
98  bool ambientTextureSet;
99  bool specularTextureSet;
100
[3085]101  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
[2776]102
[3086]103  // TEXTURING
[3094]104  bool loadTexToGL (Image* pImage, GLuint* texture);
105
[3087]106  bool loadImage(char* imageName, GLuint* texture);
[3103]107#ifndef HAVE_SDL_SDL_IMAGE_H
[3087]108
[3086]109  bool loadBMP (char* bmpName, GLuint* texture);
[3087]110
[3086]111  bool loadJPG (char* jpgName, GLuint* texture);
[3089]112
[3094]113  /// TGA ///
114
115  bool loadTGA(const char * tgaName, GLuint* texture);
116  bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
[3096]117  bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
[3094]118
[3098]119  bool loadPNG(const char* pngName, GLuint* texture);
[3103]120#endif
[2776]121};
122#endif
Note: See TracBrowser for help on using the repository browser.