diff --git a/engine/client/merged.h b/engine/client/merged.h index c7c6be1c6..8bf106c1d 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -229,11 +229,11 @@ typedef struct rendererinfo_s { //Select the current render mode and modifier flags - void (*BE_SelectMode)(backendmode_t mode, unsigned int flags); + void (*BE_SelectMode)(backendmode_t mode); /*Draws an entire mesh list from a VBO. vbo can be null, in which case the chain may be drawn without batching. Rules for using a list: Every mesh must be part of the same VBO, shader, lightmap, and must have the same pointers set*/ - void (*BE_DrawMesh_List)(shader_t *shader, int nummeshes, struct mesh_s **mesh, struct vbo_s *vbo, struct texnums_s *texnums); - void (*BE_DrawMesh_Single)(shader_t *shader, struct mesh_s *meshchain, struct vbo_s *vbo, struct texnums_s *texnums); + void (*BE_DrawMesh_List)(shader_t *shader, int nummeshes, struct mesh_s **mesh, struct vbo_s *vbo, struct texnums_s *texnums, unsigned int be_flags); + void (*BE_DrawMesh_Single)(shader_t *shader, struct mesh_s *meshchain, struct vbo_s *vbo, struct texnums_s *texnums, unsigned int be_flags); 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 diff --git a/engine/client/p_classic.c b/engine/client/p_classic.c index f7b316f9c..25705fe6a 100644 --- a/engine/client/p_classic.c +++ b/engine/client/p_classic.c @@ -321,7 +321,7 @@ static void PClassic_DrawParticles(void) if (classicmesh.numvertexes >= BUFFERVERTS-3) { classicmesh.numindexes = classicmesh.numvertexes; - BE_DrawMesh_Single(classicshader, &classicmesh, NULL, &classicshader->defaulttextures); + BE_DrawMesh_Single(classicshader, &classicmesh, NULL, &classicshader->defaulttextures, 0); classicmesh.numvertexes = 0; } @@ -404,7 +404,7 @@ static void PClassic_DrawParticles(void) if (classicmesh.numvertexes) { classicmesh.numindexes = classicmesh.numvertexes; - BE_DrawMesh_Single(classicshader, &classicmesh, NULL, &classicshader->defaulttextures); + BE_DrawMesh_Single(classicshader, &classicmesh, NULL, &classicshader->defaulttextures, 0); classicmesh.numvertexes = 0; } diff --git a/engine/client/p_script.c b/engine/client/p_script.c index 03154c342..f5b72722b 100644 --- a/engine/client/p_script.c +++ b/engine/client/p_script.c @@ -3653,7 +3653,7 @@ static void GL_DrawTexturedParticle(int count, particle_t **plist, plooks_t *typ if (pscriptmesh.numvertexes >= BUFFERVERTS-4) { pscriptmesh.numindexes = pscriptmesh.numvertexes/4*6; - BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures, 0); pscriptmesh.numvertexes = 0; } @@ -3711,7 +3711,7 @@ static void GL_DrawTexturedParticle(int count, particle_t **plist, plooks_t *typ if (pscriptmesh.numvertexes) { pscriptmesh.numindexes = pscriptmesh.numvertexes/4*6; - BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures, 0); pscriptmesh.numvertexes = 0; } } @@ -3729,7 +3729,7 @@ static void GL_DrawTrifanParticle(int count, particle_t **plist, plooks_t *type) if (pscripttmesh.numvertexes >= BUFFERVERTS-3) { pscripttmesh.numindexes = pscripttmesh.numvertexes; - BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures, 0); pscripttmesh.numvertexes = 0; } @@ -3765,7 +3765,7 @@ static void GL_DrawTrifanParticle(int count, particle_t **plist, plooks_t *type) if (pscripttmesh.numvertexes) { pscripttmesh.numindexes = pscripttmesh.numvertexes; - BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures, 0); pscripttmesh.numvertexes = 0; } } @@ -3813,7 +3813,7 @@ static void GL_DrawTexturedSparkParticle(int count, particle_t **plist, plooks_t if (pscriptmesh.numvertexes >= BUFFERVERTS-4) { pscriptmesh.numindexes = pscriptmesh.numvertexes/4*6; - BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures, 0); pscriptmesh.numvertexes = 0; } @@ -3859,7 +3859,7 @@ static void GL_DrawTexturedSparkParticle(int count, particle_t **plist, plooks_t if (pscriptmesh.numvertexes) { pscriptmesh.numindexes = pscriptmesh.numvertexes/4*6; - BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures, 0); pscriptmesh.numvertexes = 0; } } @@ -3881,7 +3881,7 @@ static void GL_DrawParticleBeam(int count, beamseg_t **blist, plooks_t *type) if (pscriptmesh.numvertexes >= BUFFERVERTS-4) { pscriptmesh.numindexes = pscriptmesh.numvertexes/4*6; - BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures, 0); pscriptmesh.numvertexes = 0; } @@ -3918,7 +3918,7 @@ static void GL_DrawParticleBeam(int count, beamseg_t **blist, plooks_t *type) if (pscriptmesh.numvertexes) { pscriptmesh.numindexes = pscriptmesh.numvertexes/4*6; - BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscriptmesh, NULL, &type->shader->defaulttextures, 0); pscriptmesh.numvertexes = 0; } } @@ -3934,7 +3934,7 @@ static void GL_DrawClippedDecal(int count, clippeddecal_t **dlist, plooks_t *typ if (pscripttmesh.numvertexes >= BUFFERVERTS-3) { pscripttmesh.numindexes = pscripttmesh.numvertexes; - BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures, 0); pscripttmesh.numvertexes = 0; } @@ -3956,7 +3956,7 @@ static void GL_DrawClippedDecal(int count, clippeddecal_t **dlist, plooks_t *typ if (pscripttmesh.numvertexes) { pscripttmesh.numindexes = pscripttmesh.numvertexes; - BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures); + BE_DrawMesh_Single(type->shader, &pscripttmesh, NULL, &type->shader->defaulttextures, 0); pscripttmesh.numvertexes = 0; } } diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index a7543df6b..29aef255f 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -392,7 +392,8 @@ void QCBUILTIN PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_gl #define DRAWFLAG_MODULATE 2 #define DRAWFLAG_MODULATE2 3 -static void PF_SelectDPDrawFlag(int flag) +extern unsigned int r2d_be_flags; +static unsigned int PF_SelectDPDrawFlag(int flag) { //flags: //0 = blend @@ -400,9 +401,9 @@ static void PF_SelectDPDrawFlag(int flag) //2 = modulate //3 = modulate*2 if (flag == 1) - BE_SelectMode(BEM_STANDARD, BEF_FORCEADDITIVE); + return BEF_FORCEADDITIVE; else - BE_SelectMode(BEM_STANDARD, BEF_FORCETRANSPARENT); + return BEF_FORCETRANSPARENT; } //float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456; @@ -421,10 +422,10 @@ void QCBUILTIN PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globa if (!p) p = R2D_SafePicFromWad(picname); - PF_SelectDPDrawFlag(flag); + r2d_be_flags = PF_SelectDPDrawFlag(flag); R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha); R2D_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p); - BE_SelectMode(BEM_STANDARD, 0); + r2d_be_flags = 0; G_FLOAT(OFS_RETURN) = 1; } @@ -444,14 +445,14 @@ void QCBUILTIN PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_gl p = R2D_SafeCachePic(picname); - PF_SelectDPDrawFlag(flag); + r2d_be_flags = PF_SelectDPDrawFlag(flag); R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha); R2D_Image( pos[0], pos[1], size[0], size[1], srcPos[0], srcPos[1], srcPos[0]+srcSize[0], srcPos[1]+srcSize[1], p); - BE_SelectMode(BEM_STANDARD, 0); + r2d_be_flags = 0; G_FLOAT(OFS_RETURN) = 1; } diff --git a/engine/client/r_2d.c b/engine/client/r_2d.c index 26abc02dd..92bf193d1 100644 --- a/engine/client/r_2d.c +++ b/engine/client/r_2d.c @@ -26,6 +26,7 @@ static vecV_t draw_mesh_xyz[4]; vec2_t draw_mesh_st[4]; static avec4_t draw_mesh_colors[4]; index_t r_quad_indexes[6] = {0, 1, 2, 2, 3, 0}; +unsigned int r2d_be_flags; extern cvar_t scr_conalpha; extern cvar_t gl_conback; @@ -326,7 +327,7 @@ void R2D_Image(float x, float y, float w, float h, float s1, float t1, float s2, draw_mesh_st[3][0] = s1; draw_mesh_st[3][1] = t2; - BE_DrawMesh_Single(pic, &draw_mesh, NULL, &pic->defaulttextures); + BE_DrawMesh_Single(pic, &draw_mesh, NULL, &pic->defaulttextures, r2d_be_flags); } /*draws a block of the current colour on the screen*/ @@ -345,9 +346,9 @@ void R2D_FillBlock(int x, int y, int w, int h) draw_mesh_xyz[3][1] = y+h; if (draw_mesh_colors[0][3] != 1) - BE_DrawMesh_Single(shader_draw_fill_trans, &draw_mesh, NULL, &shader_draw_fill_trans->defaulttextures); + BE_DrawMesh_Single(shader_draw_fill_trans, &draw_mesh, NULL, &shader_draw_fill_trans->defaulttextures, r2d_be_flags); else - BE_DrawMesh_Single(shader_draw_fill, &draw_mesh, NULL, &shader_draw_fill->defaulttextures); + BE_DrawMesh_Single(shader_draw_fill, &draw_mesh, NULL, &shader_draw_fill->defaulttextures, r2d_be_flags); } void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic) @@ -502,7 +503,7 @@ void R2D_TileClear (int x, int y, int w, int h) draw_mesh_st[3][0] = newsl; draw_mesh_st[3][1] = newth; - BE_DrawMesh_Single(draw_backtile, &draw_mesh, NULL, &draw_backtile->defaulttextures); + BE_DrawMesh_Single(draw_backtile, &draw_mesh, NULL, &draw_backtile->defaulttextures, r2d_be_flags); } void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue) diff --git a/engine/d3d/d3d_backend.c b/engine/d3d/d3d_backend.c index cbde8a58e..e858a9844 100644 --- a/engine/d3d/d3d_backend.c +++ b/engine/d3d/d3d_backend.c @@ -1629,10 +1629,9 @@ static void BE_DrawMeshChain_Internal(void) } } -void D3DBE_SelectMode(backendmode_t mode, unsigned int flags) +void D3DBE_SelectMode(backendmode_t mode) { shaderstate.mode = mode; - shaderstate.flags = flags; } /*Generates an optimised vbo for each of the given model's textures*/ @@ -2085,7 +2084,7 @@ static void R_DrawLightning(entity_t *e) mesh.normals_array = NULL; mesh.numvertexes = 4; mesh.st_array = texcoords; - BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL); + BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL, 0); } //q3 railgun beam static void R_DrawRailCore(entity_t *e) @@ -2146,7 +2145,7 @@ static void R_DrawRailCore(entity_t *e) mesh.numvertexes = 4; mesh.st_array = texcoords; - BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL); + BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL, 0); } #endif static void BE_GenModelBatches(batch_t **batches) @@ -2514,7 +2513,7 @@ static void BE_SubmitMeshesPortals(batch_t **worldlist, batch_t *dynamiclist) /*draw already-drawn portals as depth-only, to ensure that their contents are not harmed*/ - BE_SelectMode(BEM_DEPTHONLY, 0); + BE_SelectMode(BEM_DEPTHONLY); for (old = worldlist[SHADER_SORT_PORTAL]; old && old != batch; old = old->next) { if (old->meshes == old->firstmesh) @@ -2530,7 +2529,7 @@ static void BE_SubmitMeshesPortals(batch_t **worldlist, batch_t *dynamiclist) BE_SubmitBatch(old); } } - BE_SelectMode(BEM_STANDARD, 0); + BE_SelectMode(BEM_STANDARD); R_DrawPortal(batch, worldlist); @@ -2593,7 +2592,7 @@ void D3DBE_DrawWorld (qbyte *vis) r_worldentity.axis[1][1] = 1; r_worldentity.axis[2][2] = 1; - BE_SelectMode(BEM_STANDARD, 0); + BE_SelectMode(BEM_STANDARD); RSpeedRemark(); BE_SubmitMeshes(true, batches); diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 0a84eaa74..5175dd7de 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -439,7 +439,7 @@ void GL_SetShaderState2D(qboolean is2d) else qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); #endif - BE_SelectMode(BEM_STANDARD, 0); + BE_SelectMode(BEM_STANDARD); } void GL_SelectTexture(int target) @@ -753,7 +753,7 @@ void BE_SetupForShadowMap(void) shaderstate.shaderbits |= SBITS_MISC_DEPTHWRITE; // qglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - BE_SelectMode(BEM_DEPTHONLY, 0); + BE_SelectMode(BEM_DEPTHONLY); } #endif @@ -2561,12 +2561,13 @@ qboolean GLBE_LightCullModel(vec3_t org, model_t *model) } //Note: Be cautious about using BEM_LIGHT here. -void GLBE_SelectMode(backendmode_t mode, unsigned int flags) +void GLBE_SelectMode(backendmode_t mode) { extern int gldepthfunc; if (mode != shaderstate.mode) { + shaderstate.mode = mode; #ifdef RTLIGHTS if (mode == BEM_STENCIL) { @@ -2649,8 +2650,6 @@ void GLBE_SelectMode(backendmode_t mode, unsigned int flags) } #endif } - shaderstate.mode = mode; - shaderstate.flags = flags; } void GLBE_SelectEntity(entity_t *ent) @@ -2898,13 +2897,14 @@ static void DrawMeshes(void) } } -void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_t *vbo, texnums_t *texnums) +void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_t *vbo, texnums_t *texnums, unsigned int beflags) { if (!vbo) { mesh_t *m; shaderstate.sourcevbo = &shaderstate.dummyvbo; shaderstate.curshader = shader; + shaderstate.flags = beflags; if (shaderstate.curentity != &r_worldentity) { BE_SelectEntity(&r_worldentity); @@ -2936,6 +2936,7 @@ void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_ { shaderstate.sourcevbo = vbo; shaderstate.curshader = shader; + shaderstate.flags = beflags; if (shaderstate.curentity != &r_worldentity) { BE_SelectEntity(&r_worldentity); @@ -2950,10 +2951,10 @@ void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_ DrawMeshes(); } } -void GLBE_DrawMesh_Single(shader_t *shader, mesh_t *mesh, vbo_t *vbo, texnums_t *texnums) +void GLBE_DrawMesh_Single(shader_t *shader, mesh_t *mesh, vbo_t *vbo, texnums_t *texnums, unsigned int beflags) { shader->next = NULL; - BE_DrawMesh_List(shader, 1, &mesh, NULL, texnums); + BE_DrawMesh_List(shader, 1, &mesh, NULL, texnums, beflags); } void BE_DrawPolys(qboolean decalsset) @@ -2976,7 +2977,7 @@ void BE_DrawPolys(qboolean decalsset) m.indexes = cl_strisidx + cl_stris[i].firstidx; m.numindexes = cl_stris[i].numidx; m.numvertexes = cl_stris[i].numvert; - BE_DrawMesh_Single(cl_stris[i].shader, &m, NULL, &cl_stris[i].shader->defaulttextures); + BE_DrawMesh_Single(cl_stris[i].shader, &m, NULL, &cl_stris[i].shader->defaulttextures, 0); } } void GLBE_SubmitBatch(batch_t *batch) @@ -3014,12 +3015,12 @@ void GLBE_SubmitBatch(batch_t *batch) } shaderstate.curshader = batch->shader; + shaderstate.flags = batch->flags; if (shaderstate.curentity != batch->ent) { BE_SelectEntity(batch->ent); shaderstate.curtime = r_refdef.time - shaderstate.curentity->shaderTime; } - shaderstate.flags = batch->flags; if (batch->skin) shaderstate.curtexnums = batch->skin; else @@ -3064,7 +3065,7 @@ static void BE_SubmitMeshesPortals(batch_t **worldlist, batch_t *dynamiclist) /*draw already-drawn portals as depth-only, to ensure that their contents are not harmed*/ - BE_SelectMode(BEM_DEPTHONLY, 0); + BE_SelectMode(BEM_DEPTHONLY); for (old = worldlist[SHADER_SORT_PORTAL]; old && old != batch; old = old->next) { if (old->meshes == old->firstmesh) @@ -3080,7 +3081,7 @@ static void BE_SubmitMeshesPortals(batch_t **worldlist, batch_t *dynamiclist) BE_SubmitBatch(old); } } - BE_SelectMode(BEM_STANDARD, 0); + BE_SelectMode(BEM_STANDARD); GLR_DrawPortal(batch, worldlist); @@ -3325,9 +3326,9 @@ void GLBE_DrawWorld (qbyte *vis) shaderstate.identitylighting = 1; if (shaderstate.identitylighting == 0) - BE_SelectMode(BEM_DEPTHDARK, 0); + BE_SelectMode(BEM_DEPTHDARK); else - BE_SelectMode(BEM_STANDARD, 0); + BE_SelectMode(BEM_STANDARD); RSpeedRemark(); GLBE_SubmitMeshes(true, batches); @@ -3344,7 +3345,7 @@ void GLBE_DrawWorld (qbyte *vis) if (r_refdef.gfog_alpha) { - BE_SelectMode(BEM_FOG, 0); + BE_SelectMode(BEM_FOG); BE_SelectFog(r_refdef.gfog_rgb, r_refdef.gfog_alpha, r_refdef.gfog_density); GLBE_SubmitMeshes(true, batches); } diff --git a/engine/gl/gl_font.c b/engine/gl/gl_font.c index 3ff3aa29a..a352c6b49 100644 --- a/engine/gl/gl_font.c +++ b/engine/gl/gl_font.c @@ -300,10 +300,10 @@ static void Font_Flush(void) font_backmesh.numvertexes = font_foremesh.numvertexes; font_backmesh.istrifan = font_foremesh.istrifan; - BE_DrawMesh_Single(fontplanes.backshader, &font_backmesh, NULL, &fontplanes.backshader->defaulttextures); + BE_DrawMesh_Single(fontplanes.backshader, &font_backmesh, NULL, &fontplanes.backshader->defaulttextures, 0); } fontplanes.shader->defaulttextures.base = font_texture; - BE_DrawMesh_Single(fontplanes.shader, &font_foremesh, NULL, &fontplanes.shader->defaulttextures); + BE_DrawMesh_Single(fontplanes.shader, &font_foremesh, NULL, &fontplanes.shader->defaulttextures, 0); font_foremesh.numindexes = 0; font_foremesh.numvertexes = 0; } diff --git a/engine/gl/gl_rlight.c b/engine/gl/gl_rlight.c index d79977f2b..c9c9e0e37 100644 --- a/engine/gl/gl_rlight.c +++ b/engine/gl/gl_rlight.c @@ -156,7 +156,7 @@ void R_InitFlashblends(void) ); } -void R_RenderDlight (dlight_t *light) +void R_RenderDlight (dlight_t *light, unsigned int beflags) { int i, j; // float a; @@ -205,7 +205,7 @@ void R_RenderDlight (dlight_t *light) bub_cos++; } - BE_DrawMesh_Single(flashblend_shader, &flashblend_mesh, NULL, &flashblend_shader->defaulttextures); + BE_DrawMesh_Single(flashblend_shader, &flashblend_mesh, NULL, &flashblend_shader->defaulttextures, beflags); } /* @@ -218,6 +218,7 @@ void GLR_RenderDlights (void) int i; dlight_t *l; vec3_t waste1, waste2; + unsigned int beflags = 0; switch(r_flashblend.ival) { @@ -225,10 +226,9 @@ void GLR_RenderDlights (void) return; default: case 1: - BE_SelectMode(BEM_STANDARD, 0); break; case 2: - BE_SelectMode(BEM_STANDARD, BEF_FORCENODEPTH); + beflags |= BEF_FORCENODEPTH; break; } @@ -252,10 +252,8 @@ void GLR_RenderDlights (void) if (TraceLineN(r_refdef.vieworg, l->origin, waste1, waste2)) continue; } - R_RenderDlight (l); + R_RenderDlight (l, beflags); } - - BE_SelectMode(BEM_STANDARD, 0); } #endif diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index cd420a6be..fd1af6bb4 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -572,7 +572,6 @@ void R_DrawSpriteModel (entity_t *e) fl |= BEF_FORCETRANSPARENT; if (e->flags & RF_NODEPTHTEST) fl |= BEF_FORCENODEPTH; - BE_SelectMode(BEM_STANDARD, fl); VectorMA (sprorigin, frame->down, up, point); VectorMA (point, frame->left, right, vertcoords[0]); @@ -599,7 +598,7 @@ void R_DrawSpriteModel (entity_t *e) mesh.numvertexes = 4; mesh.st_array = texcoords; mesh.istrifan = true; - BE_DrawMesh_Single(frame->shader, &mesh, NULL, &frame->shader->defaulttextures); + BE_DrawMesh_Single(frame->shader, &mesh, NULL, &frame->shader->defaulttextures, fl); } //================================================================================== @@ -671,7 +670,7 @@ void R_DrawLightning(entity_t *e) mesh.normals_array = NULL; mesh.numvertexes = 4; mesh.st_array = texcoords; - BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL); + BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL, 0); } //q3 railgun beam void R_DrawRailCore(entity_t *e) @@ -732,7 +731,7 @@ void R_DrawRailCore(entity_t *e) mesh.numvertexes = 4; mesh.st_array = texcoords; - BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL); + BE_DrawMesh_Single(e->forcedshader, &mesh, NULL, NULL, 0); } #endif @@ -812,7 +811,7 @@ shader_t *beamshader; mesh.normals_array = NULL; mesh.numvertexes = sizeof(points)/sizeof(points[0]); mesh.st_array = texcoords; - BE_DrawMesh_Single(beamshader, &mesh, NULL, &beamshader->defaulttextures); + BE_DrawMesh_Single(beamshader, &mesh, NULL, &beamshader->defaulttextures, 0); } /* diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 5a8724486..acdc1fce0 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -3472,7 +3472,7 @@ void Shader_DefaultBSPQ2(char *shortname, shader_t *s, const void *args) "program defaultwarp\n" "{\n" "map $diffuse\n" - "tcmod turb 0 0 3 0.1\n" + "tcmod turb 0 0.01 0.5 0\n" "}\n" "}\n" ); @@ -3604,7 +3604,7 @@ void Shader_DefaultBSPQ1(char *shortname, shader_t *s, const void *args) "program defaultwarp\n" "{\n" "map $diffuse\n" - "tcmod turb 0 0 3 0.1\n" + "tcmod turb 0.02 0.1 0.5 0.1\n" "if r_wateralpha != 1\n" "[\n" "alphagen const $r_wateralpha\n" diff --git a/engine/gl/gl_shadow.c b/engine/gl/gl_shadow.c index 3b9a63509..0fb22d086 100644 --- a/engine/gl/gl_shadow.c +++ b/engine/gl/gl_shadow.c @@ -1334,10 +1334,10 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float p if (!smesh->litsurfs[tno].count) continue; tex = cl.worldmodel->textures[tno]; - BE_DrawMesh_List(tex->shader, smesh->litsurfs[tno].count, smesh->litsurfs[tno].s, &tex->vbo, &tex->shader->defaulttextures); + BE_DrawMesh_List(tex->shader, smesh->litsurfs[tno].count, smesh->litsurfs[tno].s, &tex->vbo, &tex->shader->defaulttextures, 0); } - BE_SelectMode(BEM_DEPTHONLY, 0); + BE_SelectMode(BEM_DEPTHONLY); BE_BaseEntTextures(); if (0) @@ -1550,7 +1550,7 @@ static void Sh_DrawShadowMapLight(dlight_t *l, vec3_t colour, qbyte *vvis) ve = 0; BE_SelectDLight(l, colour); - BE_SelectMode(l->fov?BEM_SMAPLIGHTSPOT:BEM_SMAPLIGHT, 0); + BE_SelectMode(l->fov?BEM_SMAPLIGHTSPOT:BEM_SMAPLIGHT); Sh_DrawEntLighting(l, colour); GL_SelectTexture(7); @@ -1612,7 +1612,7 @@ static void Sh_DrawEntLighting(dlight_t *light, vec3_t colour) tex = cl.worldmodel->textures[tno]; if (tex->shader->flags & SHADER_NODLIGHT) continue; - BE_DrawMesh_List(tex->shader, sm->litsurfs[tno].count, sm->litsurfs[tno].s, &tex->vbo, &tex->shader->defaulttextures); + BE_DrawMesh_List(tex->shader, sm->litsurfs[tno].count, sm->litsurfs[tno].s, &tex->vbo, &tex->shader->defaulttextures, 0); } BE_BaseEntTextures(); @@ -1852,7 +1852,7 @@ static qboolean Sh_DrawStencilLight(dlight_t *dl, vec3_t colour, qbyte *vvis) bench.numlights++; BE_SelectDLight(dl, colour); - BE_SelectMode(BEM_STENCIL, 0); + BE_SelectMode(BEM_STENCIL); //The backend doesn't maintain scissor state. // qglEnable(GL_SCISSOR_TEST); @@ -1986,7 +1986,7 @@ static qboolean Sh_DrawStencilLight(dlight_t *dl, vec3_t colour, qbyte *vvis) PPL_RevertToKnownState(); - BE_SelectMode(BEM_LIGHT, 0); + BE_SelectMode(BEM_LIGHT); Sh_DrawEntLighting(dl, colour); qglDisable(GL_STENCIL_TEST); @@ -2052,7 +2052,7 @@ static void Sh_DrawShadowlessLight(dlight_t *dl, vec3_t colour, qbyte *vvis) bench.numlights++; BE_SelectDLight(dl, colour); - BE_SelectMode(BEM_LIGHT, 0); + BE_SelectMode(BEM_LIGHT); Sh_DrawEntLighting(dl, colour); } @@ -2132,7 +2132,7 @@ void Sh_DrawLights(qbyte *vis) } qglDisable(GL_SCISSOR_TEST); - BE_SelectMode(BEM_STANDARD, 0); + BE_SelectMode(BEM_STANDARD); // if (developer.value) // Con_Printf("%i lights drawn, %i frustum culled, %i pvs culled, %i scissor culled\n", bench.numlights, bench.numfrustumculled, bench.numpvsculled, bench.numscissorculled); diff --git a/engine/gl/gl_warp.c b/engine/gl/gl_warp.c index 046a3692a..f64adc559 100644 --- a/engine/gl/gl_warp.c +++ b/engine/gl/gl_warp.c @@ -449,9 +449,9 @@ static void GL_SkyForceDepth(batch_t *batch) { if (!cls.allow_skyboxes) //allow a little extra fps. { - BE_SelectMode(BEM_DEPTHONLY, 0); - BE_DrawMesh_List(batch->shader, batch->meshes-batch->firstmesh, batch->mesh+batch->firstmesh, &batch->texture->vbo, &batch->shader->defaulttextures); - BE_SelectMode(BEM_STANDARD, 0); /*skys only render in standard mode anyway, so this is safe*/ + BE_SelectMode(BEM_DEPTHONLY); + BE_DrawMesh_List(batch->shader, batch->meshes-batch->firstmesh, batch->mesh+batch->firstmesh, &batch->texture->vbo, &batch->shader->defaulttextures, batch->flags); + BE_SelectMode(BEM_STANDARD); /*skys only render in standard mode anyway, so this is safe*/ } } diff --git a/engine/gl/shader.h b/engine/gl/shader.h index 1ffdc32d0..f88193b9c 100644 --- a/engine/gl/shader.h +++ b/engine/gl/shader.h @@ -434,9 +434,9 @@ mfog_t *CM_FogForOrigin(vec3_t org); #ifdef GLQUAKE void GLBE_Init(void); -void GLBE_SelectMode(backendmode_t mode, unsigned int flags); -void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **mesh, vbo_t *vbo, texnums_t *texnums); -void GLBE_DrawMesh_Single(shader_t *shader, mesh_t *meshchain, vbo_t *vbo, texnums_t *texnums); +void GLBE_SelectMode(backendmode_t mode); +void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **mesh, vbo_t *vbo, texnums_t *texnums, unsigned int beflags); +void GLBE_DrawMesh_Single(shader_t *shader, mesh_t *meshchain, vbo_t *vbo, texnums_t *texnums, unsigned int beflags); void GLBE_SubmitBatch(batch_t *batch); batch_t *GLBE_GetTempBatch(void); void GLBE_GenBrushModelVBO(model_t *mod); @@ -448,7 +448,7 @@ void GLBE_SelectEntity(entity_t *ent); #endif #ifdef D3DQUAKE void D3DBE_Init(void); -void D3DBE_SelectMode(backendmode_t mode, unsigned int flags); +void D3DBE_SelectMode(backendmode_t mode); void D3DBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **mesh, vbo_t *vbo, texnums_t *texnums); void D3DBE_DrawMesh_Single(shader_t *shader, mesh_t *meshchain, vbo_t *vbo, texnums_t *texnums); void D3DBE_SubmitBatch(batch_t *batch); diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 3b6cfe318..1268e4110 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -231,7 +231,12 @@ void SV_New_f (void) gamedir = Info_ValueForKey (svs.info, "*gamedir"); if (!gamedir[0] || !strcmp(gamedir, "fte")) - gamedir = "qw"; + { + if (ISQWCLIENT(host_client)) + gamedir = "qw"; + else + gamedir = ""; + } //NOTE: This doesn't go through ClientReliableWrite since it's before the user //spawns. These functions are written to not overflow