1 /** 2 * @file 3 */ 4 5 /* 6 All original material Copyright (C) 2002-2013 UFO: Alien Invasion. 7 8 Copyright (C) 1997-2001 Id Software, Inc. 9 10 This program is free software; you can redistribute it and/or 11 modify it under the terms of the GNU General Public License 12 as published by the Free Software Foundation; either version 2 13 of the License, or (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 19 See the GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 25 */ 26 27 #pragma once 28 29 #include "../../shared/mathlib.h" 30 #include "../../shared/defines.h" 31 #include "common/polylib.h" 32 33 typedef struct brush_texture_s { 34 vec2_t shift; 35 vec_t rotate; 36 vec2_t scale; 37 char name[MAX_TEXPATH]; /**< texture name - relative to base/textures */ 38 uint32_t surfaceFlags; 39 int value; 40 } brush_texture_t; 41 42 typedef struct face_s { 43 struct face_s *next; /**< on node */ 44 45 /** the chain of faces off of a node can be merged or split, 46 * but each face_t along the way will remain in the chain 47 * until the entire tree is freed */ 48 struct face_s *merged; /**< if set, this face isn't valid anymore */ 49 struct face_s *split[2]; /**< if set, this face isn't valid anymore */ 50 51 struct portal_s *portal; 52 int texinfo; 53 uint16_t planenum; 54 uint32_t contentFlags; /**< faces in different contents can't merge */ 55 winding_t *w; 56 int numpoints; 57 int vertexnums[MAXEDGES]; 58 } face_t; 59 60 typedef struct side_s { 61 uint16_t planenum; 62 int texinfo; 63 winding_t *winding; 64 struct side_s *original; /**< bspbrush_t sides will reference the mapbrush_t sides */ 65 uint32_t contentFlags; /**< from miptex */ 66 uint32_t surfaceFlags; /**< from miptex */ 67 bool visible; /**< choose visible planes first */ 68 bool tested; /**< this plane already checked as a split */ 69 bool bevel; /**< don't ever use for bsp splitting */ 70 bool isCompositeMember; /**< forms a side with sides from other brushes @sa Check_FindCompositeSides */ 71 72 struct mapbrush_s* brush; /**< backlink to the brush this side belongs to */ 73 } side_t; 74 75 typedef struct mapbrush_s { 76 int entitynum; /**< the entity number in the map - 0 is the world - everything else is a bmodel */ 77 int brushnum; /**< the brush number in the map */ 78 79 uint32_t contentFlags; 80 81 vec3_t mins, maxs; 82 83 int numsides; 84 struct side_s *original_sides; 85 86 /**list of brushes that are near to this one. 87 * not necessarily initialised. call Check_NearList() to make sure it has been initialised 88 * this will return quickly if it has already been done. */ 89 struct mapbrush_s** nearBrushes; 90 int numNear; 91 92 bool skipWriteBack; /**< in fix mode do not write back to the source .map file */ 93 94 bool finished; 95 } mapbrush_t; 96 97 /** @sa mapplanes */ 98 typedef struct plane_s { 99 vec3_t normal; /**< unit (magnitude == 1) normal defining the direction of the plane */ 100 vec_t dist; /**< distance from the origin to the plane. unit normal and distance 101 * description is http://mathworld.wolfram.com/HessianNormalForm.html 102 * though the sign of the distance seems to differ from the standard definition. 103 * (or the direction of the normal differs, the effect is the same when calculating 104 * the distance of a point from the plane.)*/ 105 int type; 106 vec3_t planeVector[3]; /**< 3 points on the plane, from the map file */ 107 struct plane_s *hash_chain; 108 } plane_t; 109 110 typedef struct portal_s { 111 plane_t plane; 112 struct node_s* onnode; /**< nullptr = outside box */ 113 struct node_s* nodes[2]; /**< [0] = front side of plane */ 114 struct portal_s* next[2]; 115 winding_t *winding; 116 117 bool sidefound; /**< false if ->side hasn't been checked */ 118 struct side_s* side; /**< nullptr = non-visible */ 119 face_t* face[2]; /**< output face in bsp file */ 120 } portal_t; 121