| 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 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/lightmap_info.h $ |
| 21 | * $Revision: 25 $ |
| 22 | * $Date: 3/20/00 12:12p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/lightmap_info.h $ |
| 28 | * |
| 29 | * 25 3/20/00 12:12p Matt |
| 30 | * Merge of Duane's post-1.3 changes. |
| 31 | * Lower MAX_LIGHT_INFOS for Mac (Mac only) |
| 32 | * |
| 33 | * 24 10/21/99 6:42p Matt |
| 34 | * Mac merge |
| 35 | * |
| 36 | */ |
| 37 | |
| 38 | #ifndef LIGHTMAP_INFO_H |
| 39 | #define LIGHTMAP_INFO_H |
| 40 | // Lightmap info header |
| 41 | |
| 42 | #include "pstypes.h" |
| 43 | #include "pserror.h" |
| 44 | #include "vecmat.h" |
| 45 | |
| 46 | #define BAD_LMI_INDEX 65535 |
| 47 | |
| 48 | // What this lightmap is used for: |
| 49 | #define LMI_ROOM 0 |
| 50 | #define LMI_ROOM_OBJECT 1 |
| 51 | #define LMI_TERRAIN 2 |
| 52 | #define LMI_TERRAIN_OBJECT 3 |
| 53 | #define LMI_DYNAMIC 4 |
| 54 | #define LMI_EXTERNAL_ROOM 5 |
| 55 | #define LMI_EXTERNAL_ROOM_OBJECT 6 |
| 56 | |
| 57 | struct lightmap_info { |
| 58 | uint8_t xspacing, yspacing; |
| 59 | uint16_t lm_handle; |
| 60 | vector upper_left, normal; |
| 61 | uint8_t width, height, x1, y1; |
| 62 | uint8_t used; |
| 63 | |
| 64 | uint16_t dynamic; |
| 65 | int16_t spec_map; |
| 66 | |
| 67 | uint8_t type; // see LMI_types above |
| 68 | }; |
| 69 | |
| 70 | extern lightmap_info *LightmapInfo; |
| 71 | extern int Num_of_lightmap_info; |
| 72 | extern int Num_lightmap_infos_read; |
| 73 | |
| 74 | #define MAX_LIGHTMAP_INFOS (65534) |
| 75 | |
| 76 | // Sets all the lightmaps to unused |
| 77 | void InitLightmapInfo(int nummaps = 0); |
| 78 | |
| 79 | // Allocs a lightmap of w x h size |
| 80 | // Returns lightmap handle if successful, -1 if otherwise |
| 81 | int AllocLightmapInfo(int w, int h, int type, bool alloc_lightmap = true); |
| 82 | |
| 83 | // Given a handle, frees the lightmap memory and flags this lightmap as unused |
| 84 | void FreeLightmapInfo(int handle); |
| 85 | |
| 86 | // Gets the width of this lightmap_info handle |
| 87 | int lmi_w(int handle); |
| 88 | |
| 89 | // Gets the height of this lightmap_info handle |
| 90 | int lmi_h(int handle); |
| 91 | |
| 92 | void CloseLightmapInfos(); |
| 93 | |
| 94 | // Softens the edges of lightmaps so there are fewer artifaces |
| 95 | void ShadeLightmapInfoEdges(int type); |
| 96 | void BlurLightmapInfos(int type); |
| 97 | |
| 98 | #endif |