1 /* 2 =========================================================================== 3 Copyright (C) 1999-2005 Id Software, Inc. 4 5 This file is part of Quake III Arena source code. 6 7 Quake III Arena source code is free software; you can redistribute it 8 and/or modify it under the terms of the GNU General Public License as 9 published by the Free Software Foundation; either version 2 of the License, 10 or (at your option) any later version. 11 12 Quake III Arena source code is distributed in the hope that it will be 13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with Quake III Arena source code; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 =========================================================================== 21 */ 22 23 // this is only used for visualization tools in cm_ debug functions 24 25 typedef struct 26 { 27 int numpoints; 28 vec3_t p[4]; // variable sized 29 } winding_t; 30 31 #define MAX_POINTS_ON_WINDING 64 32 33 #define SIDE_FRONT 0 34 #define SIDE_BACK 1 35 #define SIDE_ON 2 36 #define SIDE_CROSS 3 37 38 #define CLIP_EPSILON 0.1f 39 40 #define MAX_MAP_BOUNDS 65535 41 42 // you can define on_epsilon in the makefile as tighter 43 #ifndef ON_EPSILON 44 #define ON_EPSILON 0.1f 45 #endif 46 47 winding_t *AllocWinding (int points); 48 vec_t WindingArea (winding_t *w); 49 void WindingCenter (winding_t *w, vec3_t center); 50 void ClipWindingEpsilon (winding_t *in, vec3_t normal, vec_t dist, 51 vec_t epsilon, winding_t **front, winding_t **back); 52 winding_t *ChopWinding (winding_t *in, vec3_t normal, vec_t dist); 53 winding_t *CopyWinding (winding_t *w); 54 winding_t *ReverseWinding (winding_t *w); 55 winding_t *BaseWindingForPlane (vec3_t normal, vec_t dist); 56 void CheckWinding (winding_t *w); 57 void WindingPlane (winding_t *w, vec3_t normal, vec_t *dist); 58 void RemoveColinearPoints (winding_t *w); 59 int WindingOnPlaneSide (winding_t *w, vec3_t normal, vec_t dist); 60 void FreeWinding (winding_t *w); 61 void WindingBounds (winding_t *w, vec3_t mins, vec3_t maxs); 62 63 void AddWindingToConvexHull( winding_t *w, winding_t **hull, vec3_t normal ); 64 65 void ChopWindingInPlace (winding_t **w, vec3_t normal, vec_t dist, vec_t epsilon); 66 // frees the original if clipped 67 68 void pw(winding_t *w); 69