6#define MAXRECURSIVEPORTALPLANES 1024
7#define MAXRECURSIVEPORTALS 256
19 int numpoints = targnumpoints,
i,
w;
28 PolygonF_Divide(numpoints, &
portaltemppoints[
w][0][0], clipplanes[
i].
normal[0], clipplanes[
i].
normal[1], clipplanes[
i].
normal[2], clipplanes[
i].dist, 1.0f/32.0f, 256, &
portaltemppoints[1-
w][0][0], &numpoints, 0,
NULL,
NULL,
NULL);
30 numpoints =
min(numpoints, 256);
32 numpoints =
min(numpoints, maxpoints);
41 int newpoints,
i, prev;
63 for (
i = 0;
i < newpoints;
i++)
68 newplanes = &
portalplanes[firstclipplane + numclipplanes];
69 for (prev = newpoints - 1,
i = 0;
i < newpoints;prev =
i,
i++)
112 for (
i = 0, p = polypoints;
i < numpoints;
i++, p += 3)
119 if (front == numpoints)
133 int i, prev, returnvalue;
145 eyeleaf =
model->brush.PointInLeaf(
model, eye);
149 for (
i = 0;
i < numpoints;
i++)
150 VectorAdd(center, (&polypoints[
i * 3]), center);
155 for (prev = numpoints - 1,
i = 0;
i < numpoints;prev =
i,
i++)
182#define Portal_MinsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \
184 if (eye[(axis)] < ((axisvalue) - 0.5f))\
186 boxpoints[ 0] = x1;boxpoints[ 1] = y1;boxpoints[ 2] = z1;\
187 boxpoints[ 3] = x2;boxpoints[ 4] = y2;boxpoints[ 5] = z2;\
188 boxpoints[ 6] = x3;boxpoints[ 7] = y3;boxpoints[ 8] = z3;\
189 boxpoints[ 9] = x4;boxpoints[10] = y4;boxpoints[11] = z4;\
190 if (Portal_CheckPolygon(model, eye, boxpoints, 4))\
195#define Portal_MaxsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \
197 if (eye[(axis)] > ((axisvalue) + 0.5f))\
199 boxpoints[ 0] = x1;boxpoints[ 1] = y1;boxpoints[ 2] = z1;\
200 boxpoints[ 3] = x2;boxpoints[ 4] = y2;boxpoints[ 5] = z2;\
201 boxpoints[ 6] = x3;boxpoints[ 7] = y3;boxpoints[ 8] = z3;\
202 boxpoints[ 9] = x4;boxpoints[10] = y4;boxpoints[11] = z4;\
203 if (Portal_CheckPolygon(model, eye, boxpoints, 4))\
210 if (eye[0] >= (
a[0] - 1.0f) && eye[0] < (
b[0] + 1.0f)
211 && eye[1] >= (
a[1] - 1.0f) && eye[1] < (
b[1] + 1.0f)
212 && eye[2] >= (
a[2] - 1.0f) && eye[2] < (
b[2] + 1.0f))
267typedef struct portalrecursioninfo_s
292 int newpoints,
i, prev;
303 for (
i = 0;
i < 3;
i++)
329 qbool addedtris =
false;
332 const float *vertex3f;
377 for (
i = 0;
i < newpoints;
i++)
382 newplanes = &
portalplanes[firstclipplane + numclipplanes];
383 for (prev = newpoints - 1,
i = 0;
i < newpoints;prev =
i,
i++)
423void Portal_Visibility(
model_t *
model,
const vec3_t eye,
int *leaflist,
unsigned char *leafpvs,
int *numleafspointer,
int *surfacelist,
unsigned char *surfacepvs,
int *numsurfacespointer,
const mplane_t *frustumplanes,
int numfrustumplanes,
int exact,
const float *boxmins,
const float *boxmaxs,
float *updateleafsmins,
float *updateleafsmaxs,
unsigned char *shadowtrispvs,
unsigned char *lighttrispvs,
unsigned char *visitingleafpvs)
431 Con_Print(
"Portal_Visibility: NULL model\n");
435 if (!
model->brush.data_nodes)
437 Con_Print(
"Portal_Visibility: not a brush model\n");
442 for (
i = 0;
i < numfrustumplanes;
i++)
475 if (numsurfacespointer)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
GLfloat GLfloat GLfloat v2
GLubyte GLubyte GLubyte GLubyte w
#define BoxesOverlap(a, b, c, d)
#define VectorNormalize(v)
#define BoxInsideBox(a, b, c, d)
#define PointInfrontOfTriangle(p, a, b, c)
#define VectorSubtract(a, b, out)
#define CrossProduct(a, b, out)
#define TriangleNormal(a, b, c, n)
#define PlaneDiff(point, plane)
#define VectorCopy(in, out)
#define VectorScale(in, scale, out)
#define VectorAdd(a, b, out)
#define TriangleBBoxOverlapsBox(a, b, c, d, e)
#define CLEARPVSBIT(pvs, b)
#define CHECKPVSBIT(pvs, b)
#define SETPVSBIT(pvs, b)
void PolygonF_Divide(int innumpoints, const float *inpoints, float planenormalx, float planenormaly, float planenormalz, float planedist, float epsilon, int outfrontmaxpoints, float *outfrontpoints, int *neededfrontpoints, int outbackmaxpoints, float *outbackpoints, int *neededbackpoints, int *oncountpointer)
static int ranoutofportals
static float portaltemppoints[2][256][3]
static int ranoutofportalplanes
static int Portal_PortalThroughPortalPlanes(tinyplane_t *clipplanes, int clipnumplanes, float *targpoints, int targnumpoints, float *out, int maxpoints)
#define MAXRECURSIVEPORTALS
#define Portal_MinsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
static float boxpoints[4 *3]
static tinyplane_t portalplanes[MAXRECURSIVEPORTALPLANES]
int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpoints)
static void Portal_RecursiveFindLeafForFlow(portalrecursioninfo_t *info, mnode_t *node)
#define MAXRECURSIVEPORTALPLANES
static float portaltemppoints2[256][3]
static void Portal_RecursiveFlow(portalrecursioninfo_t *info, mleaf_t *leaf, int firstclipplane, int numclipplanes)
int Portal_CheckBox(model_t *model, vec3_t eye, vec3_t a, vec3_t b)
static void Portal_PolygonRecursiveMarkLeafs(mnode_t *node, float *polypoints, int numpoints)
void Portal_Visibility(model_t *model, const vec3_t eye, int *leaflist, unsigned char *leafpvs, int *numleafspointer, int *surfacelist, unsigned char *surfacepvs, int *numsurfacespointer, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs, unsigned char *shadowtrispvs, unsigned char *lighttrispvs, unsigned char *visitingleafpvs)
#define Portal_MaxsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
static int Portal_RecursiveFlowSearch(mleaf_t *leaf, vec3_t eye, int firstclipplane, int numclipplanes)
struct mportal_s * portals
struct mnode_s * children[2]
msurface_t * data_surfaces
describes the textures to use on a range of triangles in the model, and mins/maxs (AABB) for culling.
int num_triangles
range of triangles and vertices in model->surfmesh
vec3_t mins
bounding box for onscreen checks
unsigned char * shadowtrispvs
unsigned char * lighttrispvs
unsigned char * surfacepvs
unsigned char * visitingleafpvs
LadyHavoc: minimal plane structure.