mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-04-21 10:20:46 +00:00
Optimize which surfaces are passed to lightmapper
This commit is contained in:
parent
7610cade9f
commit
9f8d1effcd
4 changed files with 9 additions and 1 deletions
|
@ -93,6 +93,10 @@ struct LevelMeshSurface
|
|||
int lightmapperAtlasY = -1;
|
||||
};
|
||||
|
||||
inline float IsInFrontOfPlane(const FVector4& plane, const FVector3& point)
|
||||
{
|
||||
return (plane.X * point.X + plane.Y * point.Y + plane.Z * point.Z) >= plane.W;
|
||||
}
|
||||
|
||||
struct LevelMeshSmoothingGroup
|
||||
{
|
||||
|
|
|
@ -127,6 +127,9 @@ void VkLightmap::RenderAtlasImage(size_t pageIndex, const TArray<LevelMeshSurfac
|
|||
if (targetSurface->lightmapperAtlasPage != pageIndex)
|
||||
continue;
|
||||
|
||||
if (targetSurface->LightList.empty() && (targetSurface->plane.XYZ() | mesh->SunDirection) < 0.0f) // No lights, no sun //TODO fill the area with black pixels skipping blur and resolve pass
|
||||
continue;
|
||||
|
||||
VkViewport viewport = {};
|
||||
viewport.maxDepth = 1;
|
||||
viewport.x = (float)targetSurface->lightmapperAtlasX - 1;
|
||||
|
|
|
@ -204,6 +204,7 @@ void DoomLevelMesh::PropagateLight(const LevelMeshLight* light, std::set<LevelMe
|
|||
|
||||
// TODO skip any surface which isn't physically connected to the sector group in which the light resides
|
||||
//if (light-> == surface.sectorGroup)
|
||||
if (IsInFrontOfPlane(surface.plane, light->RelativeOrigin))
|
||||
{
|
||||
if (surface.portalIndex >= 0)
|
||||
{
|
||||
|
|
|
@ -869,7 +869,7 @@ void UpdateLightmaps(DFrameBuffer* screen, FRenderState& RenderState)
|
|||
{
|
||||
for (auto& e : level.levelMesh->Surfaces)
|
||||
{
|
||||
if (e.needsUpdate)
|
||||
if (e.needsUpdate && !e.bSky)
|
||||
{
|
||||
list.Push(&e);
|
||||
|
||||
|
|
Loading…
Reference in a new issue