[scene] Improve directional light handling

While it wasn't the root cause of the disappearing lights (even after
sorting out the light limit issue), because the cause of that was
everything working as designed, I suspect sunlight wasn't reaching as
far as it should. Even it it was, this should be slightly faster
(especially for larger maps) as leafs can be tested 32 or 64 at a time
rather than individually.
This commit is contained in:
Bill Currie 2022-05-10 10:57:48 +09:00
parent 775f3b87a8
commit d3965af2ae

View file

@ -132,15 +132,14 @@ Light_FindVisibleLights (lightingdata_t *ldata)
if (leaf == model->brush.leafs) {
set_everything (ldata->pvs);
flags = SURF_DRAWSKY;
} else {
Mod_LeafPVS_set (leaf, model, 0, ldata->pvs);
if (set_is_intersecting (ldata->pvs, ldata->sun_pvs)) {
flags |= SURF_DRAWSKY;
}
expand_pvs (ldata->pvs, model);
}
for (unsigned i = 0; i < model->brush.visleafs; i++) {
if (set_is_member (ldata->pvs, i)) {
flags |= model->brush.leaf_flags[i + 1];
}
}
ldata->leaf = leaf;
//double end = Sys_DoubleTime ();
@ -156,7 +155,8 @@ Light_FindVisibleLights (lightingdata_t *ldata)
visible++;
}
}
//Sys_Printf ("find_visible_lights: %d / %zd visible\n", visible,
// ldata->lightvis.size);
Sys_MaskPrintf (SYS_lighting,
"find_visible_lights: %d / %zd visible\n", visible,
ldata->lightvis.size);
}
}