Skip to content

Commit

Permalink
Renderers: do not merge single lightmap
Browse files Browse the repository at this point in the history
  • Loading branch information
ec- committed Feb 3, 2024
1 parent 82ed885 commit 629cf29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions code/renderer/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ R_LoadLightmaps
static void R_LoadLightmaps( const lump_t *l ) {
const byte *buf;
byte image[LIGHTMAP_LEN*LIGHTMAP_LEN*4];
int i;
int i, numLightmaps;
float maxIntensity = 0;

tr.numLightmaps = 0;
Expand All @@ -413,7 +413,9 @@ static void R_LoadLightmaps( const lump_t *l ) {
return;
}

if ( r_mergeLightmaps->integer ) {
numLightmaps = l->filelen / (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3);

if ( r_mergeLightmaps->integer && numLightmaps > 1 ) {
// check for low texture sizes
if ( glConfig.maxTextureSize >= LIGHTMAP_LEN*2 ) {
tr.mergeLightmaps = qtrue;
Expand All @@ -425,7 +427,7 @@ static void R_LoadLightmaps( const lump_t *l ) {
buf = fileBase + l->fileofs;

// create all the lightmaps
tr.numLightmaps = l->filelen / (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3);
tr.numLightmaps = numLightmaps;

// we are about to upload textures
//R_IssuePendingRenderCommands();
Expand Down
8 changes: 5 additions & 3 deletions code/renderervk/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ R_LoadLightmaps
static void R_LoadLightmaps( const lump_t *l ) {
const byte *buf;
byte image[LIGHTMAP_LEN*LIGHTMAP_LEN*4];
int i;
int i, numLightmaps;
float maxIntensity = 0;

tr.numLightmaps = 0;
Expand All @@ -420,7 +420,9 @@ static void R_LoadLightmaps( const lump_t *l ) {
return;
}

if ( r_mergeLightmaps->integer ) {
numLightmaps = l->filelen / (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3);

if ( r_mergeLightmaps->integer && numLightmaps > 1 ) {
// check for low texture sizes
if ( glConfig.maxTextureSize >= LIGHTMAP_LEN * 2 ) {
tr.mergeLightmaps = qtrue;
Expand All @@ -432,7 +434,7 @@ static void R_LoadLightmaps( const lump_t *l ) {
buf = fileBase + l->fileofs;

// create all the lightmaps
tr.numLightmaps = l->filelen / (LIGHTMAP_SIZE * LIGHTMAP_SIZE * 3);
tr.numLightmaps = numLightmaps;

tr.lightmaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t *), h_low );

Expand Down

0 comments on commit 629cf29

Please sign in to comment.