TORCS  1.3.9
The Open Racing Car Simulator
grloadsgi.h
Go to the documentation of this file.
1 /***************************************************************************
2 
3  file : grloadsgi.h
4  created : Wed Jun 1 14:56:31 CET 2005
5  copyright : (C) 2005 by Bernhard Wymann
6  version : $Id$
7 
8 ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 /*
20  Contains the header of the ssgSGIHeader class to allow me to overload,
21  the source is the file ssgLoadSGI.cxx. This is a stupid solution, but
22  the architecture of plib forces that... really.
23 */
24 
25 #ifndef _GRLOADSGI_H_
26 #define _GRLOADSGI_H_
27 
28 /*
29  The latter parts are derived from plib (plib.sf.net) and have this license:
30 
31  PLIB - A Suite of Portable Game Libraries
32  Copyright (C) 1998,2002 Steve Baker
33 
34  This library is free software; you can redistribute it and/or
35  modify it under the terms of the GNU Library General Public
36  License as published by the Free Software Foundation; either
37  version 2 of the License, or (at your option) any later version.
38 
39  This library is distributed in the hope that it will be useful,
40  but WITHOUT ANY WARRANTY; without even the implied warranty of
41  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42  Library General Public License for more details.
43 
44  You should have received a copy of the GNU Library General Public
45  License along with this library; if not, write to the Free Software
46  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
47 
48  For further information visit http://plib.sourceforge.net
49 */
50 
51 class ssgSGIHeader {
52  public:
53  unsigned short magic ;
54  int max ;
55  int min ;
56  int colormap ;
57  char type ;
58  char bpp ;
59  unsigned int *start ;
60  int *leng ;
61  unsigned short dim ;
62  unsigned short xsize ;
63  unsigned short ysize ;
64  unsigned short zsize ;
65  int tablen ;
66 
67  /* added by J. Nathan Matias */
68  FILE *image_fd;
69  char image_fname [ 512 ];
70  int isSwapped;
71  unsigned char *rle_temp;
73  ssgSGIHeader () ;
74  ssgSGIHeader(const char *fname, ssgTextureInfo* info );
75  ~ssgSGIHeader () ;
76 
77  bool openFile(const char *fname);
78  void makeConsistant () ;
79  void getRow ( unsigned char *buf, int y, int z ) ;
80  void getPlane ( unsigned char *buf, int z ) ;
81  void getImage ( unsigned char *buf ) ;
82  void readHeader () ;
83 
84  protected:
85  void swab_short ( unsigned short *x );
86  void swab_int ( unsigned int *x );
87  void swab_int_array ( int *x, int leng );
88  unsigned char readByte ();
89  unsigned short readShort ();
90  unsigned int readInt ();
91 };
92 
93 #endif // _GRLOADSGI_H_
unsigned short zsize
Definition: grloadsgi.h:64
unsigned short ysize
Definition: grloadsgi.h:63
bool openFile(const char *fname)
void swab_int(unsigned int *x)
unsigned char readByte()
FILE * image_fd
Definition: grloadsgi.h:68
bool loadSGI_bool
Definition: grloadsgi.h:72
void getImage(unsigned char *buf)
void readHeader()
int isSwapped
Definition: grloadsgi.h:70
void getRow(unsigned char *buf, int y, int z)
unsigned short readShort()
void swab_int_array(int *x, int leng)
void getPlane(unsigned char *buf, int z)
void makeConsistant()
unsigned short dim
Definition: grloadsgi.h:61
int * leng
Definition: grloadsgi.h:60
static Vector y[4]
Definition: Convex.cpp:56
unsigned int readInt()
char image_fname[512]
Definition: grloadsgi.h:69
unsigned short magic
Definition: grloadsgi.h:53
unsigned char * rle_temp
Definition: grloadsgi.h:71
unsigned short xsize
Definition: grloadsgi.h:62
unsigned int * start
Definition: grloadsgi.h:59
int colormap
Definition: grloadsgi.h:56
void swab_short(unsigned short *x)