From a7da874d512a9833e7b8284e2e4a452f52e48576 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 24 Oct 2024 20:27:40 -0700 Subject: [PATCH] Source Engine: Fix some lightmap issues * Support surfaces without any light styles * Support sdk_ prefixes for lightmappedgeneric/worldvertextransition (Mapbase support) --- src/SourceEngine/Main.ts | 8 +++++-- src/SourceEngine/Materials/Lightmap.ts | 21 ++++++++++++++----- .../Materials/Material_Generic.ts | 4 ++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/SourceEngine/Main.ts b/src/SourceEngine/Main.ts index 7e978a469..840bec8cc 100644 --- a/src/SourceEngine/Main.ts +++ b/src/SourceEngine/Main.ts @@ -762,8 +762,10 @@ export class BSPRenderer { for (const faceIdx of this.liveFaceSet.values()) { const lightmapUpdater = this.lightmapUpdaters[faceIdx]; - if (lightmapUpdater !== null && lightmapUpdater.checkDirty(renderContext)) + if (lightmapUpdater !== null) { + lightmapUpdater.update(renderContext); lightmapUpdater.buildLightmap(renderContext, this.startLightmapPageIndex); + } const faceInfo = this.bsp.faceInfos[faceIdx]; if (faceInfo.surfaceIndex >= 0) @@ -798,8 +800,10 @@ export class BSPRenderer { const faceIdx = surface.surface.faceList[k]; const lightmapUpdater = this.lightmapUpdaters[faceIdx]; - if (lightmapUpdater !== null && lightmapUpdater.checkDirty(renderContext)) + if (lightmapUpdater !== null) { + lightmapUpdater.update(renderContext); lightmapUpdater.buildLightmap(renderContext, this.startLightmapPageIndex); + } } } diff --git a/src/SourceEngine/Materials/Lightmap.ts b/src/SourceEngine/Materials/Lightmap.ts index 2cc61a9c3..368451dc8 100644 --- a/src/SourceEngine/Materials/Lightmap.ts +++ b/src/SourceEngine/Materials/Lightmap.ts @@ -212,11 +212,16 @@ function lightmapPackRuntimeBumpmap(dstPage: LightmapPage, location: Readonly