make current model local

This commit is contained in:
Denis Pauk 2020-09-13 12:21:37 +03:00 committed by Yamagi
parent 832d9666d4
commit 3648ef0866
5 changed files with 23 additions and 30 deletions

View file

@ -104,7 +104,6 @@ extern image_t *r_notexture;
extern image_t *r_particletexture;
extern image_t *r_squaretexture;
extern entity_t *currententity;
extern model_t *currentmodel;
extern int r_visframecount;
extern int r_framecount;
extern cplane_t frustum[4];
@ -192,9 +191,9 @@ extern qvksampler_t vk_current_lmap_sampler;
void R_Shutdown( void );
void Vk_ScreenShot_f (void);
void R_DrawAliasModel (entity_t *e);
void R_DrawBrushModel (entity_t *e);
void R_DrawSpriteModel (entity_t *e);
void R_DrawAliasModel (entity_t *e, model_t *currentmodel);
void R_DrawBrushModel (entity_t *e, model_t *currentmodel);
void R_DrawSpriteModel (entity_t *e, model_t *currentmodel);
void R_DrawBeam( entity_t *e );
void R_DrawWorld (void);
void R_RenderDlights (void);

View file

@ -401,7 +401,7 @@ static void Vk_DrawAliasShadow (dmdl_t *paliashdr, int posenum, float *modelMatr
/*
** R_CullAliasModel
*/
static qboolean R_CullAliasModel( vec3_t bbox[8], entity_t *e )
static qboolean R_CullAliasModel( vec3_t bbox[8], entity_t *e, model_t *currentmodel )
{
int i;
vec3_t mins, maxs;
@ -547,7 +547,7 @@ R_DrawAliasModel
=================
*/
void R_DrawAliasModel (entity_t *e)
void R_DrawAliasModel (entity_t *e, model_t *currentmodel)
{
int i;
int leftHandOffset = 0;
@ -558,7 +558,7 @@ void R_DrawAliasModel (entity_t *e)
if ( !( e->flags & RF_WEAPONMODEL ) )
{
if ( R_CullAliasModel( bbox, e ) )
if ( R_CullAliasModel( bbox, e, currentmodel ) )
return;
}

View file

@ -505,7 +505,7 @@ static void CalcSurfaceExtents (msurface_t *s)
}
void Vk_BuildPolygonFromSurface(msurface_t *fa);
void Vk_BuildPolygonFromSurface(msurface_t *fa, model_t *currentmodel);
void Vk_CreateSurfaceLightmap (msurface_t *surf);
void Vk_EndBuildingLightmaps (void);
void Vk_BeginBuildingLightmaps (model_t *m);
@ -530,8 +530,6 @@ static void Mod_LoadFaces (lump_t *l)
loadmodel->surfaces = out;
loadmodel->numsurfaces = count;
currentmodel = loadmodel;
Vk_BeginBuildingLightmaps(loadmodel);
for (surfnum = 0; surfnum<count; surfnum++, in++, out++)
@ -587,7 +585,7 @@ static void Mod_LoadFaces (lump_t *l)
Vk_CreateSurfaceLightmap(out);
if (!(out->texinfo->flags & SURF_WARP))
Vk_BuildPolygonFromSurface(out);
Vk_BuildPolygonFromSurface(out, loadmodel);
}
@ -840,14 +838,13 @@ static void Mod_LoadBrushModel (model_t *mod, void *buffer)
if (i != BSPVERSION)
ri.Sys_Error (ERR_DROP, "%s: %s has wrong version number (%i should be %i)", __func__, mod->name, i, BSPVERSION);
// swap all the lumps
// swap all the lumps
mod_base = (byte *)header;
for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
// load into heap
// load into heap
Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]);
Mod_LoadEdges (&header->lumps[LUMP_EDGES]);
Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]);

View file

@ -41,7 +41,6 @@ image_t *r_particletexture; // little dot for particles
image_t *r_squaretexture; // rectangle for particles
entity_t *currententity;
model_t *currentmodel;
cplane_t frustum[4];
@ -177,7 +176,7 @@ R_DrawSpriteModel
=================
*/
void R_DrawSpriteModel (entity_t *e)
void R_DrawSpriteModel (entity_t *e, model_t *currentmodel)
{
float alpha = 1.0F;
vec3_t point;
@ -337,7 +336,7 @@ void R_DrawEntitiesOnList (void)
}
else
{
currentmodel = currententity->model;
model_t *currentmodel = currententity->model;
if (!currentmodel)
{
R_DrawNullModel();
@ -346,13 +345,13 @@ void R_DrawEntitiesOnList (void)
switch (currentmodel->type)
{
case mod_alias:
R_DrawAliasModel(currententity);
R_DrawAliasModel(currententity, currentmodel);
break;
case mod_brush:
R_DrawBrushModel(currententity);
R_DrawBrushModel(currententity, currentmodel);
break;
case mod_sprite:
R_DrawSpriteModel(currententity);
R_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "%s, Bad modeltype", __func__);
@ -375,7 +374,7 @@ void R_DrawEntitiesOnList (void)
}
else
{
currentmodel = currententity->model;
model_t *currentmodel = currententity->model;
if (!currentmodel)
{
@ -385,13 +384,13 @@ void R_DrawEntitiesOnList (void)
switch (currentmodel->type)
{
case mod_alias:
R_DrawAliasModel(currententity);
R_DrawAliasModel(currententity, currentmodel);
break;
case mod_brush:
R_DrawBrushModel(currententity);
R_DrawBrushModel(currententity, currentmodel);
break;
case mod_sprite:
R_DrawSpriteModel(currententity);
R_DrawSpriteModel(currententity, currentmodel);
break;
default:
ri.Sys_Error(ERR_DROP, "%s, Bad modeltype", __func__);

View file

@ -685,7 +685,7 @@ static void Vk_RenderLightmappedPoly( msurface_t *surf, float *modelMatrix, floa
R_DrawInlineBModel
=================
*/
static void R_DrawInlineBModel (float *modelMatrix)
static void R_DrawInlineBModel (float *modelMatrix, model_t *currentmodel)
{
int i;
msurface_t *psurf;
@ -750,7 +750,7 @@ static void R_DrawInlineBModel (float *modelMatrix)
R_DrawBrushModel
=================
*/
void R_DrawBrushModel (entity_t *e)
void R_DrawBrushModel (entity_t *e, model_t *currentmodel)
{
vec3_t mins, maxs;
qboolean rotated;
@ -804,7 +804,7 @@ void R_DrawBrushModel (entity_t *e)
e->angles[0] = -e->angles[0]; // stupid quake bug
e->angles[2] = -e->angles[2]; // stupid quake bug
R_DrawInlineBModel(model);
R_DrawInlineBModel(model, currentmodel);
}
/*
@ -956,8 +956,6 @@ void R_DrawWorld (void)
if ( r_newrefdef.rdflags & RDF_NOWORLDMODEL )
return;
currentmodel = r_worldmodel;
VectorCopy (r_newrefdef.vieworg, modelorg);
// auto cycle the world frame for texture animation
@ -1159,7 +1157,7 @@ static qboolean LM_AllocBlock (int w, int h, int *x, int *y)
Vk_BuildPolygonFromSurface
================
*/
void Vk_BuildPolygonFromSurface(msurface_t *fa)
void Vk_BuildPolygonFromSurface(msurface_t *fa, model_t *currentmodel)
{
int i, lnumverts;
medge_t *pedges, *r_pedge;