diff --git a/include/light/ltface.hh b/include/light/ltface.hh index 604aeeaa..e32ccaa8 100644 --- a/include/light/ltface.hh +++ b/include/light/ltface.hh @@ -38,6 +38,8 @@ #include #include +extern std::atomic total_light_rays, total_light_ray_hits, total_samplepoints; + void FaceCentroid(const bsp2_dface_t *face, const bsp2_t *bsp, vec3_t out); void WorldToTexCoord(const vec3_t world, const texinfo_t *tex, vec_t coord[2]); vec_t GetLightValue(const light_t *entity, vec_t dist); diff --git a/light/light.cc b/light/light.cc index f9372366..6998a274 100644 --- a/light/light.cc +++ b/light/light.cc @@ -1738,6 +1738,10 @@ main(int argc, const char **argv) WriteBSPFile(source, &bspdata); end = I_FloatTime(); logprint("%5.3f seconds elapsed\n", end - start); + logprint("%f lights tested per sample point\n", + static_cast(total_light_rays) / static_cast(total_samplepoints)); + logprint("%f lights hit per sample point\n", + static_cast(total_light_ray_hits) / static_cast(total_samplepoints)); close_log(); diff --git a/light/ltface.cc b/light/ltface.cc index 0bbd26b1..f154b10c 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -26,6 +26,8 @@ #include +std::atomic total_light_rays, total_light_ray_hits, total_samplepoints; + static void PrintFaceInfo(const bsp2_dface_t *face, const bsp2_t *bsp); @@ -1296,9 +1298,6 @@ VisCullEntity(const bsp2_t *bsp, const byte *pvs, const bsp2_dleaf_t *entleaf) return true; } -extern int totalhit; -extern int totalmissed; - // FIXME: factor out / merge with LightFace void GetDirectLighting(raystream_t *rs, const vec3_t origin, const vec3_t normal, vec3_t colorout) @@ -1438,12 +1437,15 @@ LightFace_Entity(const bsp2_t *bsp, } rs->tracePushedRaysOcclusion(); + total_light_rays += rs->numPushedRays(); const int N = rs->numPushedRays(); for (int j = 0; j < N; j++) { if (rs->getPushedRayOccluded(j)) continue; + total_light_ray_hits++; + int i = rs->getPushedRayPointIndex(j); lightsample_t *sample = &lightmap->samples[i]; const vec_t *surfpoint = lightsurf->points[i]; @@ -2379,6 +2381,9 @@ LightFace(bsp2_dface_t *face, facesup_t *facesup, const modelinfo_t *modelinfo, if (!(debugmode == debugmode_dirt || debugmode == debugmode_phong || debugmode == debugmode_bounce)) { + + total_samplepoints += lightsurf->numpoints; + /* positive lights */ for (const auto &entity : GetLights()) {