#include "svbsp.h"
#include "polygon.h"
-#define MAX_SVBSP_POLYGONPOINTS 16
+#define MAX_SVBSP_POLYGONPOINTS 64
#define SVBSP_CLIP_EPSILON (1.0f / 1024.0f)
#define SVBSP_DotProduct(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
{
// now we need to create up to numpoints + 1 new nodes, forming a BSP tree
// describing the occluder polygon's shadow volume
- int i, j, p, basenum;
+ int i, j, p;
svbsp_node_t *node;
// points and lines are valid testers but not occluders
// note down the first available nodenum for the *parentnodenumpointer
// line which is done last to allow multithreaded queries during an
// insertion
- basenum = b->numnodes;
for (i = 0, p = poly->numpoints - 1;i < poly->numpoints;p = i, i++)
{
#if 1
// note we still allow points and lines to be tested...
if (numpoints < 1)
return 0;
+ // if the polygon has too many points, we would crash
+ if (numpoints > MAX_SVBSP_POLYGONPOINTS)
+ return 0;
poly.numpoints = numpoints;
for (i = 0;i < numpoints;i++)
{