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))
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;
/*pvs test*/

View File

@ -287,7 +287,7 @@ typedef struct rendererinfo_s {
void (*BE_SubmitBatch)(struct batch_s *batch);
struct batch_s *(*BE_GetTempBatch)(void);
//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
void (*BE_Init)(void);
//Generates an optimised VBO, one for each texture on the map

View File

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

View File

@ -2170,7 +2170,7 @@ void Surf_DrawWorld (void)
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
{
r_refdef.flags |= Q2RDF_NOWORLDMODEL;
BE_DrawWorld(NULL);
BE_DrawWorld(false, NULL);
return;
}
if (!cl.worldmodel || cl.worldmodel->needload)
@ -2269,7 +2269,7 @@ void Surf_DrawWorld (void)
RSpeedEnd(RSPEED_WORLDNODE);
TRACE(("dbg: calling BE_DrawWorld\n"));
BE_DrawWorld(vis);
BE_DrawWorld(true, vis);
/*FIXME: move this away*/
if (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife)
@ -2769,6 +2769,7 @@ void Surf_BuildLightmaps (void)
int ptype;
void *mem;
unsigned int memsize;
int newfirst;
r_framecount = 1; // no dlightcache
@ -2803,35 +2804,43 @@ void Surf_BuildLightmaps (void)
currentmodel = m;
shift = Surf_LightmapShift(currentmodel);
i = numlightmaps + m->lightmaps.count;
lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(i));
while(i > numlightmaps)
if (*m->name == '*' && m->fromgame == fg_quake3) //FIXME: should be all bsp formats
newfirst = cl.model_precache[1]->lightmaps.first;
else
{
i--;
newfirst = numlightmaps;
lightmap[i] = Z_Malloc(sizeof(*lightmap[i]) + (sizeof(qbyte)*8 + sizeof(stmap)*3)*m->lightmaps.width*m->lightmaps.height);
lightmap[i]->width = m->lightmaps.width;
lightmap[i]->height = m->lightmaps.height;
lightmap[i]->lightmaps = (qbyte*)(lightmap[i]+1);
lightmap[i]->deluxmaps = (qbyte*)(lightmap[i]->lightmaps+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]->shader = NULL;
lightmap[i]->external = false;
// reset stainmap since it now starts at 255
memset(lightmap[i]->stainmaps, 255, LMBLOCK_WIDTH*LMBLOCK_HEIGHT*3*sizeof(stmap));
//clear out the deluxmaps incase there is none on the map.
for (k = 0; k < lightmap[i]->width*lightmap[i]->height*3; k+=3)
i = numlightmaps + m->lightmaps.count;
lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(i));
while(i > numlightmaps)
{
lightmap[i]->deluxmaps[k+0] = 128;
lightmap[i]->deluxmaps[k+1] = 128;
lightmap[i]->deluxmaps[k+2] = 255;
}
i--;
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));
lightmap[i] = Z_Malloc(sizeof(*lightmap[i]) + (sizeof(qbyte)*8 + sizeof(stmap)*3)*m->lightmaps.width*m->lightmaps.height);
lightmap[i]->width = m->lightmaps.width;
lightmap[i]->height = m->lightmaps.height;
lightmap[i]->lightmaps = (qbyte*)(lightmap[i]+1);
lightmap[i]->deluxmaps = (qbyte*)(lightmap[i]->lightmaps+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]->shader = NULL;
lightmap[i]->external = false;
// reset stainmap since it now starts at 255
memset(lightmap[i]->stainmaps, 255, LMBLOCK_WIDTH*LMBLOCK_HEIGHT*3*sizeof(stmap));
//clear out the deluxmaps incase there is none on the map.
for (k = 0; k < lightmap[i]->width*lightmap[i]->height*3; k+=3)
{
lightmap[i]->deluxmaps[k+0] = 128;
lightmap[i]->deluxmaps[k+1] = 128;
lightmap[i]->deluxmaps[k+2] = 255;
}
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));
}
numlightmaps += m->lightmaps.count;
}
//fixup batch lightmaps
@ -2842,7 +2851,7 @@ void Surf_BuildLightmaps (void)
{
if (batch->lightmap[i] < 0)
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;
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;
if (lightmap_bytes == 4)
{
@ -2916,7 +2925,7 @@ void Surf_BuildLightmaps (void)
surf->lightmaptexturenums[j] = -1;
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]];
@ -2928,9 +2937,7 @@ void Surf_BuildLightmaps (void)
}
}
}
m->lightmaps.first = numlightmaps;
numlightmaps += m->lightmaps.count;
m->lightmaps.first = newfirst;
}
#if 0
for (j=1 ; j<MAX_MODELS ; j++)

View File

@ -1796,9 +1796,18 @@ qbyte *R_MarkLeaves_Q3 (void)
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->vischain = r_vischain;
r_vischain = leaf;
#endif
}
}
else

View File

@ -406,43 +406,46 @@ DWORD CrashExceptionHandler (DWORD exceptionCode, LPEXCEPTION_POINTERS exception
qglGetVertexAttribPointerv = (void*)wglGetProcAddress("glGetVertexAttribPointerv");
#pragma comment(lib,"opengl32.lib")
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &rval);
Sys_Printf("GL_ARRAY_BUFFER_BINDING: %i\n", rval);
glGetPointerv(GL_COLOR_ARRAY_POINTER, &ptr);
Sys_Printf("GL_COLOR_ARRAY: %s (%lx)\n", glIsEnabled(GL_COLOR_ARRAY)?"en":"dis", (int) 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);
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &rval);
glGetPointerv(GL_INDEX_ARRAY_POINTER, &ptr);
Sys_Printf("GL_INDEX_ARRAY: %s %i:%p\n", glIsEnabled(GL_INDEX_ARRAY)?"en":"dis", rval, ptr);
glGetPointerv(GL_NORMAL_ARRAY_POINTER, &ptr);
Sys_Printf("GL_NORMAL_ARRAY: %s (%lx)\n", glIsEnabled(GL_NORMAL_ARRAY)?"en":"dis", (int) 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);
for (i = 0; i < 4; i++)
if (qglGetVertexAttribiv)
{
qglClientActiveTextureARB(mtexid0 + i);
glGetIntegerv(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING, &rval);
glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &ptr);
Sys_Printf("GL_TEXTURE_COORD_ARRAY %i: %s %i:%p\n", i, glIsEnabled(GL_TEXTURE_COORD_ARRAY)?"en":"dis", rval, ptr);
}
glGetIntegerv(GL_VERTEX_ARRAY_BUFFER_BINDING, &rval);
glGetPointerv(GL_VERTEX_ARRAY_POINTER, &ptr);
Sys_Printf("GL_VERTEX_ARRAY: %s %i:%p\n", glIsEnabled(GL_VERTEX_ARRAY)?"en":"dis", rval, ptr);
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &rval);
Sys_Printf("GL_ARRAY_BUFFER_BINDING: %i\n", rval);
glGetPointerv(GL_COLOR_ARRAY_POINTER, &ptr);
Sys_Printf("GL_COLOR_ARRAY: %s (%lx)\n", glIsEnabled(GL_COLOR_ARRAY)?"en":"dis", (int) 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);
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &rval);
glGetPointerv(GL_INDEX_ARRAY_POINTER, &ptr);
Sys_Printf("GL_INDEX_ARRAY: %s %i:%p\n", glIsEnabled(GL_INDEX_ARRAY)?"en":"dis", rval, ptr);
glGetPointerv(GL_NORMAL_ARRAY_POINTER, &ptr);
Sys_Printf("GL_NORMAL_ARRAY: %s (%lx)\n", glIsEnabled(GL_NORMAL_ARRAY)?"en":"dis", (int) 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);
for (i = 0; i < 4; i++)
{
qglClientActiveTextureARB(mtexid0 + i);
glGetIntegerv(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING, &rval);
glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &ptr);
Sys_Printf("GL_TEXTURE_COORD_ARRAY %i: %s %i:%p\n", i, glIsEnabled(GL_TEXTURE_COORD_ARRAY)?"en":"dis", rval, ptr);
}
glGetIntegerv(GL_VERTEX_ARRAY_BUFFER_BINDING, &rval);
glGetPointerv(GL_VERTEX_ARRAY_POINTER, &ptr);
Sys_Printf("GL_VERTEX_ARRAY: %s %i:%p\n", glIsEnabled(GL_VERTEX_ARRAY)?"en":"dis", rval, ptr);
for (i = 0; i < 16; i++)
{
int en, bo, as, st, ty, no;
for (i = 0; i < 16; i++)
{
int en, bo, as, st, ty, no;
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &en);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &bo);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &as);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &st);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &ty);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &no);
qglGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, &ptr);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &en);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &bo);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &as);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &st);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &ty);
qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &no);
qglGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, &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);
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

View File

@ -474,7 +474,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// per-level limits
//
#define MAX_EDICTS 32767 // FIXME: ouch! ouch! ouch!
#define MAX_LIGHTSTYLES 256
#define MAX_LIGHTSTYLES 255
#define MAX_STANDARDLIGHTSTYLES 64
#define MAX_MODELS 1024 // these are sent over the net as bytes
#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);
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->light_s[j] = LittleLong(in->lightmap_offs[0][j]);
out->light_t[j] = LittleLong(in->lightmap_offs[1][j]);
@ -3351,7 +3349,8 @@ qboolean CModQ3_LoadVisibility (lump_t *l)
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;
numvisibility = 0;
map_q3pvs->rowsize = (map_q3pvs->numclusters+7)/8;
@ -3554,10 +3553,12 @@ void CMQ3_CalcPHS (void)
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);
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->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;
else
{
name = BZ_Malloc(strlen(value)+1);
strcpy(name, value);
name = value;
if (*prinst->callargc > 1)
value = PR_GetStringOfs(prinst, OFS_PARM1);
else

View File

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

View File

@ -730,6 +730,15 @@ void GL_SelectProgram(int 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)
{
@ -756,6 +765,8 @@ void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsi
}
else
{
GL_DeSelectProgram();
GL_DeselectVAO();
BE_EnableShaderAttributes((1u<<VATTR_LEG_VERTEX));
//draw cached world shadow mesh
@ -766,15 +777,6 @@ void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsi
shaderstate.sourcevbo = NULL;
}
static void GL_DeSelectProgram(void)
{
if (shaderstate.currentprogram != 0)
{
qglUseProgramObjectARB(0);
shaderstate.currentprogram = 0;
}
}
void GL_CullFace(unsigned int sflags)
{
#ifndef FORCESTATE
@ -2675,9 +2677,21 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
if (perm & PERMUTATION_LIGHTSTYLES)
{
vec4_t colscale[MAXLIGHTMAPS];
int j;
int j, s;
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)
{
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;
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);
shaderstate.lastuniform = 0;
}
else
{
@ -3838,9 +3854,9 @@ static void BE_UpdateLightmaps(void)
int lmidx;
for (lmidx = 0; lmidx < numlightmaps; lmidx++)
{
if (!lightmap[lmidx])
continue;
lm = lightmap[lmidx];
if (!lm)
continue;
if (lm->modified)
{
glRect_t *theRect;
@ -4085,7 +4101,7 @@ void GLBE_DrawLightPrePass(qbyte *vis)
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;
batch_t *batches[SHADER_SORT_COUNT];
@ -4151,7 +4167,7 @@ void GLBE_DrawWorld (qbyte *vis)
BE_SelectEntity(&r_worldentity);
BE_UpdateLightmaps();
if (vis)
if (drawworld)
{
if (gl_overbright.modified)
{
@ -4165,7 +4181,7 @@ void GLBE_DrawWorld (qbyte *vis)
}
#ifdef RTLIGHTS
if (r_shadow_realtime_world.ival)
if (vis && r_shadow_realtime_world.ival)
shaderstate.identitylighting = r_shadow_realtime_world_lightmaps.value;
else
#endif
@ -4191,10 +4207,13 @@ void GLBE_DrawWorld (qbyte *vis)
}
#ifdef RTLIGHTS
RSpeedRemark();
BE_SelectEntity(&r_worldentity);
Sh_DrawLights(vis);
RSpeedEnd(RSPEED_STENCILSHADOWS);
if (vis)
{
RSpeedRemark();
BE_SelectEntity(&r_worldentity);
Sh_DrawLights(vis);
RSpeedEnd(RSPEED_STENCILSHADOWS);
}
#endif
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 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
}
else
BE_DrawWorld(NULL);
BE_DrawWorld(false, NULL);
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;
}
}
memset(newvis, 0xff, pvsbytes);
// memset(newvis, 0xff, pvsbytes);
}
}
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_ClearVBO(vbo_t *vbo);
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);
void GLBE_SelectEntity(entity_t *ent);
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_ClearVBO(vbo_t *vbo);
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);
void D3DBE_SelectEntity(entity_t *ent);
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;
}
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
// 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);
}
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);
LoadModelsAndSounds(f);

View File

@ -2281,7 +2281,7 @@ client_t *SVC_DirectConnect(void)
if ((temp.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS))// || ISDPCLIENT(&temp))
{
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+
sizeof(*temp.pendingentbits)*temp.max_net_ents+
sizeof(unsigned int)*maxents*UPDATE_BACKUP+