mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-10 22:51:37 +00:00
Colored static lights for GL!
If you try to load a 30-version'd BSP (ie, one with colored lighting) you are gonna find that software renderering looks like shit. I know what the problem is.
This commit is contained in:
parent
f3a7cdfb90
commit
9ffc3e44df
5 changed files with 53 additions and 30 deletions
|
@ -57,8 +57,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
#define BSPVERSION 29
|
||||
#define CBSPVERSION 30
|
||||
#define TOOLVERSION 2
|
||||
|
||||
int bspver; // since we allow two BSP versions, we
|
||||
// need to know which we're using
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fileofs, filelen;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
models.c - model loading and caching
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Portions Copyright (C) 1999,2000 Nelson Rush.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
|
@ -20,23 +21,22 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// models.c -- model loading and caching
|
||||
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#include "qtypes.h"
|
||||
#include "quakedef.h"
|
||||
#include "cvar.h"
|
||||
#include "sys.h"
|
||||
#include "mathlib.h"
|
||||
#include "glquake.h"
|
||||
#include "qendian.h"
|
||||
#include "lib_replace.h"
|
||||
#include "d_iface.h"
|
||||
#include "common.h"
|
||||
#include "crc.h"
|
||||
#include "console.h"
|
||||
#include <qtypes.h>
|
||||
#include <quakedef.h>
|
||||
#include <cvar.h>
|
||||
#include <sys.h>
|
||||
#include <mathlib.h>
|
||||
#include <glquake.h>
|
||||
#include <qendian.h>
|
||||
#include <lib_replace.h>
|
||||
#include <d_iface.h>
|
||||
#include <common.h>
|
||||
#include <crc.h>
|
||||
#include <console.h>
|
||||
|
||||
model_t *loadmodel;
|
||||
char loadname[32]; // for hunk tags
|
||||
|
@ -52,7 +52,6 @@ byte mod_novis[MAX_MAP_LEAFS/8];
|
|||
model_t mod_known[MAX_MOD_KNOWN];
|
||||
int mod_numknown;
|
||||
|
||||
//cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", CVAR_ARCHIVE};
|
||||
cvar_t *gl_subdivide_size;
|
||||
|
||||
/*
|
||||
|
@ -62,7 +61,6 @@ Mod_Init
|
|||
*/
|
||||
void Mod_Init (void)
|
||||
{
|
||||
// Cvar_RegisterVariable (&gl_subdivide_size);
|
||||
gl_subdivide_size = Cvar_Get ("gl_subdivide_size","128",CVAR_ARCHIVE,
|
||||
"None");
|
||||
memset (mod_novis, 0xff, sizeof(mod_novis));
|
||||
|
@ -1181,8 +1179,11 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
header = (dheader_t *)buffer;
|
||||
|
||||
i = LittleLong (header->version);
|
||||
if (i != BSPVERSION)
|
||||
Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION);
|
||||
if (!(i == BSPVERSION || i == CBSPVERSION))
|
||||
Sys_Error ("Mod_LoadBrushModel: %s has unkonwn version %i",
|
||||
mod->name, i);
|
||||
|
||||
bspver = i; // save BSP version for later use
|
||||
|
||||
// swap all the lumps
|
||||
mod_base = (byte *)header;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
gl_rpart.c
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Portions Copyright (C) 1999,2000 Nelson Rush.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
|
@ -21,12 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "quakedef.h"
|
||||
#include "r_local.h"
|
||||
#include <quakedef.h>
|
||||
#include <r_local.h>
|
||||
|
||||
#include "d_iface.h"
|
||||
#include "glquake.h"
|
||||
#include "mathlib.h"
|
||||
#include <d_iface.h>
|
||||
#include <glquake.h>
|
||||
#include <mathlib.h>
|
||||
|
||||
extern particle_t *active_particles, *free_particles;
|
||||
extern int ramp1[8], ramp2[8], ramp3[8];
|
||||
|
|
|
@ -198,12 +198,25 @@ void R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
|
|||
{
|
||||
scale = d_lightstylevalue[surf->styles[maps]];
|
||||
surf->cached_light[maps] = scale; // 8.8 fraction
|
||||
for (i=0 ; i<size ; i++)
|
||||
for (i=0, j=0 ; i<size ; i++)
|
||||
{
|
||||
cblocklights[0][i] += lightmap[i] * scale;
|
||||
cblocklights[1][i] += lightmap[i] * scale;
|
||||
cblocklights[2][i] += lightmap[i] * scale;
|
||||
blocklights[i] += lightmap[i] * scale;
|
||||
if (bspver == CBSPVERSION)
|
||||
{
|
||||
cblocklights[0][i] +=
|
||||
lightmap[j++] * scale;
|
||||
cblocklights[1][i] +=
|
||||
lightmap[j++] * scale;
|
||||
cblocklights[2][i] +=
|
||||
lightmap[j++] * scale;
|
||||
} else {
|
||||
cblocklights[0][i] +=
|
||||
lightmap[i] * scale;
|
||||
cblocklights[1][i] +=
|
||||
lightmap[i] * scale;
|
||||
cblocklights[2][i] +=
|
||||
lightmap[i] * scale;
|
||||
}
|
||||
blocklights[i] += lightmap[j++] * scale;
|
||||
}
|
||||
lightmap += size; // skip to next lightmap
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
model.c - model loading and caching
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Portions Copyright (C) 1999,2000 Nelson Rush.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
|
@ -20,7 +21,6 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// models.c -- model loading and caching
|
||||
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
@ -1236,9 +1236,12 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
header = (dheader_t *)buffer;
|
||||
|
||||
i = LittleLong (header->version);
|
||||
if (i != BSPVERSION)
|
||||
SV_SYS_ERROR ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION);
|
||||
if (!(i == BSPVERSION || i == CBSPVERSION))
|
||||
SV_SYS_ERROR ("Mod_LoadBrushModel: %s has unknown version %i",
|
||||
mod->name, i);
|
||||
|
||||
bspver = i; // save BSP version for later use
|
||||
|
||||
// swap all the lumps
|
||||
mod_base = (byte *)header;
|
||||
|
||||
|
|
Loading…
Reference in a new issue