Descent3/lib/bumpmap.h

59 lines
1.6 KiB
C
Raw Normal View History

/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2024-04-16 03:43:29 +00:00
#ifndef BUMPMAP_H
#define BUMPMAP_H
#include "pstypes.h"
#define MAX_BUMPMAPS 500
2024-04-16 18:56:40 +00:00
#define BAD_BUMP_INDEX 65535
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
#define BUMPF_USED 1
#define BUMPF_CHANGED 2
2024-04-16 03:43:29 +00:00
struct bms_bumpmap {
uint16_t *data; // 8bit data
int16_t cache_slot; // for the renderers use
2024-05-24 03:07:26 +00:00
uint8_t width, height;
uint8_t flags, pad;
};
2024-04-16 03:43:29 +00:00
extern bms_bumpmap GameBumpmaps[MAX_BUMPMAPS];
// Sets all the bumpmaps to unused
void bump_InitBumpmaps();
2024-04-16 18:56:40 +00:00
void bump_ShutdownBumpmaps(void);
2024-04-16 03:43:29 +00:00
// Allocs a bumpmap of BUMP_WIDTH * BUMP_HEIGHT size
// Returns bumpmap handle if successful, -1 if otherwise
2024-04-16 18:56:40 +00:00
int bump_AllocBumpmap(int w, int h);
2024-04-16 03:43:29 +00:00
// Given a handle, frees the bumpmap memory and flags this bumpmap as unused
2024-04-16 18:56:40 +00:00
void bump_FreeBumpmap(int handle);
2024-04-16 03:43:29 +00:00
// returns a bumpmaps data else NULL if something is wrong
uint16_t *bump_data(int handle);
2024-04-16 03:43:29 +00:00
// returns width or height of the passed in bumpmap
2024-05-24 03:07:26 +00:00
uint8_t bump_w(int handle);
uint8_t bump_h(int handle);
2024-04-16 03:43:29 +00:00
#endif