OpenMoHAA
0.82.0
Loading...
Searching...
No Matches
cm_patch.h
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
//#define CULL_BBOX
24
25
/*
26
27
This file does not reference any globals, and has these entry points:
28
29
void CM_ClearLevelPatches( void );
30
struct patchCollide_s *CM_GeneratePatchCollide( int width, int height, const vec3_t *points );
31
void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc );
32
qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc );
33
void CM_DrawDebugSurface( void (*drawPoly)(int color, int numPoints, flaot *points) );
34
35
36
Issues for collision against curved surfaces:
37
38
Surface edges need to be handled differently than surface planes
39
40
Plane expansion causes raw surfaces to expand past expanded bounding box
41
42
Position test of a volume against a surface is tricky.
43
44
Position test of a point against a surface is not well defined, because the surface has no volume.
45
46
47
Tracing leading edge points instead of volumes?
48
Position test by tracing corner to corner? (8*7 traces -- ouch)
49
50
coplanar edges
51
triangulated patches
52
degenerate patches
53
54
endcaps
55
degenerate
56
57
WARNING: this may misbehave with meshes that have rows or columns that only
58
degenerate a few triangles. Completely degenerate rows and columns are handled
59
properly.
60
*/
61
62
63
#define MAX_FACETS 1024
64
// Changed in OPM
65
// In OG it's 4096, however due to a tiny floating point difference
66
// between x86 and x64, more patch planes can appear in x64
67
#define MAX_PATCH_PLANES 6144
68
69
typedef
struct
{
70
float
plane[4];
71
int
signbits;
// signx + (signy<<1) + (signz<<2), used as lookup during collision
72
}
patchPlane_t
;
73
74
typedef
struct
{
75
int
surfacePlane;
76
int
numBorders;
// 3 or four + 6 axial bevels + 4 or 3 * 4 edge bevels
77
int
borderPlanes[4+6+16];
78
int
borderInward[4+6+16];
79
qboolean borderNoAdjust[4+6+16];
80
}
facet_t
;
81
82
typedef
struct
patchCollide_s
{
83
vec3_t bounds[2];
84
int
numPlanes;
// surface planes plus edge planes
85
patchPlane_t
*planes;
86
int
numFacets;
87
facet_t
*facets;
88
} patchCollide_t;
89
90
91
#define MAX_GRID_SIZE 129
92
93
typedef
struct
{
94
int
width;
95
int
height;
96
qboolean wrapWidth;
97
qboolean wrapHeight;
98
vec3_t points[MAX_GRID_SIZE][MAX_GRID_SIZE];
// [width][height]
99
}
cGrid_t
;
100
101
#define SUBDIVIDE_DISTANCE 16
//4 // never more than this units away from curve
102
#define PLANE_TRI_EPSILON 0.1
103
#define WRAP_POINT_EPSILON 0.1
104
105
106
patchCollide_t *CM_GeneratePatchCollide(
int
width,
int
height, vec3_t *points,
float
subdivisions );
cGrid_t
Definition
cm_patch.h:93
facet_t
Definition
cm_patch.h:74
patchCollide_s
Definition
cm_patch.h:82
patchPlane_t
Definition
cm_patch.h:69
code
qcommon
cm_patch.h
Generated by
1.13.2