30#define INTEGRAL_EPSILON 0.01
31#define POINT_EPSILON 0.0625
32#define OFF_EPSILON 0.5
36#define MAX_SUPERVERTS 512
59 const int x = (4096 + (
int)(vec[0] + 0.5)) >> 7;
60 const int y = (4096 + (
int)(vec[1] + 0.5)) >> 7;
63 Sys_Error(
"HashVec: point outside valid range");
78 for (
int i = 0;
i < 3;
i++) {
88 const float* p =
curTile->vertexes[vnum].point;
97 Sys_Error(
"numvertexes == MAX_MAP_VERTS");
111 return curTile->numvertexes - 1;
179 f->numpoints = remaining;
180 for (
i = 0;
i < remaining;
i++)
186 if (
f->merged ||
f->split[0] ||
f->split[1])
218 for (
int i = 0;
i < 2;
i++)
228 int x1, x2, y1, y2, t;
247 for (x = x1; x <= x2; x++)
248 for (y = y1; y <= y2; y++)
260 vec3_t delta, exact, off, p;
269 if (j == p1 || j == p2)
276 if (dist <= start || dist >= end)
287 TestEdge(start, dist, p1, j, k + 1);
305 if (
f->merged ||
f->split[0] ||
f->split[1])
310 for (
i = 0;
i <
f->numpoints;
i++) {
311 const int p1 =
f->vertexnums[
i];
312 const int p2 =
f->vertexnums[(
i + 1) %
f->numpoints];
338 for (
i = 0;
i <
f->numpoints;
i++) {
339 if (
count[
i] == 1 &&
count[(
i +
f->numpoints - 1) %
f->numpoints] == 1)
342 if (
i ==
f->numpoints) {
362 for (
int i = 0;
i < 2;
i++)
407 if (v1 == edge->
v[1] && v2 == edge->
v[0]
408 &&
edgefaces[
i][0]->contentFlags ==
f->contentFlags) {
435#define CONTINUOUS_EPSILON 0.001
445 vec_t* p1, *p2, *back;
460 const vec_t* p3 = f2->
p[j];
462 for (k = 0; k < 3; k++) {
471 if (j < f2->numpoints)
521 if (l == (j + 1) % f2->
numpoints && !keep1)
542 if (!f1->
w || !f2->
w)
569 for (f1 = node->
faces; f1; f1 = f1->
next) {
573 for (f2 = node->
faces; f2 != f1; f2 = f2->
next) {
589 merged->
next =
nullptr;
611 for (
int axis = 0; axis < 2; axis++) {
616 float maxs = -999999;
630 if (maxs - mins <=
config.subdivideSize)
641 if (!frontw || !backw)
642 Sys_Error(
"SubdivideFace: didn't split the polygon (texture: '%s')",
646 f->split[0]->w = frontw;
647 f->split[0]->next = node->
faces;
648 node->
faces =
f->split[0];
651 f->split[1]->w = backw;
652 f->split[1]->next = node->
faces;
653 node->
faces =
f->split[1];
688 f->planenum = (side->
planenum & ~1) | pside;
712 f->contentFlags = p->
nodes[1]->contentFlags;
715 f->contentFlags = p->
nodes[0]->contentFlags;
752 const int pside = (p->
nodes[1] == node);
755 if (p->
face[pside]) {
plane_t mapplanes[MAX_MAP_PLANES]
uint32_t VisibleContents(uint32_t contents)
Returns the single content bit of the strongest visible content present.
entity_t entities[MAX_MAP_ENTITIES]
const char * ValueForKey(const entity_t *ent, const char *key)
#define MAX_WORLD_WIDTH
-MAX_WORLD_WIDTH up tp +MAX_WORLD_WIDTH
static int edge_verts[MAX_MAP_VERTS]
static int superverts[MAX_SUPERVERTS]
static void MakeFaces_r(node_t *node)
If a portal will make a visible face, mark the side that originally created it.
#define CONTINUOUS_EPSILON
static face_t * FaceFromPortal(portal_t *p, bool pside)
static int c_badstartverts
int GetEdge(int v1, int v2, const face_t *f)
static winding_t * TryMergeWinding(winding_t *f1, winding_t *f2, const vec3_t planenormal)
If two polygons share a common edge and the edges that meet at the common points are both inside the ...
static int hashverts[HASH_SIZE *HASH_SIZE]
static int c_faceoverflows
static void EmitVertexes_r(node_t *node)
void FixTjuncs(node_t *headnode)
void MakeFaces(node_t *node)
static void EmitFaceVertexes(node_t *node, face_t *f)
static void FixFaceEdges(node_t *node, face_t *f)
static void SubdivideFace(node_t *node, face_t *f)
Chop up faces that are larger than we want in the surface cache.
static void SubdivideNodeFaces(node_t *node)
static const face_t * edgefaces[MAX_MAP_EDGES][2]
static void FindEdgeVerts(const vec3_t v1, const vec3_t v2)
Uses the hash tables to cut down to a small number.
static void MergeNodeFaces(node_t *node)
static void FaceFromSuperverts(node_t *node, face_t *f, int base)
The faces vertexes have been added to the superverts[] array, and there may be more there than can be...
static face_t * NewFaceFromFace(const face_t *f)
static int num_edge_verts
static int GetVertexnum(const vec3_t in)
Returns the number of an existing vertex or allocates a new one.
static int c_facecollapse
static void TestEdge(vec_t start, vec_t end, int p1, int p2, int startvert)
static face_t * AllocFace(void)
static face_t * TryMerge(face_t *f1, face_t *f2, const vec3_t planenormal)
If two polygons share a common edge and the edges that meet at the common points are both inside the ...
static void FixEdges_r(node_t *node)
static int vertexchain[MAX_MAP_VERTS]
static unsigned HashVec(const vec3_t vec)
void Sys_Error(const char *error,...)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
vec_t VectorNormalize(vec3_t v)
Calculate unit vector for a given vec3_t.
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb).
vec_t Q_rint(const vec_t in)
Round to nearest integer.
void CrossProduct(const vec3_t v1, const vec3_t v2, vec3_t cross)
binary operation on vectors in a three-dimensional space
#define Mem_AllocType(type)
void FreeWinding(winding_t *w)
winding_t * ReverseWinding(const winding_t *w)
winding_t * AllocWinding(int points)
Allocate a new winding (polygon).
winding_t * CopyWinding(const winding_t *w)
Copy a winding with all its points allocated.
void ClipWindingEpsilon(const winding_t *in, const vec3_t normal, const vec_t dist, const vec_t epsilon, winding_t **front, winding_t **back)
QGL_EXTERN GLuint GLchar GLuint * len
QGL_EXTERN int GLboolean GLfloat * v
struct portal_s * portals
struct node_s * children[2]
struct portal_s * next[2]
struct mapbrush_s * brush
for storing the vertices of the side of a brush or other polygon
#define VectorSubtract(a, b, dest)
#define VectorCopy(src, dest)
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.