gl1: use local currentmodel

This commit is contained in:
Denis Pauk 2021-09-20 12:56:18 +03:00
parent 93ab5896e9
commit 46c654b379
5 changed files with 14 additions and 20 deletions

View file

@ -118,7 +118,7 @@ GL3_LM_AllocBlock(int w, int h, int *x, int *y)
}
void
GL3_LM_BuildPolygonFromSurface(msurface_t *fa)
GL3_LM_BuildPolygonFromSurface(gl3model_t *currentmodel, msurface_t *fa)
{
int i, lindex, lnumverts;
medge_t *pedges, *r_pedge;

View file

@ -50,7 +50,6 @@ refdef_t gl3_newrefdef;
viddef_t vid;
gl3model_t *gl3_worldmodel;
gl3model_t *currentmodel;
entity_t *currententity;
float gl3depthmin=0.0f, gl3depthmax=1.0f;
@ -773,7 +772,7 @@ GL3_DrawBeam(entity_t *e)
}
static void
GL3_DrawSpriteModel(entity_t *e)
GL3_DrawSpriteModel(entity_t *e, gl3model_t *currentmodel)
{
float alpha = 1.0F;
gl3_3D_vtx_t verts[4];
@ -990,7 +989,7 @@ GL3_DrawEntitiesOnList(void)
}
else
{
currentmodel = currententity->model;
gl3model_t *currentmodel = currententity->model;
if (!currentmodel)
{
@ -1004,10 +1003,10 @@ GL3_DrawEntitiesOnList(void)
GL3_DrawAliasModel(currententity);
break;
case mod_brush:
GL3_DrawBrushModel(currententity);
GL3_DrawBrushModel(currententity, currentmodel);
break;
case mod_sprite:
GL3_DrawSpriteModel(currententity);
GL3_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");
@ -1036,7 +1035,7 @@ GL3_DrawEntitiesOnList(void)
}
else
{
currentmodel = currententity->model;
gl3model_t *currentmodel = currententity->model;
if (!currentmodel)
{
@ -1050,10 +1049,10 @@ GL3_DrawEntitiesOnList(void)
GL3_DrawAliasModel(currententity);
break;
case mod_brush:
GL3_DrawBrushModel(currententity);
GL3_DrawBrushModel(currententity, currentmodel);
break;
case mod_sprite:
GL3_DrawSpriteModel(currententity);
GL3_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "Bad modeltype");

View file

@ -543,8 +543,6 @@ Mod_LoadFaces(gl3model_t *loadmodel, byte *mod_base, lump_t *l)
loadmodel->surfaces = out;
loadmodel->numsurfaces = count;
currentmodel = loadmodel;
GL3_LM_BeginBuildingLightmaps(loadmodel);
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
@ -623,7 +621,7 @@ Mod_LoadFaces(gl3model_t *loadmodel, byte *mod_base, lump_t *l)
if (!(out->texinfo->flags & SURF_WARP))
{
GL3_LM_BuildPolygonFromSurface(out);
GL3_LM_BuildPolygonFromSurface(loadmodel, out);
}
}

View file

@ -526,7 +526,7 @@ RenderLightmappedPoly(msurface_t *surf)
}
static void
DrawInlineBModel(void)
DrawInlineBModel(gl3model_t *currentmodel)
{
int i, k;
cplane_t *pplane;
@ -590,7 +590,7 @@ DrawInlineBModel(void)
}
void
GL3_DrawBrushModel(entity_t *e)
GL3_DrawBrushModel(entity_t *e, gl3model_t *currentmodel)
{
vec3_t mins, maxs;
int i;
@ -656,7 +656,7 @@ GL3_DrawBrushModel(entity_t *e)
e->angles[0] = -e->angles[0];
e->angles[2] = -e->angles[2];
DrawInlineBModel();
DrawInlineBModel(currentmodel);
// glPopMatrix();
gl3state.uni3DData.transModelMat4 = oldMat;
@ -824,8 +824,6 @@ GL3_DrawWorld(void)
return;
}
currentmodel = gl3_worldmodel;
VectorCopy(gl3_newrefdef.vieworg, modelorg);
/* auto cycle the world frame for texture animation */

View file

@ -300,7 +300,6 @@ typedef struct
} gl3lightmapstate_t;
extern gl3model_t *gl3_worldmodel;
extern gl3model_t *currentmodel;
extern entity_t *currententity;
extern float gl3depthmin, gl3depthmax;
@ -436,7 +435,7 @@ extern void GL3_BuildLightMap(msurface_t *surf, int offsetInLMbuf, int stride);
extern void GL3_LM_InitBlock(void);
extern void GL3_LM_UploadBlock(void);
extern qboolean GL3_LM_AllocBlock(int w, int h, int *x, int *y);
extern void GL3_LM_BuildPolygonFromSurface(msurface_t *fa);
extern void GL3_LM_BuildPolygonFromSurface(gl3model_t *currentmodel, msurface_t *fa);
extern void GL3_LM_CreateSurfaceLightmap(msurface_t *surf);
extern void GL3_LM_BeginBuildingLightmaps(gl3model_t *m);
extern void GL3_LM_EndBuildingLightmaps(void);
@ -458,7 +457,7 @@ extern void GL3_DrawGLPoly(msurface_t *fa);
extern void GL3_DrawGLFlowingPoly(msurface_t *fa);
extern void GL3_DrawTriangleOutlines(void);
extern void GL3_DrawAlphaSurfaces(void);
extern void GL3_DrawBrushModel(entity_t *e);
extern void GL3_DrawBrushModel(entity_t *e, gl3model_t *currentmodel);
extern void GL3_DrawWorld(void);
extern void GL3_MarkLeaves(void);