1 /*
2 	Copyright (C) 2005 by Ruben Henner Zilibowitz <rzilibowitz@users.sourceforge.net>
3 	Part of the Toy Cars Project http://toycars.sourceforge.net
4 
5 	This program is free software; you can redistribute it and/or modify
6 	it under the terms of the license.
7 	This program is distributed in the hope that it will be useful,
8 	but WITHOUT ANY WARRANTY.
9 
10 	See the COPYING file for more details.
11 */
12 
13 /*
14  *  ScImage.h
15  *  Scoobie
16  *
17  *  Created by Ruben Henner Zilibowitz on 26/11/04.
18  *
19  */
20 
21 #ifndef SCIMAGE_H
22 #define SCIMAGE_H
23 
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27 
28 #include "ScTypes.h"
29 
30 class ScImage
31 {
32 public:
33 			ScImage(short border, const ScPixelData& pixelData, bool flip = true);
34 			~ScImage();
35 
36 	void	draw(ScFloat loc_x, ScFloat loc_y);	// draw entire image at location
37 
38 protected:
39 	short	calculateNumCells(short maxtexsize, short distance);
40 	void	calculateCellSizeAndTC(short maxtexsize, short distance, short* sizes, ScFloat* tc1, ScFloat* tc2);
41 
42 	GLuint*		texs;					// texture names
43 
44 	short		columns, rows;			// number of columns and rows of textures
45 
46 	short*		colSize;	// end position of each column
47 	ScFloat*	colTC1;		// lower texture coordinates for each column
48 	ScFloat*	colTC2;		// upper texture coordinates for each column
49 
50 	short*		rowSize;	// end position of each row
51 	ScFloat*	rowTC1;		// lower texture coordinates for each row
52 	ScFloat*	rowTC2;		// upper texture coordinates for each row
53 };
54 
55 #endif
56