mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
Hacking my way towards working r_lightmap_components 1.
Users of r_lightmap_components 1, should set `int mod_lightmap_bytes = 1` at the start of `quakeforge/libs/models/brush/gl_model_brush.c`.
This commit is contained in:
parent
b7900a2c43
commit
f1f942dfd1
4 changed files with 40 additions and 30 deletions
|
@ -479,7 +479,6 @@ extern struct cvar_s *gl_mesh_cache;
|
|||
extern struct cvar_s *gl_subdivide_size;
|
||||
extern model_t *loadmodel;
|
||||
extern char loadname[32];
|
||||
extern const int mod_lightmap_bytes;
|
||||
extern byte *mod_base;
|
||||
extern byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ static const char rcsid[] =
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
const int mod_lightmap_bytes = 3;
|
||||
int mod_lightmap_bytes = 3;
|
||||
|
||||
|
||||
void
|
||||
Mod_ProcessTexture (miptex_t *mt, texture_t *tx)
|
||||
|
@ -117,34 +118,46 @@ Mod_LoadLighting (lump_t *l)
|
|||
char litfilename[1024];
|
||||
|
||||
loadmodel->lightdata = NULL;
|
||||
// LordHavoc: check for a .lit file to load
|
||||
strcpy (litfilename, loadmodel->name);
|
||||
COM_StripExtension (litfilename, litfilename);
|
||||
strncat (litfilename, ".lit", sizeof (litfilename) - strlen (litfilename));
|
||||
data = (byte *) COM_LoadHunkFile (litfilename);
|
||||
if (data) {
|
||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
||||
&& data[3] == 'T') {
|
||||
i = LittleLong (((int *) data)[1]);
|
||||
if (i == 1) {
|
||||
Sys_DPrintf ("%s loaded", litfilename);
|
||||
loadmodel->lightdata = data + 8;
|
||||
return;
|
||||
if (mod_lightmap_bytes > 1) {
|
||||
// LordHavoc: check for a .lit file to load
|
||||
strcpy (litfilename, loadmodel->name);
|
||||
COM_StripExtension (litfilename, litfilename);
|
||||
strncat (litfilename, ".lit", sizeof (litfilename) -
|
||||
strlen (litfilename));
|
||||
data = (byte *) COM_LoadHunkFile (litfilename);
|
||||
if (data) {
|
||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
||||
&& data[3] == 'T') {
|
||||
i = LittleLong (((int *) data)[1]);
|
||||
if (i == 1) {
|
||||
Sys_DPrintf ("%s loaded", litfilename);
|
||||
loadmodel->lightdata = data + 8;
|
||||
return;
|
||||
} else
|
||||
Sys_Printf ("Unknown .lit file version (%d)\n", i);
|
||||
} else
|
||||
Sys_Printf ("Unknown .lit file version (%d)\n", i);
|
||||
} else
|
||||
Sys_Printf ("Corrupt .lit file (old version?), ignoring\n");
|
||||
Sys_Printf ("Corrupt .lit file (old version?), ignoring\n");
|
||||
}
|
||||
}
|
||||
// LordHavoc: oh well, expand the white lighting data
|
||||
if (!l->filelen)
|
||||
return;
|
||||
loadmodel->lightdata = Hunk_AllocName (l->filelen * 3, litfilename);
|
||||
loadmodel->lightdata = Hunk_AllocName (l->filelen * mod_lightmap_bytes,
|
||||
litfilename);
|
||||
in = mod_base + l->fileofs;
|
||||
out = loadmodel->lightdata;
|
||||
for (i = 0; i < l->filelen; i++) {
|
||||
d = *in++;
|
||||
*out++ = d;
|
||||
*out++ = d;
|
||||
*out++ = d;
|
||||
|
||||
if (mod_lightmap_bytes > 1) {
|
||||
for (i = 0; i < l->filelen ; i++) {
|
||||
d = *in++;
|
||||
*out++ = d;
|
||||
*out++ = d;
|
||||
*out++ = d;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < l->filelen ; i++) {
|
||||
d = *in++;
|
||||
*out++ = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,14 +51,12 @@ static const char rcsid[] =
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
void R_InitSky (struct texture_s *mt);
|
||||
|
||||
|
||||
|
||||
extern int mod_lightmap_bytes;
|
||||
byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
cvar_t *gl_sky_divide;
|
||||
|
||||
void GL_SubdivideSurface (msurface_t *fa);
|
||||
cvar_t *gl_sky_divide;
|
||||
void R_InitSky (struct texture_s *mt);
|
||||
|
||||
|
||||
mleaf_t *
|
||||
|
|
|
@ -43,7 +43,7 @@ static const char rcsid[] =
|
|||
#include "QF/model.h"
|
||||
|
||||
|
||||
const int mod_lightmap_bytes = 1;
|
||||
int mod_lightmap_bytes = 1;
|
||||
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue