1
0
Fork 0
forked from fte/fteqw

misc fixes, mostly for q3bsp+no pvs.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4062 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2012-07-07 05:17:43 +00:00
parent eaae31aec1
commit f58b9802b8
16 changed files with 168 additions and 124 deletions

View file

@ -2242,7 +2242,7 @@ void CL_LinkStaticEntities(void *pvs)
if ((!r_drawflame.ival) && (clmodel->engineflags & MDLF_FLAME)) if ((!r_drawflame.ival) && (clmodel->engineflags & MDLF_FLAME))
continue; continue;
if (!cl.worldmodel->funcs.EdictInFatPVS(cl.worldmodel, &cl_static_entities[i].pvscache, pvs)) if (pvs && !cl.worldmodel->funcs.EdictInFatPVS(cl.worldmodel, &cl_static_entities[i].pvscache, pvs))
continue; continue;
/*pvs test*/ /*pvs test*/

View file

@ -287,7 +287,7 @@ typedef struct rendererinfo_s {
void (*BE_SubmitBatch)(struct batch_s *batch); void (*BE_SubmitBatch)(struct batch_s *batch);
struct batch_s *(*BE_GetTempBatch)(void); struct batch_s *(*BE_GetTempBatch)(void);
//Asks the backend to invoke DrawMeshChain for each surface, and to upload lightmaps as required //Asks the backend to invoke DrawMeshChain for each surface, and to upload lightmaps as required
void (*BE_DrawWorld) (qbyte *vis); void (*BE_DrawWorld) (qboolean drawworld, qbyte *vis);
//called at init, force the display to the right defaults etc //called at init, force the display to the right defaults etc
void (*BE_Init)(void); void (*BE_Init)(void);
//Generates an optimised VBO, one for each texture on the map //Generates an optimised VBO, one for each texture on the map

View file

@ -184,7 +184,6 @@ extern "C" {
#endif #endif
#ifdef USE_MSVCRT_DEBUG #ifdef USE_MSVCRT_DEBUG
#define USE_MSVCRT_DEBUG
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif

View file

@ -2170,7 +2170,7 @@ void Surf_DrawWorld (void)
if (r_refdef.flags & Q2RDF_NOWORLDMODEL) if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
{ {
r_refdef.flags |= Q2RDF_NOWORLDMODEL; r_refdef.flags |= Q2RDF_NOWORLDMODEL;
BE_DrawWorld(NULL); BE_DrawWorld(false, NULL);
return; return;
} }
if (!cl.worldmodel || cl.worldmodel->needload) if (!cl.worldmodel || cl.worldmodel->needload)
@ -2269,7 +2269,7 @@ void Surf_DrawWorld (void)
RSpeedEnd(RSPEED_WORLDNODE); RSpeedEnd(RSPEED_WORLDNODE);
TRACE(("dbg: calling BE_DrawWorld\n")); TRACE(("dbg: calling BE_DrawWorld\n"));
BE_DrawWorld(vis); BE_DrawWorld(true, vis);
/*FIXME: move this away*/ /*FIXME: move this away*/
if (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife) if (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife)
@ -2769,6 +2769,7 @@ void Surf_BuildLightmaps (void)
int ptype; int ptype;
void *mem; void *mem;
unsigned int memsize; unsigned int memsize;
int newfirst;
r_framecount = 1; // no dlightcache r_framecount = 1; // no dlightcache
@ -2803,6 +2804,12 @@ void Surf_BuildLightmaps (void)
currentmodel = m; currentmodel = m;
shift = Surf_LightmapShift(currentmodel); shift = Surf_LightmapShift(currentmodel);
if (*m->name == '*' && m->fromgame == fg_quake3) //FIXME: should be all bsp formats
newfirst = cl.model_precache[1]->lightmaps.first;
else
{
newfirst = numlightmaps;
i = numlightmaps + m->lightmaps.count; i = numlightmaps + m->lightmaps.count;
lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(i)); lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(i));
while(i > numlightmaps) while(i > numlightmaps)
@ -2817,7 +2824,7 @@ void Surf_BuildLightmaps (void)
lightmap[i]->stainmaps = (stmap*)(lightmap[i]->deluxmaps+4*lightmap[i]->width*lightmap[i]->height); lightmap[i]->stainmaps = (stmap*)(lightmap[i]->deluxmaps+4*lightmap[i]->width*lightmap[i]->height);
lightmap[i]->modified = true; lightmap[i]->modified = true;
// lightmap[i]->shader = NULL; // lightmap[i]->shader = NULL;
lightmap[i]->external = false; lightmap[i]->external = false;
// reset stainmap since it now starts at 255 // reset stainmap since it now starts at 255
memset(lightmap[i]->stainmaps, 255, LMBLOCK_WIDTH*LMBLOCK_HEIGHT*3*sizeof(stmap)); memset(lightmap[i]->stainmaps, 255, LMBLOCK_WIDTH*LMBLOCK_HEIGHT*3*sizeof(stmap));
@ -2833,6 +2840,8 @@ void Surf_BuildLightmaps (void)
TEXASSIGN(lightmap[i]->lightmap_texture, R_AllocNewTexture("***lightmap***", lightmap[i]->width, lightmap[i]->height)); TEXASSIGN(lightmap[i]->lightmap_texture, R_AllocNewTexture("***lightmap***", lightmap[i]->width, lightmap[i]->height));
TEXASSIGN(lightmap[i]->deluxmap_texture, R_AllocNewTexture("***deluxmap***", lightmap[i]->width, lightmap[i]->height)); TEXASSIGN(lightmap[i]->deluxmap_texture, R_AllocNewTexture("***deluxmap***", lightmap[i]->width, lightmap[i]->height));
} }
numlightmaps += m->lightmaps.count;
}
//fixup batch lightmaps //fixup batch lightmaps
for (sortid = 0; sortid < SHADER_SORT_COUNT; sortid++) for (sortid = 0; sortid < SHADER_SORT_COUNT; sortid++)
@ -2842,7 +2851,7 @@ void Surf_BuildLightmaps (void)
{ {
if (batch->lightmap[i] < 0) if (batch->lightmap[i] < 0)
continue; continue;
batch->lightmap[i] = batch->lightmap[i] - m->lightmaps.first + numlightmaps; batch->lightmap[i] = batch->lightmap[i] - m->lightmaps.first + newfirst;
} }
} }
@ -2874,7 +2883,7 @@ void Surf_BuildLightmaps (void)
unsigned char *dst; unsigned char *dst;
for (i = 0; i < m->lightmaps.count; i++) for (i = 0; i < m->lightmaps.count; i++)
{ {
dst = lightmap[numlightmaps+i]->lightmaps; dst = lightmap[newfirst+i]->lightmaps;
src = m->lightdata + i*m->lightmaps.width*m->lightmaps.height*3; src = m->lightdata + i*m->lightmaps.width*m->lightmaps.height*3;
if (lightmap_bytes == 4) if (lightmap_bytes == 4)
{ {
@ -2916,7 +2925,7 @@ void Surf_BuildLightmaps (void)
surf->lightmaptexturenums[j] = -1; surf->lightmaptexturenums[j] = -1;
continue; continue;
} }
surf->lightmaptexturenums[j] = surf->lightmaptexturenums[0] - m->lightmaps.first + numlightmaps; surf->lightmaptexturenums[j] = surf->lightmaptexturenums[0] - m->lightmaps.first + newfirst;
lm = lightmap[surf->lightmaptexturenums[j]]; lm = lightmap[surf->lightmaptexturenums[j]];
@ -2928,9 +2937,7 @@ void Surf_BuildLightmaps (void)
} }
} }
} }
m->lightmaps.first = numlightmaps; m->lightmaps.first = newfirst;
numlightmaps += m->lightmaps.count;
} }
#if 0 #if 0
for (j=1 ; j<MAX_MODELS ; j++) for (j=1 ; j<MAX_MODELS ; j++)

View file

@ -1796,9 +1796,18 @@ qbyte *R_MarkLeaves_Q3 (void)
continue; continue;
} }
#if 1
for (node = (mnode_t*)leaf; node; node = node->parent)
{
if (node->visframe == r_visframecount)
break;
node->visframe = r_visframecount;
}
#else
leaf->visframe = r_visframecount; leaf->visframe = r_visframecount;
leaf->vischain = r_vischain; leaf->vischain = r_vischain;
r_vischain = leaf; r_vischain = leaf;
#endif
} }
} }
else else

View file

@ -406,19 +406,21 @@ DWORD CrashExceptionHandler (DWORD exceptionCode, LPEXCEPTION_POINTERS exception
qglGetVertexAttribPointerv = (void*)wglGetProcAddress("glGetVertexAttribPointerv"); qglGetVertexAttribPointerv = (void*)wglGetProcAddress("glGetVertexAttribPointerv");
#pragma comment(lib,"opengl32.lib") #pragma comment(lib,"opengl32.lib")
if (qglGetVertexAttribiv)
{
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &rval); glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &rval);
Sys_Printf("GL_ARRAY_BUFFER_BINDING: %i\n", rval); Sys_Printf("GL_ARRAY_BUFFER_BINDING: %i\n", rval);
glGetPointerv(GL_COLOR_ARRAY_POINTER, &ptr); glGetPointerv(GL_COLOR_ARRAY_POINTER, &ptr);
Sys_Printf("GL_COLOR_ARRAY: %s (%lx)\n", glIsEnabled(GL_COLOR_ARRAY)?"en":"dis", (int) ptr); Sys_Printf("GL_COLOR_ARRAY: %s (%lx)\n", glIsEnabled(GL_COLOR_ARRAY)?"en":"dis", (int) ptr);
// glGetPointerv(GL_FOG_COORD_ARRAY_POINTER, &ptr); // glGetPointerv(GL_FOG_COORD_ARRAY_POINTER, &ptr);
// Sys_Printf("GL_FOG_COORDINATE_ARRAY_EXT: %i (%lx)\n", (int) glIsEnabled(GL_FOG_COORDINATE_ARRAY_EXT), (int) ptr); // Sys_Printf("GL_FOG_COORDINATE_ARRAY_EXT: %i (%lx)\n", (int) glIsEnabled(GL_FOG_COORDINATE_ARRAY_EXT), (int) ptr);
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &rval); glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &rval);
glGetPointerv(GL_INDEX_ARRAY_POINTER, &ptr); glGetPointerv(GL_INDEX_ARRAY_POINTER, &ptr);
Sys_Printf("GL_INDEX_ARRAY: %s %i:%p\n", glIsEnabled(GL_INDEX_ARRAY)?"en":"dis", rval, ptr); Sys_Printf("GL_INDEX_ARRAY: %s %i:%p\n", glIsEnabled(GL_INDEX_ARRAY)?"en":"dis", rval, ptr);
glGetPointerv(GL_NORMAL_ARRAY_POINTER, &ptr); glGetPointerv(GL_NORMAL_ARRAY_POINTER, &ptr);
Sys_Printf("GL_NORMAL_ARRAY: %s (%lx)\n", glIsEnabled(GL_NORMAL_ARRAY)?"en":"dis", (int) ptr); Sys_Printf("GL_NORMAL_ARRAY: %s (%lx)\n", glIsEnabled(GL_NORMAL_ARRAY)?"en":"dis", (int) ptr);
// glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER, &ptr); // glGetPointerv(GL_SECONDARY_COLOR_ARRAY_POINTER, &ptr);
// Sys_Printf("GL_SECONDARY_COLOR_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_SECONDARY_COLOR_ARRAY), (int) ptr); // Sys_Printf("GL_SECONDARY_COLOR_ARRAY: %i (%lx)\n", (int) glIsEnabled(GL_SECONDARY_COLOR_ARRAY), (int) ptr);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
qglClientActiveTextureARB(mtexid0 + i); qglClientActiveTextureARB(mtexid0 + i);
@ -444,6 +446,7 @@ DWORD CrashExceptionHandler (DWORD exceptionCode, LPEXCEPTION_POINTERS exception
Sys_Printf("attrib%i: %s as:%i st:%i ty:%0x %s%i:%p\n", i, en?"en":"dis", as, st,ty,no?"norm ":"", bo, ptr); Sys_Printf("attrib%i: %s as:%i st:%i ty:%0x %s%i:%p\n", i, en?"en":"dis", as, st,ty,no?"norm ":"", bo, ptr);
} }
}
#endif #endif
hKernel = LoadLibrary ("kernel32"); hKernel = LoadLibrary ("kernel32");

View file

@ -474,7 +474,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// per-level limits // per-level limits
// //
#define MAX_EDICTS 32767 // FIXME: ouch! ouch! ouch! #define MAX_EDICTS 32767 // FIXME: ouch! ouch! ouch!
#define MAX_LIGHTSTYLES 256 #define MAX_LIGHTSTYLES 255
#define MAX_STANDARDLIGHTSTYLES 64 #define MAX_STANDARDLIGHTSTYLES 64
#define MAX_MODELS 1024 // these are sent over the net as bytes #define MAX_MODELS 1024 // these are sent over the net as bytes
#define MAX_SOUNDS 1024 // so they cannot be blindly increased #define MAX_SOUNDS 1024 // so they cannot be blindly increased

View file

@ -2861,8 +2861,6 @@ qboolean CModRBSP_LoadRFaces (lump_t *l)
in->facetype = LittleLong(in->facetype); in->facetype = LittleLong(in->facetype);
for (j = 0; j < 4 && j < MAXLIGHTMAPS; j++) for (j = 0; j < 4 && j < MAXLIGHTMAPS; j++)
{ {
if (in->lightmapnum[j] >= 0 && j)
Con_Printf("lightstyled!\n");
out->lightmaptexturenums[j] = LittleLong(in->lightmapnum[j]); out->lightmaptexturenums[j] = LittleLong(in->lightmapnum[j]);
out->light_s[j] = LittleLong(in->lightmap_offs[0][j]); out->light_s[j] = LittleLong(in->lightmap_offs[0][j]);
out->light_t[j] = LittleLong(in->lightmap_offs[1][j]); out->light_t[j] = LittleLong(in->lightmap_offs[1][j]);
@ -3351,7 +3349,8 @@ qboolean CModQ3_LoadVisibility (lump_t *l)
numclusters++; numclusters++;
memset (map_visibility, 0xff, sizeof(map_visibility)); map_q3pvs = Hunk_Alloc(sizeof(*map_q3pvs) + (numclusters+7)/8 * numclusters);
memset (map_q3pvs, 0xff, sizeof(*map_q3pvs) + (numclusters+7)/8 * numclusters);
map_q3pvs->numclusters = numclusters; map_q3pvs->numclusters = numclusters;
numvisibility = 0; numvisibility = 0;
map_q3pvs->rowsize = (map_q3pvs->numclusters+7)/8; map_q3pvs->rowsize = (map_q3pvs->numclusters+7)/8;
@ -3554,10 +3553,12 @@ void CMQ3_CalcPHS (void)
Con_DPrintf ("Building PHS...\n"); Con_DPrintf ("Building PHS...\n");
map_q3phs = Hunk_Alloc(sizeof(*map_q3phs) + (map_q3pvs->numclusters+7)/8 * map_q3pvs->numclusters);
rowwords = map_q3pvs->rowsize / sizeof(long); rowwords = map_q3pvs->rowsize / sizeof(long);
rowbytes = map_q3pvs->rowsize; rowbytes = map_q3pvs->rowsize;
memset ( map_q3phs, 0, MAX_Q2MAP_VISIBILITY ); memset ( map_q3phs, 0, sizeof(*map_q3phs) + (map_q3pvs->numclusters+7)/8 * map_q3pvs->numclusters );
map_q3phs->rowsize = map_q3pvs->rowsize; map_q3phs->rowsize = map_q3pvs->rowsize;
map_q3phs->numclusters = numclusters = map_q3pvs->numclusters; map_q3phs->numclusters = numclusters = map_q3pvs->numclusters;

View file

@ -692,8 +692,7 @@ void QCBUILTIN PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_glo
G_FLOAT(OFS_RETURN) = 0; G_FLOAT(OFS_RETURN) = 0;
else else
{ {
name = BZ_Malloc(strlen(value)+1); name = value;
strcpy(name, value);
if (*prinst->callargc > 1) if (*prinst->callargc > 1)
value = PR_GetStringOfs(prinst, OFS_PARM1); value = PR_GetStringOfs(prinst, OFS_PARM1);
else else

View file

@ -647,12 +647,16 @@ static void BindTexture(unsigned int tu, void *id)
static void SelectPassTexture(unsigned int tu, shaderpass_t *pass) static void SelectPassTexture(unsigned int tu, shaderpass_t *pass)
{ {
int last; int last;
extern texid_t missing_texture;
switch(pass->texgen) switch(pass->texgen)
{ {
default: default:
case T_GEN_DIFFUSE: case T_GEN_DIFFUSE:
if (shaderstate.curtexnums->base.ptr)
BindTexture(tu, shaderstate.curtexnums->base.ptr); BindTexture(tu, shaderstate.curtexnums->base.ptr);
else
BindTexture(tu, missing_texture.ptr);
break; break;
case T_GEN_NORMALMAP: case T_GEN_NORMALMAP:
BindTexture( tu, shaderstate.curtexnums->bump.ptr); BindTexture( tu, shaderstate.curtexnums->bump.ptr);
@ -2426,8 +2430,8 @@ void BE_UploadLightmaps(qboolean force)
{ {
lm->rectchange.l = 0; lm->rectchange.l = 0;
lm->rectchange.t = 0; lm->rectchange.t = 0;
lm->rectchange.w = LMBLOCK_WIDTH; lm->rectchange.w = lm->width;
lm->rectchange.h = LMBLOCK_HEIGHT; lm->rectchange.h = lm->height;
} }
if (lightmap[i]->modified) if (lightmap[i]->modified)
@ -2439,7 +2443,7 @@ void BE_UploadLightmaps(qboolean force)
int r; int r;
if (!tex) if (!tex)
{ {
lm->lightmap_texture = R_AllocNewTexture("***lightmap***", LMBLOCK_WIDTH, LMBLOCK_HEIGHT); lm->lightmap_texture = R_AllocNewTexture("***lightmap***", lm->width, lm->height);
tex = lm->lightmap_texture.ptr; tex = lm->lightmap_texture.ptr;
if (!tex) if (!tex)
continue; continue;
@ -2454,11 +2458,11 @@ void BE_UploadLightmaps(qboolean force)
IDirect3DTexture9_LockRect(tex, 0, &lock, &rect, 0); IDirect3DTexture9_LockRect(tex, 0, &lock, &rect, 0);
for (r = 0; r < lightmap[i]->rectchange.h; r++) for (r = 0; r < lightmap[i]->rectchange.h; r++)
{ {
memcpy((char*)lock.pBits + r*lock.Pitch, lightmap[i]->lightmaps+(theRect->l+((r+theRect->t)*LMBLOCK_WIDTH))*lightmap_bytes, lightmap[i]->rectchange.w*lightmap_bytes); memcpy((char*)lock.pBits + r*lock.Pitch, lightmap[i]->lightmaps+(theRect->l+((r+theRect->t)*lm->width))*lightmap_bytes, lightmap[i]->rectchange.w*lightmap_bytes);
} }
IDirect3DTexture9_UnlockRect(tex, 0); IDirect3DTexture9_UnlockRect(tex, 0);
theRect->l = LMBLOCK_WIDTH; theRect->l = lm->width;
theRect->t = LMBLOCK_HEIGHT; theRect->t = lm->height;
theRect->h = 0; theRect->h = 0;
theRect->w = 0; theRect->w = 0;
} }
@ -3016,7 +3020,7 @@ void D3DBE_RenderShadowBuffer(unsigned int numverts, IDirect3DVertexBuffer9 *vbu
} }
#endif #endif
void D3DBE_DrawWorld (qbyte *vis) void D3DBE_DrawWorld (qboolean drawworld, qbyte *vis)
{ {
batch_t *batches[SHADER_SORT_COUNT]; batch_t *batches[SHADER_SORT_COUNT];
RSpeedLocals(); RSpeedLocals();
@ -3037,7 +3041,7 @@ void D3DBE_DrawWorld (qbyte *vis)
BE_GenModelBatches(batches); BE_GenModelBatches(batches);
if (vis) if (drawworld)
{ {
BE_UploadLightmaps(false); BE_UploadLightmaps(false);
@ -3057,10 +3061,13 @@ void D3DBE_DrawWorld (qbyte *vis)
RSpeedEnd(RSPEED_WORLD); RSpeedEnd(RSPEED_WORLD);
#ifdef RTLIGHTS #ifdef RTLIGHTS
if (vis)
{
RSpeedRemark(); RSpeedRemark();
D3DBE_SelectEntity(&r_worldentity); D3DBE_SelectEntity(&r_worldentity);
Sh_DrawLights(vis); Sh_DrawLights(vis);
RSpeedEnd(RSPEED_STENCILSHADOWS); RSpeedEnd(RSPEED_STENCILSHADOWS);
}
#endif #endif
D3DBE_SubmitMeshes(true, batches, SHADER_SORT_DECAL, SHADER_SORT_COUNT); D3DBE_SubmitMeshes(true, batches, SHADER_SORT_DECAL, SHADER_SORT_COUNT);

View file

@ -730,6 +730,15 @@ void GL_SelectProgram(int program)
shaderstate.currentprogram = program; shaderstate.currentprogram = program;
} }
} }
static void GL_DeSelectProgram(void)
{
if (shaderstate.currentprogram != 0)
{
qglUseProgramObjectARB(0);
shaderstate.currentprogram = 0;
}
}
void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsigned numindicies, int ibo, index_t *indicies) void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsigned numindicies, int ibo, index_t *indicies)
{ {
@ -756,6 +765,8 @@ void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsi
} }
else else
{ {
GL_DeSelectProgram();
GL_DeselectVAO();
BE_EnableShaderAttributes((1u<<VATTR_LEG_VERTEX)); BE_EnableShaderAttributes((1u<<VATTR_LEG_VERTEX));
//draw cached world shadow mesh //draw cached world shadow mesh
@ -766,15 +777,6 @@ void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsi
shaderstate.sourcevbo = NULL; shaderstate.sourcevbo = NULL;
} }
static void GL_DeSelectProgram(void)
{
if (shaderstate.currentprogram != 0)
{
qglUseProgramObjectARB(0);
shaderstate.currentprogram = 0;
}
}
void GL_CullFace(unsigned int sflags) void GL_CullFace(unsigned int sflags)
{ {
#ifndef FORCESTATE #ifndef FORCESTATE
@ -2675,9 +2677,21 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
if (perm & PERMUTATION_LIGHTSTYLES) if (perm & PERMUTATION_LIGHTSTYLES)
{ {
vec4_t colscale[MAXLIGHTMAPS]; vec4_t colscale[MAXLIGHTMAPS];
int j; int j, s;
for (j = 0; j < MAXLIGHTMAPS ; j++) for (j = 0; j < MAXLIGHTMAPS ; j++)
{ {
s = shaderstate.curbatch->lightstyle[j];
if (s == 255)
{
for (; j < MAXLIGHTMAPS ; j++)
{
colscale[j][0] = 0;
colscale[j][1] = 0;
colscale[j][2] = 0;
colscale[j][3] = 1;
}
break;
}
if (shaderstate.curentity->model && shaderstate.curentity->model->engineflags & MDLF_NEEDOVERBRIGHT) if (shaderstate.curentity->model && shaderstate.curentity->model->engineflags & MDLF_NEEDOVERBRIGHT)
{ {
float sc = (1<<bound(0, gl_overbright.ival, 2)) * shaderstate.identitylighting; float sc = (1<<bound(0, gl_overbright.ival, 2)) * shaderstate.identitylighting;
@ -2689,9 +2703,11 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
} }
colscale[j][3] = 1; colscale[j][3] = 1;
VectorScale(colscale[j], d_lightstylevalue[shaderstate.curbatch->lightstyle[j]]/256.0f, colscale[j]); VectorScale(colscale[j], d_lightstylevalue[s]/256.0f, colscale[j]);
} }
qglUniform4fvARB(p->handle[perm], j, (GLfloat*)colscale); qglUniform4fvARB(p->handle[perm], j, (GLfloat*)colscale);
shaderstate.lastuniform = 0;
} }
else else
{ {
@ -3838,9 +3854,9 @@ static void BE_UpdateLightmaps(void)
int lmidx; int lmidx;
for (lmidx = 0; lmidx < numlightmaps; lmidx++) for (lmidx = 0; lmidx < numlightmaps; lmidx++)
{ {
if (!lightmap[lmidx])
continue;
lm = lightmap[lmidx]; lm = lightmap[lmidx];
if (!lm)
continue;
if (lm->modified) if (lm->modified)
{ {
glRect_t *theRect; glRect_t *theRect;
@ -4085,7 +4101,7 @@ void GLBE_DrawLightPrePass(qbyte *vis)
qglClearColor (1,0,0,1); qglClearColor (1,0,0,1);
} }
void GLBE_DrawWorld (qbyte *vis) void GLBE_DrawWorld (qboolean drawworld, qbyte *vis)
{ {
extern cvar_t r_shadow_realtime_world, r_shadow_realtime_world_lightmaps; extern cvar_t r_shadow_realtime_world, r_shadow_realtime_world_lightmaps;
batch_t *batches[SHADER_SORT_COUNT]; batch_t *batches[SHADER_SORT_COUNT];
@ -4151,7 +4167,7 @@ void GLBE_DrawWorld (qbyte *vis)
BE_SelectEntity(&r_worldentity); BE_SelectEntity(&r_worldentity);
BE_UpdateLightmaps(); BE_UpdateLightmaps();
if (vis) if (drawworld)
{ {
if (gl_overbright.modified) if (gl_overbright.modified)
{ {
@ -4165,7 +4181,7 @@ void GLBE_DrawWorld (qbyte *vis)
} }
#ifdef RTLIGHTS #ifdef RTLIGHTS
if (r_shadow_realtime_world.ival) if (vis && r_shadow_realtime_world.ival)
shaderstate.identitylighting = r_shadow_realtime_world_lightmaps.value; shaderstate.identitylighting = r_shadow_realtime_world_lightmaps.value;
else else
#endif #endif
@ -4191,10 +4207,13 @@ void GLBE_DrawWorld (qbyte *vis)
} }
#ifdef RTLIGHTS #ifdef RTLIGHTS
if (vis)
{
RSpeedRemark(); RSpeedRemark();
BE_SelectEntity(&r_worldentity); BE_SelectEntity(&r_worldentity);
Sh_DrawLights(vis); Sh_DrawLights(vis);
RSpeedEnd(RSPEED_STENCILSHADOWS); RSpeedEnd(RSPEED_STENCILSHADOWS);
}
#endif #endif
shaderstate.identitylighting = 1; shaderstate.identitylighting = 1;

View file

@ -28,7 +28,7 @@ extern cvar_t r_shadow_realtime_world, r_shadow_realtime_world_lightmaps;
int r_dlightframecount; int r_dlightframecount;
int d_lightstylevalue[MAX_LIGHTSTYLES]; // 8.8 fraction of base light value int d_lightstylevalue[256]; // 8.8 fraction of base light value
/* /*
================== ==================

View file

@ -500,7 +500,7 @@ void R_RenderScene (void)
Surf_DrawWorld (); // adds static entities to the list Surf_DrawWorld (); // adds static entities to the list
} }
else else
BE_DrawWorld(NULL); BE_DrawWorld(false, NULL);
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
@ -728,7 +728,7 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, int portaltype)
r_refdef.forcedvis = newvis; r_refdef.forcedvis = newvis;
} }
} }
memset(newvis, 0xff, pvsbytes); // memset(newvis, 0xff, pvsbytes);
} }
} }
else if (!(view = R_NearestPortal(&plane)) || VectorCompare(view->origin, view->oldorigin)) else if (!(view = R_NearestPortal(&plane)) || VectorCompare(view->origin, view->oldorigin))

View file

@ -499,7 +499,7 @@ batch_t *GLBE_GetTempBatch(void);
void GLBE_GenBrushModelVBO(model_t *mod); void GLBE_GenBrushModelVBO(model_t *mod);
void GLBE_ClearVBO(vbo_t *vbo); void GLBE_ClearVBO(vbo_t *vbo);
void GLBE_UploadAllLightmaps(void); void GLBE_UploadAllLightmaps(void);
void GLBE_DrawWorld (qbyte *vis); void GLBE_DrawWorld (qboolean drawworld, qbyte *vis);
qboolean GLBE_LightCullModel(vec3_t org, model_t *model); qboolean GLBE_LightCullModel(vec3_t org, model_t *model);
void GLBE_SelectEntity(entity_t *ent); void GLBE_SelectEntity(entity_t *ent);
void GLBE_SelectDLight(dlight_t *dl, vec3_t colour); void GLBE_SelectDLight(dlight_t *dl, vec3_t colour);
@ -515,7 +515,7 @@ batch_t *D3DBE_GetTempBatch(void);
void D3DBE_GenBrushModelVBO(model_t *mod); void D3DBE_GenBrushModelVBO(model_t *mod);
void D3DBE_ClearVBO(vbo_t *vbo); void D3DBE_ClearVBO(vbo_t *vbo);
void D3DBE_UploadAllLightmaps(void); void D3DBE_UploadAllLightmaps(void);
void D3DBE_DrawWorld (qbyte *vis); void D3DBE_DrawWorld (qboolean drawworld, qbyte *vis)
qboolean D3DBE_LightCullModel(vec3_t org, model_t *model); qboolean D3DBE_LightCullModel(vec3_t org, model_t *model);
void D3DBE_SelectEntity(entity_t *ent); void D3DBE_SelectEntity(entity_t *ent);
void D3DBE_SelectDLight(dlight_t *dl, vec3_t colour); void D3DBE_SelectDLight(dlight_t *dl, vec3_t colour);

View file

@ -651,15 +651,6 @@ qboolean SV_LoadLevelCache(char *savename, char *level, char *startspot, qboolea
return false; return false;
} }
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
VFS_GETS(f, str, sizeof(str));
if (sv.strings.lightstyles[i])
Z_Free(sv.strings.lightstyles[i]);
sv.strings.lightstyles[i] = Z_Malloc (strlen(str)+1);
strcpy (sv.strings.lightstyles[i], str);
}
// load the edicts out of the savegame file // load the edicts out of the savegame file
// the rest of the file is sent directly to the progs engine. // the rest of the file is sent directly to the progs engine.
@ -672,6 +663,15 @@ qboolean SV_LoadLevelCache(char *savename, char *level, char *startspot, qboolea
PR_InitEnts(svprogfuncs, sv.world.max_edicts); PR_InitEnts(svprogfuncs, sv.world.max_edicts);
} }
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
VFS_GETS(f, str, sizeof(str));
if (sv.strings.lightstyles[i])
PR_AddressableFree(svprogfuncs, sv.strings.lightstyles[i]);
sv.strings.lightstyles[i] = PR_AddressableAlloc(svprogfuncs, strlen(str)+1);
strcpy (sv.strings.lightstyles[i], str);
}
modelpos = VFS_TELL(f); modelpos = VFS_TELL(f);
LoadModelsAndSounds(f); LoadModelsAndSounds(f);

View file

@ -2281,7 +2281,7 @@ client_t *SVC_DirectConnect(void)
if ((temp.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS))// || ISDPCLIENT(&temp)) if ((temp.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS))// || ISDPCLIENT(&temp))
{ {
char *ptr; char *ptr;
int maxents = maxpacketentities; /*this is the max number of ents updated per frame. we can't track more, so...*/ int maxents = temp.max_net_ents;//maxpacketentities; /*this is the max number of ents updated per frame. we can't track more, so...*/
ptr = Z_Malloc( sizeof(client_frame_t)*UPDATE_BACKUP+ ptr = Z_Malloc( sizeof(client_frame_t)*UPDATE_BACKUP+
sizeof(*temp.pendingentbits)*temp.max_net_ents+ sizeof(*temp.pendingentbits)*temp.max_net_ents+
sizeof(unsigned int)*maxents*UPDATE_BACKUP+ sizeof(unsigned int)*maxents*UPDATE_BACKUP+