| 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 SPECIAL_FACE_H |
| 20 | #define SPECIAL_FACE_H |
| 21 | |
| 22 | #include "pstypes.h" |
| 23 | #include "pserror.h" |
| 24 | #include "vecmat.h" |
| 25 | |
| 26 | #define BAD_SPECIAL_FACE_INDEX -1 |
| 27 | #define MAX_SPECIAL_FACES 13000 // made large enough for Josh's Mercenary level 3 |
| 28 | |
| 29 | // What this special face is used for: |
| 30 | #define SFT_SPECULAR 1 |
| 31 | |
| 32 | struct specular_instance { |
| 33 | vector bright_center; |
| 34 | uint16_t bright_color; |
| 35 | }; |
| 36 | |
| 37 | #define SFF_SPEC_OBJECT 1 |
| 38 | #define SFF_SPEC_SMOOTH 2 |
| 39 | |
| 40 | struct special_face { |
| 41 | uint8_t type; // See types (above) |
| 42 | uint8_t num; // Number of instances |
| 43 | uint8_t used; |
| 44 | uint8_t flags; |
| 45 | |
| 46 | specular_instance *spec_instance; |
| 47 | |
| 48 | vector *vertnorms; |
| 49 | |
| 50 | }; |
| 51 | |
| 52 | extern special_face SpecialFaces[]; |
| 53 | extern int Num_of_special_faces; |
| 54 | |
| 55 | // Sets all the special faces to unused |
| 56 | void InitSpecialFaces(); |
| 57 | |
| 58 | // Returns an index into the special faces array |
| 59 | int AllocSpecialFace(int type, int num, bool vertnorms = false, int num_vertnorms = 0); |
| 60 | |
| 61 | // Given a handle, frees the special face |
| 62 | void FreeSpecialFace(int handle); |
| 63 | |
| 64 | #endif |