36 #define MAX_BMODEL_VERTS 500 // 6K
37 #define MAX_BMODEL_EDGES 1000 // 12K
59 VectorCopy(vec, tvec);
96 bedge_t *psideedges[2], *pnextedge, *ptedge;
97 int i, side, lastside;
98 float dist, frac, lastdist;
99 cplane_t *splitplane, tplane;
100 mvertex_t *pvert, *plastvert, *ptvert;
104 psideedges[0] = psideedges[1] = NULL;
110 splitplane = pnode->plane;
117 for (; pedges; pedges = pnextedge) {
118 pnextedge = pedges->
pnext;
122 plastvert = pedges->
v[0];
123 lastdist = PlaneDiff(plastvert->point, &tplane);
130 pvert = pedges->
v[1];
131 dist = PlaneDiff(pvert->point, &tplane);
138 if (side != lastside) {
144 frac = lastdist / (lastdist - dist);
146 LerpVector(plastvert->point, pvert->point, frac, ptvert->point);
152 Com_Printf(
"Out of edges for bmodel\n");
157 ptedge->
pnext = psideedges[lastside];
158 psideedges[lastside] = ptedge;
159 ptedge->
v[0] = plastvert;
160 ptedge->
v[1] = ptvert;
163 ptedge->
pnext = psideedges[side];
164 psideedges[side] = ptedge;
165 ptedge->
v[0] = ptvert;
166 ptedge->
v[1] = pvert;
180 pedges->
pnext = psideedges[side];
181 psideedges[side] = pedges;
189 Com_Error(ERR_DROP,
"Out of edges for bmodel");
193 ptedge->
pnext = psideedges[0];
194 psideedges[0] = ptedge;
199 ptedge->
pnext = psideedges[1];
200 psideedges[1] = ptedge;
208 for (i = 0; i < 2; i++) {
212 pn = pnode->children[i];
217 mleaf_t *pl = (mleaf_t *)pn;
218 if (pl->contents != CONTENTS_SOLID) {
254 msurfedge_t *surfedge;
258 psurf = pmodel->firstface;
259 numsurfaces = pmodel->numfaces;
261 for (i = 0; i < numsurfaces; i++, psurf++) {
263 pplane = psurf->plane;
285 Com_Printf(
"Out of edges for bmodel\n");
289 surfedge = psurf->firstsurfedge;
290 for (j = 0; j < psurf->numsurfedges; j++, surfedge++) {
291 pbedge[j].
v[0] = surfedge->edge->v[surfedge->vert ];
292 pbedge[j].
v[1] = surfedge->edge->v[surfedge->vert ^ 1];
293 pbedge[j].
pnext = &pbedge[j + 1];
296 pbedge[j - 1].
pnext = NULL;
298 if (!(psurf->texinfo->c.flags & SURF_TRANS_MASK))
323 psurf = pmodel->firstface;
324 numsurfaces = pmodel->numfaces;
326 for (i = 0; i < numsurfaces; i++, psurf++) {
328 pplane = psurf->plane;
353 int i,
c, side, *pindex;
354 vec3_t acceptpt, rejectpt;
356 mface_t *surf, **mark;
365 for (i = 0; i < 4; i++) {
366 if (!(clipflags & (1 << i)))
375 rejectpt[0] = (float)node->minmaxs[pindex[0]];
376 rejectpt[1] = (
float)node->minmaxs[pindex[1]];
377 rejectpt[2] = (float)node->minmaxs[pindex[2]];
383 acceptpt[0] = (float)node->minmaxs[pindex[3 + 0]];
384 acceptpt[1] = (
float)node->minmaxs[pindex[3 + 1]];
385 acceptpt[2] = (float)node->minmaxs[pindex[3 + 2]];
389 clipflags &= ~(1 << i);
397 pleaf = (mleaf_t *)node;
399 if (pleaf->contents == CONTENTS_SOLID)
404 if (! Q_IsBitSet(
r_newrefdef.areabits, pleaf->area))
408 mark = pleaf->firstleafface;
409 c = pleaf->numleaffaces;
426 dot = PlaneDiffFast(
modelorg, plane);
439 surf = node->firstface;
442 if ((surf->drawflags & DSURF_PLANEBACK) &&
450 if (!(surf->drawflags & DSURF_PLANEBACK) &&
463 node = node->children[side ^ 1];