mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-29 15:51:45 +00:00
gl3: make currententity local
This commit is contained in:
parent
46c654b379
commit
7576d2d300
5 changed files with 30 additions and 36 deletions
|
@ -252,7 +252,7 @@ RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
|
|||
}
|
||||
|
||||
void
|
||||
GL3_LightPoint(vec3_t p, vec3_t color)
|
||||
GL3_LightPoint(entity_t *currententity, vec3_t p, vec3_t color)
|
||||
{
|
||||
vec3_t end;
|
||||
float r;
|
||||
|
|
|
@ -50,7 +50,6 @@ refdef_t gl3_newrefdef;
|
|||
|
||||
viddef_t vid;
|
||||
gl3model_t *gl3_worldmodel;
|
||||
entity_t *currententity;
|
||||
|
||||
float gl3depthmin=0.0f, gl3depthmax=1.0f;
|
||||
|
||||
|
@ -851,7 +850,7 @@ GL3_DrawSpriteModel(entity_t *e, gl3model_t *currentmodel)
|
|||
}
|
||||
|
||||
static void
|
||||
GL3_DrawNullModel(void)
|
||||
GL3_DrawNullModel(entity_t *currententity)
|
||||
{
|
||||
vec3_t shadelight;
|
||||
|
||||
|
@ -861,7 +860,7 @@ GL3_DrawNullModel(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
GL3_LightPoint(currententity->origin, shadelight);
|
||||
GL3_LightPoint(currententity, currententity->origin, shadelight);
|
||||
}
|
||||
|
||||
hmm_mat4 origModelMat = gl3state.uni3DData.transModelMat4;
|
||||
|
@ -976,7 +975,7 @@ GL3_DrawEntitiesOnList(void)
|
|||
/* draw non-transparent first */
|
||||
for (i = 0; i < gl3_newrefdef.num_entities; i++)
|
||||
{
|
||||
currententity = &gl3_newrefdef.entities[i];
|
||||
entity_t *currententity = &gl3_newrefdef.entities[i];
|
||||
|
||||
if (currententity->flags & RF_TRANSLUCENT)
|
||||
{
|
||||
|
@ -993,7 +992,7 @@ GL3_DrawEntitiesOnList(void)
|
|||
|
||||
if (!currentmodel)
|
||||
{
|
||||
GL3_DrawNullModel();
|
||||
GL3_DrawNullModel(currententity);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1022,7 +1021,7 @@ GL3_DrawEntitiesOnList(void)
|
|||
|
||||
for (i = 0; i < gl3_newrefdef.num_entities; i++)
|
||||
{
|
||||
currententity = &gl3_newrefdef.entities[i];
|
||||
entity_t *currententity = &gl3_newrefdef.entities[i];
|
||||
|
||||
if (!(currententity->flags & RF_TRANSLUCENT))
|
||||
{
|
||||
|
@ -1039,7 +1038,7 @@ GL3_DrawEntitiesOnList(void)
|
|||
|
||||
if (!currentmodel)
|
||||
{
|
||||
GL3_DrawNullModel();
|
||||
GL3_DrawNullModel(currententity);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1579,7 +1578,7 @@ GL3_GetSpecialBufferModeForStereoMode(enum stereo_modes stereo_mode) {
|
|||
#endif // 0
|
||||
|
||||
static void
|
||||
GL3_SetLightLevel(void)
|
||||
GL3_SetLightLevel(entity_t *currententity)
|
||||
{
|
||||
vec3_t shadelight = {0};
|
||||
|
||||
|
@ -1589,7 +1588,7 @@ GL3_SetLightLevel(void)
|
|||
}
|
||||
|
||||
/* save off light value for server to look at */
|
||||
GL3_LightPoint(gl3_newrefdef.vieworg, shadelight);
|
||||
GL3_LightPoint(currententity, gl3_newrefdef.vieworg, shadelight);
|
||||
|
||||
/* pick the greatest component, which should be the
|
||||
* same as the mono value returned by software */
|
||||
|
@ -1621,7 +1620,7 @@ static void
|
|||
GL3_RenderFrame(refdef_t *fd)
|
||||
{
|
||||
GL3_RenderView(fd);
|
||||
GL3_SetLightLevel();
|
||||
GL3_SetLightLevel(NULL);
|
||||
GL3_SetGL2D();
|
||||
|
||||
if(v_blend[3] != 0.0f)
|
||||
|
|
|
@ -711,7 +711,7 @@ GL3_DrawAliasModel(entity_t *entity)
|
|||
}
|
||||
else
|
||||
{
|
||||
GL3_LightPoint(entity->origin, shadelight);
|
||||
GL3_LightPoint(entity, entity->origin, shadelight);
|
||||
|
||||
/* player lighting hack for communication back to server */
|
||||
if (entity->flags & RF_WEAPONMODEL)
|
||||
|
|
|
@ -159,7 +159,7 @@ CullBox(vec3_t mins, vec3_t maxs)
|
|||
* Returns the proper texture for a given time and base texture
|
||||
*/
|
||||
static gl3image_t *
|
||||
TextureAnimation(mtexinfo_t *tex)
|
||||
TextureAnimation(entity_t *currententity, mtexinfo_t *tex)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@ -337,14 +337,14 @@ UpdateLMscales(const hmm_vec4 lmScales[MAX_LIGHTMAPS_PER_SURFACE], gl3ShaderInfo
|
|||
}
|
||||
|
||||
static void
|
||||
RenderBrushPoly(msurface_t *fa)
|
||||
RenderBrushPoly(entity_t *currententity, msurface_t *fa)
|
||||
{
|
||||
int map;
|
||||
gl3image_t *image;
|
||||
|
||||
c_brush_polys++;
|
||||
|
||||
image = TextureAnimation(fa->texinfo);
|
||||
image = TextureAnimation(currententity, fa->texinfo);
|
||||
|
||||
if (fa->flags & SURF_DRAWTURB)
|
||||
{
|
||||
|
@ -449,7 +449,7 @@ GL3_DrawAlphaSurfaces(void)
|
|||
}
|
||||
|
||||
static void
|
||||
DrawTextureChains(void)
|
||||
DrawTextureChains(entity_t *currententity)
|
||||
{
|
||||
int i;
|
||||
msurface_t *s;
|
||||
|
@ -476,7 +476,7 @@ DrawTextureChains(void)
|
|||
for ( ; s; s = s->texturechain)
|
||||
{
|
||||
SetLightFlags(s);
|
||||
RenderBrushPoly(s);
|
||||
RenderBrushPoly(currententity, s);
|
||||
}
|
||||
|
||||
image->texturechain = NULL;
|
||||
|
@ -486,10 +486,10 @@ DrawTextureChains(void)
|
|||
}
|
||||
|
||||
static void
|
||||
RenderLightmappedPoly(msurface_t *surf)
|
||||
RenderLightmappedPoly(entity_t *currententity, msurface_t *surf)
|
||||
{
|
||||
int map;
|
||||
gl3image_t *image = TextureAnimation(surf->texinfo);
|
||||
gl3image_t *image = TextureAnimation(currententity, surf->texinfo);
|
||||
|
||||
hmm_vec4 lmScales[MAX_LIGHTMAPS_PER_SURFACE] = {0};
|
||||
lmScales[0] = HMM_Vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
@ -526,7 +526,7 @@ RenderLightmappedPoly(msurface_t *surf)
|
|||
}
|
||||
|
||||
static void
|
||||
DrawInlineBModel(gl3model_t *currentmodel)
|
||||
DrawInlineBModel(entity_t *currententity, gl3model_t *currentmodel)
|
||||
{
|
||||
int i, k;
|
||||
cplane_t *pplane;
|
||||
|
@ -574,11 +574,11 @@ DrawInlineBModel(gl3model_t *currentmodel)
|
|||
else if(!(psurf->flags & SURF_DRAWTURB))
|
||||
{
|
||||
SetAllLightFlags(psurf);
|
||||
RenderLightmappedPoly(psurf);
|
||||
RenderLightmappedPoly(currententity, psurf);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderBrushPoly(psurf);
|
||||
RenderBrushPoly(currententity, psurf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -601,7 +601,6 @@ GL3_DrawBrushModel(entity_t *e, gl3model_t *currentmodel)
|
|||
return;
|
||||
}
|
||||
|
||||
currententity = e;
|
||||
gl3state.currenttexture = -1;
|
||||
|
||||
if (e->angles[0] || e->angles[1] || e->angles[2])
|
||||
|
@ -656,7 +655,7 @@ GL3_DrawBrushModel(entity_t *e, gl3model_t *currentmodel)
|
|||
e->angles[0] = -e->angles[0];
|
||||
e->angles[2] = -e->angles[2];
|
||||
|
||||
DrawInlineBModel(currentmodel);
|
||||
DrawInlineBModel(e, currentmodel);
|
||||
|
||||
// glPopMatrix();
|
||||
gl3state.uni3DData.transModelMat4 = oldMat;
|
||||
|
@ -669,7 +668,7 @@ GL3_DrawBrushModel(entity_t *e, gl3model_t *currentmodel)
|
|||
}
|
||||
|
||||
static void
|
||||
RecursiveWorldNode(mnode_t *node)
|
||||
RecursiveWorldNode(entity_t *currententity, mnode_t *node)
|
||||
{
|
||||
int c, side, sidebit;
|
||||
cplane_t *plane;
|
||||
|
@ -755,7 +754,7 @@ RecursiveWorldNode(mnode_t *node)
|
|||
}
|
||||
|
||||
/* recurse down the children, front side first */
|
||||
RecursiveWorldNode(node->children[side]);
|
||||
RecursiveWorldNode(currententity, node->children[side]);
|
||||
|
||||
/* draw stuff */
|
||||
for (c = node->numsurfaces,
|
||||
|
@ -782,7 +781,7 @@ RecursiveWorldNode(mnode_t *node)
|
|||
/* add to the translucent chain */
|
||||
surf->texturechain = gl3_alpha_surfaces;
|
||||
gl3_alpha_surfaces = surf;
|
||||
gl3_alpha_surfaces->texinfo->image = TextureAnimation(surf->texinfo);
|
||||
gl3_alpha_surfaces->texinfo->image = TextureAnimation(currententity, surf->texinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -798,7 +797,7 @@ RecursiveWorldNode(mnode_t *node)
|
|||
#endif // 0
|
||||
{
|
||||
/* the polygon is visible, so add it to the texture sorted chain */
|
||||
image = TextureAnimation(surf->texinfo);
|
||||
image = TextureAnimation(currententity, surf->texinfo);
|
||||
surf->texturechain = image->texturechain;
|
||||
image->texturechain = surf;
|
||||
}
|
||||
|
@ -806,7 +805,7 @@ RecursiveWorldNode(mnode_t *node)
|
|||
}
|
||||
|
||||
/* recurse down the back side */
|
||||
RecursiveWorldNode(node->children[!side]);
|
||||
RecursiveWorldNode(currententity, node->children[!side]);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -829,17 +828,14 @@ GL3_DrawWorld(void)
|
|||
/* auto cycle the world frame for texture animation */
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
ent.frame = (int)(gl3_newrefdef.time * 2);
|
||||
currententity = &ent;
|
||||
|
||||
gl3state.currenttexture = -1;
|
||||
|
||||
GL3_ClearSkyBox();
|
||||
RecursiveWorldNode(gl3_worldmodel->nodes);
|
||||
DrawTextureChains();
|
||||
RecursiveWorldNode(&ent, gl3_worldmodel->nodes);
|
||||
DrawTextureChains(&ent);
|
||||
GL3_DrawSkyBox();
|
||||
DrawTriangleOutlines();
|
||||
|
||||
currententity = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -300,7 +300,6 @@ typedef struct
|
|||
} gl3lightmapstate_t;
|
||||
|
||||
extern gl3model_t *gl3_worldmodel;
|
||||
extern entity_t *currententity;
|
||||
|
||||
extern float gl3depthmin, gl3depthmax;
|
||||
|
||||
|
@ -426,7 +425,7 @@ extern void GL3_ImageList_f(void);
|
|||
// gl3_light.c
|
||||
extern void GL3_MarkLights(dlight_t *light, int bit, mnode_t *node);
|
||||
extern void GL3_PushDlights(void);
|
||||
extern void GL3_LightPoint(vec3_t p, vec3_t color);
|
||||
extern void GL3_LightPoint(entity_t *currententity, vec3_t p, vec3_t color);
|
||||
extern void GL3_BuildLightMap(msurface_t *surf, int offsetInLMbuf, int stride);
|
||||
|
||||
// gl3_lightmap.c
|
||||
|
|
Loading…
Reference in a new issue