| 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 LIGHTMAP_H |
| 20 | #define LIGHTMAP_Hcxx . . $ `lib/lightmap.h:20:9`! |
| 21 | |
| 22 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 23 | |
| 24 | #define MAX_LIGHTMAPScxx . . $ `lib/lightmap.h:24:9`! (65534) |
| 25 | #define BAD_LM_INDEXcxx . . $ `lib/lightmap.h:25:9`! 65535 |
| 26 | |
| 27 | // lightmap flags |
| 28 | #define LF_CHANGEDcxx . . $ `lib/lightmap.h:28:9`! 1 // this bitmap has changed since last frame (useful for hardware cacheing) |
| 29 | #define LF_LIMITScxx . . $ `lib/lightmap.h:29:9`! 2 // This lightmap has a specific area that has changed since last frame |
| 30 | #define LF_WRAPcxx . . $ `lib/lightmap.h:30:9`! 4 // This lightmap should be drawn with wrapping (not clamping) |
| 31 | #define LF_BRAND_NEWcxx . . $ `lib/lightmap.h:31:9`! 8 // This lightmap is brand new and hasn't been to the video card yet |
| 32 | |
| 33 | struct bms_lightmapcxx . . $ bms_lightmap# { |
| 34 | uint8_tcxx . . $ uint8_t# widthcxx . . $ bms_lightmap#width., heightcxx . . $ bms_lightmap#height.; // Width and height in pixels |
| 35 | uint16_tcxx . . $ uint16_t# *datacxx . . $ bms_lightmap#data.; // 16bit data |
| 36 | |
| 37 | uint16_tcxx . . $ uint16_t# usedcxx . . $ bms_lightmap#used.; |
| 38 | uint8_tcxx . . $ uint8_t# flagscxx . . $ bms_lightmap#flags.; |
| 39 | int16_t cache_slotcxx . . $ bms_lightmap#cache_slot.; // for the renderers use |
| 40 | uint8_tcxx . . $ uint8_t# square_rescxx . . $ bms_lightmap#square_res.; // for renderers use |
| 41 | uint8_tcxx . . $ uint8_t# cx1cxx . . $ bms_lightmap#cx1., cy1cxx . . $ bms_lightmap#cy1., cx2cxx . . $ bms_lightmap#cx2., cy2cxx . . $ bms_lightmap#cy2.; // Change x and y coords |
| 42 | }; |
| 43 | |
| 44 | extern bms_lightmapcxx . . $ bms_lightmap# GameLightmapscxx . . $ GameLightmaps.[MAX_LIGHTMAPScxx . . $ `lib/lightmap.h:24:9`!]; |
| 45 | |
| 46 | // Sets all the lightmaps to unused |
| 47 | void lm_InitLightmapscxx . . $ lm_InitLightmaps(49f6e7a06ebc5aa8).(); |
| 48 | |
| 49 | void lm_ShutdownLightmapscxx . . $ lm_ShutdownLightmaps(49f6e7a06ebc5aa8).(void); |
| 50 | |
| 51 | // Allocs a lightmap of w x h size |
| 52 | // Returns lightmap handle if successful, -1 if otherwise |
| 53 | int lm_AllocLightmapcxx . . $ lm_AllocLightmap(9b79fb6aee4c0440).(int w, int h); |
| 54 | |
| 55 | // Given a handle, frees the lightmap memory and flags this lightmap as unused |
| 56 | void lm_FreeLightmapcxx . . $ lm_FreeLightmap(d4f767463ce0a6b3).(int handle); |
| 57 | |
| 58 | // returns a lightmaps width else -1 if something is wrong |
| 59 | int lm_wcxx . . $ lm_w(7864480464b09eea).(int handle); |
| 60 | |
| 61 | // returns a lightmaps height , else -1 if something is wrong |
| 62 | int lm_hcxx . . $ lm_h(7864480464b09eea).(int handle); |
| 63 | |
| 64 | // returns a lightmaps data else NULL if something is wrong |
| 65 | uint16_tcxx . . $ uint16_t# *lm_datacxx . . $ lm_data(2fbd6a760478ca0f).(int handle); |
| 66 | |
| 67 | #endif |