[qfvis] Collect base vis culling stats

Specifically, just how many are culled by sphere and winding tests.
This commit is contained in:
Bill Currie 2021-03-28 11:59:58 +09:00
parent 29e029c792
commit eb325376b1
3 changed files with 18 additions and 3 deletions

View file

@ -177,6 +177,8 @@ typedef struct threaddata_s {
typedef struct {
set_t *portalsee;
unsigned spherecull; ///< number of portals culled by sphere tests
unsigned windingcull; ///< number of portals culled by winding tests
int clustersee;
int id;
} basethread_t;

View file

@ -122,12 +122,14 @@ PortalBase (basethread_t *thread, portal_t *portal)
if (tp_side < 0) {
// The test portal definitely is entirely behind the portal's
// plane.
thread->spherecull++;
continue; // entirely behind
}
portal_side = test_sphere (&portal->sphere, &tp->plane);
if (portal_side > 0) {
// The portal definitely is entirely in front of the test
// portal's plane.
thread->spherecull++;
continue; // entirely in front
}
@ -141,9 +143,11 @@ PortalBase (basethread_t *thread, portal_t *portal)
if (d > ON_EPSILON)
break;
}
if (k == winding->numpoints)
if (k == winding->numpoints) {
thread->windingcull++;
continue; // no points on front
}
}
if (portal_side == 0) {
// The portal's sphere touches the test portal's plane, so
@ -155,9 +159,11 @@ PortalBase (basethread_t *thread, portal_t *portal)
if (d < -ON_EPSILON)
break;
}
if (k == winding->numpoints)
if (k == winding->numpoints) {
thread->windingcull++;
continue; // no points on front
}
}
set_add (thread->portalsee, j);
}

View file

@ -75,6 +75,8 @@ options_t options;
static threaddata_t main_thread;
static visstat_t stats;
int base_mightsee;
unsigned base_spherecull;
unsigned base_windingcull;
static unsigned portal_count;
unsigned numportals;
@ -530,6 +532,8 @@ BaseVisThread (void *_thread)
} while (1);
WRLOCK (stats_lock);
base_spherecull += data.spherecull;
base_windingcull += data.windingcull;
base_mightsee += num_mightsee;
UNLOCK (stats_lock);
@ -767,8 +771,11 @@ BasePortalVis (void)
RunThreads (BaseVisThread);
end = Sys_DoubleTime ();
if (options.verbosity >= 1)
if (options.verbosity >= 1) {
printf ("base_mightsee: %d %gs\n", base_mightsee, end - start);
printf ("sphere cull: %u winding cull %u\n",
base_spherecull, base_windingcull);
}
}
static void