Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3140 in orxonox.OLD for orxonox/trunk/importer/material.h


Ignore:
Timestamp:
Dec 10, 2004, 7:44:36 PM (21 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/images back into the trunk.
merged with command: svn merge bensches/images/ trunk/ -r 3084:HEAD

Conflicts in configure/.ac

resolved in favor of branches/images (newer)

Mayor differences:

  1. Image-Importing capability.
  2. configure remade for usage with sdl-image/jpeglib and so on.
  3. Absolutely no change in the trunk/src
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/importer/material.h

    r3070 r3140  
    1212#include <GL/glu.h>
    1313#include <SDL/SDL.h>
    14 #include <stdlib.h>
    15 #include <fstream>
     14
     15#if HAVE_CONFIG_H
     16#include <config.h>
     17#endif /* HAVE_CONFIG_H */
     18
     19#ifdef HAVE_SDL_SDL_IMAGE_H
     20#include <SDL/SDL_image.h>
     21#else
     22// IMAGE LIBS //
     23#ifdef HAVE_JPEGLIB_H
     24extern "C"{         // This has to be done, because not a c++ lib
     25#include <jpeglib.h>
     26}
     27#endif /* HAVE_JPEGLIB_H */
     28#ifdef HAVE_PNG_H
     29#include <png.h>
     30#endif /* HAVE_PNG_H */
     31#endif /* HAVE_SDL_SDL_IMAGE_H */
     32
     33class PathList
     34{
     35 public:
     36  PathList();
     37  PathList(char* pName);
     38
     39  ~PathList();
     40  void addPath (char* pName);
     41  char* pathName;
     42  PathList* next;
     43};
     44
    1645
    1746//! Class to handle Materials.
     
    2251  Material (char* mtlName);
    2352  Material* addMaterial(char* mtlName);
     53  ~Material ();
     54  void init(void);
    2455
    25   void init(void);
    26   ~Material ();
    27 
    28   GLuint diffuseTexture;
    29   GLuint ambientTexture;
    30   GLuint specularTexture;
    31  
    32   bool diffuseTextureSet;
    33   bool ambientTextureSet;
    34   bool specularTextureSet;
     56  Material* search (char* mtlName);
     57  bool select (void);
    3558
    3659  void setName (char* mtlName);
     
    4972  void setTransparency (char* trans);
    5073
    51   // MAPPING //
     74
     75 
     76  void addTexturePath(char* pathName);
     77  char* searchTextureInPaths(char* texName) const;
     78 // MAPPING //
    5279  void setDiffuseMap(char* dMap);
    5380  void setAmbientMap(char* aMap);
     
    5582  void setBump(char* bump);
    5683
    57   bool loadBMP (char* bmpName, GLuint* texture);
     84 private:
     85  struct Image
     86  {
     87    int rowSpan;
     88    GLuint width;
     89    GLuint height;
     90    GLuint bpp;
     91    GLuint type;
     92    GLubyte *data;
     93  };
    5894
    5995
    60   Material* search (char* mtlName);
    61 
    62   bool select (void);
    63 
    64   Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
    65 
    66  private:
    6796  char* name;
    6897  int illumModel;
     
    73102  float transparency;
    74103
     104  static PathList* pathList;
     105 
     106  GLuint diffuseTexture;
     107  GLuint ambientTexture;
     108  GLuint specularTexture;
     109 
     110  bool diffuseTextureSet;
     111  bool ambientTextureSet;
     112  bool specularTextureSet;
     113
     114  Material* nextMat; //!< pointer to the Next Material of the List. NULL if no next exists.
     115
     116  // TEXTURING
     117  bool loadTexToGL (Image* pImage, GLuint* texture);
     118
     119  bool loadImage(char* imageName, GLuint* texture);
     120#ifndef HAVE_SDL_SDL_IMAGE_H
     121
     122  bool loadBMP (char* bmpName, GLuint* texture);
     123
     124  bool loadJPG (char* jpgName, GLuint* texture);
     125
     126  /// TGA ///
     127
     128  bool loadTGA(const char * tgaName, GLuint* texture);
     129  bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
     130  bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
     131
     132  bool loadPNG(const char* pngName, GLuint* texture);
     133#endif
    75134};
    76135#endif
Note: See TracChangeset for help on using the changeset viewer.