Debian Codegraph @

lib/bumpmap.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef BUMPMAP_H
20 #define BUMPMAP_H
21
22 #include "pstypes.h"
23
24 #define MAX_BUMPMAPS 500
25 #define BAD_BUMP_INDEX 65535
26
27 #define BUMPF_USED 1
28 #define BUMPF_CHANGED 2
29
30 struct bms_bumpmap {
31 uint16_t *data; // 8bit data
32 int16_t cache_slot; // for the renderers use
33 uint8_t width, height;
34 uint8_t flags, pad;
35 };
36
37 extern bms_bumpmap GameBumpmaps[MAX_BUMPMAPS];
38
39 // Sets all the bumpmaps to unused
40 void bump_InitBumpmaps();
41
42 void bump_ShutdownBumpmaps(void);
43
44 // Allocs a bumpmap of BUMP_WIDTH * BUMP_HEIGHT size
45 // Returns bumpmap handle if successful, -1 if otherwise
46 int bump_AllocBumpmap(int w, int h);
47
48 // Given a handle, frees the bumpmap memory and flags this bumpmap as unused
49 void bump_FreeBumpmap(int handle);
50
51 // returns a bumpmaps data else NULL if something is wrong
52 uint16_t *bump_data(int handle);
53
54 // returns width or height of the passed in bumpmap
55 uint8_t bump_w(int handle);
56 uint8_t bump_h(int handle);
57
58 #endif