- if (front.numpoints > MAX_SVBSP_POLYGONPOINTS)
- front.numpoints = MAX_SVBSP_POLYGONPOINTS;
- front.facesplitflag = facesplitflag;
- if (back.numpoints > MAX_SVBSP_POLYGONPOINTS)
- back.numpoints = MAX_SVBSP_POLYGONPOINTS;
- back.facesplitflag = facesplitflag;
-#if 0
- if (insertoccluder)
- {
- int pnum;
- int f;
- int pf;
- svbsp_node_t *pnode;
- // set splitflags based on this node and parent nodes
- for (i = 0;i < front.numpoints;i++)
- front.splitflags[i] = 0;
- for (i = 0;i < front.numpoints;i++)
- back.splitflags[i] = 0;
- pnum = *parentnodenumpointer;
- while (pnum >= 0)
- {
- pnode = b->nodes + pnum;
- plane[0] = pnode->plane[0];
- plane[1] = pnode->plane[1];
- plane[2] = pnode->plane[2];
- plane[3] = pnode->plane[3];
- if (front.numpoints)
- {
- i = front.numpoints-1;
- pf = fabs(SVBSP_DotProduct(front.points[i], plane) - plane[3]) <= SVBSP_CLIP_EPSILON;
- for (i = 0;i < front.numpoints;pf = f, i++)
- {
- f = fabs(SVBSP_DotProduct(front.points[i], plane) - plane[3]) <= SVBSP_CLIP_EPSILON;
- front.splitflags[i] |= (f & pf);
- }
- }
- if (back.numpoints)
- {
- i = back.numpoints-1;
- pf = fabs(SVBSP_DotProduct(back.points[i], plane) - plane[3]) <= SVBSP_CLIP_EPSILON;
- for (i = 0;i < back.numpoints;pf = f, i++)
- {
- f = fabs(SVBSP_DotProduct(back.points[i], plane) - plane[3]) <= SVBSP_CLIP_EPSILON;
- back.splitflags[i] |= (f & pf);
- }
- }
- pnum = pnode->parent;
- }
+ front.facesplitflag = facesplitflag;
+ back.facesplitflag = facesplitflag;
+ // recurse the sides and return the resulting occlusion flags
+ i = SVBSP_AddPolygonNode(b, &node->children[0], *parentnodenumpointer, &front, insertoccluder, fragmentcallback, fragmentcallback_pointer1, fragmentcallback_number1);
+ i |= SVBSP_AddPolygonNode(b, &node->children[1], *parentnodenumpointer, &back , insertoccluder, fragmentcallback, fragmentcallback_pointer1, fragmentcallback_number1);
+ return i;