1 /*
2 	This file is part of Warzone 2100.
3 	Copyright (C) 1999-2004  Eidos Interactive
4 	Copyright (C) 2005-2020  Warzone 2100 Project
5 
6 	Warzone 2100 is free software; you can redistribute it and/or modify
7 	it under the terms of the GNU General Public License as published by
8 	the Free Software Foundation; either version 2 of the License, or
9 	(at your option) any later version.
10 
11 	Warzone 2100 is distributed in the hope that it will be useful,
12 	but WITHOUT ANY WARRANTY; without even the implied warranty of
13 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 	GNU General Public License for more details.
15 
16 	You should have received a copy of the GNU General Public License
17 	along with Warzone 2100; if not, write to the Free Software
18 	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef __INCLUDED_SRC_TEXTURE_H__
22 #define __INCLUDED_SRC_TEXTURE_H__
23 
24 #include "display3ddef.h"
25 
26 bool texLoad(const char *fileName);
27 
28 struct TILE_TEX_INFO
29 {
30 	float uOffset; // Offset into texture page to left hand edge
31 	float vOffset; // Offset into texture page to top hand edge
32 	unsigned int texPage; // Which textpage is the tile in? TileNumber/16 basically;
33 };
34 
35 // these constants are adapted for fitting 256 textures of size 128x128 into a 2048x2048
36 // texture page; if such large texture pages are not available, just scaled everything down
37 #define TILES_IN_PAGE_COLUMN	16
38 #define TILES_IN_PAGE_ROW	16
39 #define TILES_IN_PAGE		(TILES_IN_PAGE_COLUMN * TILES_IN_PAGE_ROW)
40 #define MAX_TILES		TILES_IN_PAGE
41 
42 extern TILE_TEX_INFO	tileTexInfo[MAX_TILES];
43 extern size_t terrainPage;
44 
45 void setTextureSize(int texSize);
46 int getTextureSize();
47 
48 #endif // __INCLUDED_SRC_TEXTURE_H__
49