OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
cm_polylib.h
1/*
2===========================================================================
3Copyright (C) 1999-2005 Id Software, Inc.
4
5This file is part of Quake III Arena source code.
6
7Quake III Arena source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12Quake III Arena source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with Quake III Arena source code; if not, write to the Free Software
19Foundation, 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#pragma once
26
27typedef struct
28{
29 int numpoints;
30 vec3_t p[4]; // variable sized
31} winding_t;
32
33#define MAX_POINTS_ON_WINDING 64
34
35#define SIDE_FRONT 0
36#define SIDE_BACK 1
37#define SIDE_ON 2
38#define SIDE_CROSS 3
39
40#define CLIP_EPSILON 0.1f
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
47winding_t *AllocWinding (int points);
48vec_t WindingArea (winding_t *w);
49void WindingCenter (winding_t *w, vec3_t center);
50void ClipWindingEpsilon (winding_t *in, vec3_t normal, vec_t dist,
51 vec_t epsilon, winding_t **front, winding_t **back);
52winding_t *ChopWinding (winding_t *in, vec3_t normal, vec_t dist);
53winding_t *CopyWinding (winding_t *w);
54winding_t *ReverseWinding (winding_t *w);
55winding_t *BaseWindingForPlane (vec3_t normal, vec_t dist);
56void CheckWinding (winding_t *w);
57void WindingPlane (winding_t *w, vec3_t normal, vec_t *dist);
58void RemoveColinearPoints (winding_t *w);
59int WindingOnPlaneSide (winding_t *w, vec3_t normal, vec_t dist);
60void FreeWinding (winding_t *w);
61void WindingBounds (winding_t *w, vec3_t mins, vec3_t maxs);
62
63void AddWindingToConvexHull( winding_t *w, winding_t **hull, vec3_t normal );
64
65void ChopWindingInPlace (winding_t **w, vec3_t normal, vec_t dist, vec_t epsilon);
66// frees the original if clipped
67
68void pw(winding_t *w);
Definition cm_polylib.h:28