[renderer] Clean up r_bsp a little

Move r_pcurrentvertbase into the sw renderer, cleaning up gl's use of
(not really needed there). Not ready to move r_bsp into the main bin yet
as there are linking issues since only the low-level code references any
of its symbols.
This commit is contained in:
Bill Currie 2022-03-17 13:09:20 +09:00
parent 7ee9159638
commit d8a4c8dbe9
8 changed files with 13 additions and 14 deletions

View file

@ -47,7 +47,6 @@ extern qboolean gl_lightmap_modified[MAX_LIGHTMAPS];
extern instsurf_t *gl_lightmap_polys[MAX_LIGHTMAPS];
extern glRect_t gl_lightmap_rectchange[MAX_LIGHTMAPS];
void GL_BuildSurfaceDisplayList (msurface_t *fa);
void gl_lightmap_init (void);
void GL_BuildLightmaps (struct model_s **models, int num_models);
void gl_R_BlendLightmaps (void);

View file

@ -43,8 +43,8 @@ struct entity_s;
struct msurface_s;
struct mod_brush_s;
void gl_lightmap_init (void);
void GL_BuildLightmaps (struct model_s **models, int num_models);
void GL_BuildSurfaceDisplayList (struct mod_brush_s *brush,
struct msurface_s *fa);
void gl_R_DrawBrushModel (struct entity_s *e);
void gl_R_DrawWorld (void);

View file

@ -408,10 +408,6 @@ gl_Draw_Init (void)
// get the other pics we need
draw_backtile = gl_Draw_PicFromWad ("backtile");
// LordHavoc: call init code for other GL renderer modules
glrmain_init ();
gl_lightmap_init ();
Draw_InitText ();
}

View file

@ -49,6 +49,7 @@
#include "QF/GL/funcs.h"
#include "QF/GL/qf_lightmap.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_rsurf.h"
#include "QF/GL/qf_sky.h"
#include "QF/GL/qf_textures.h"
#include "QF/GL/qf_vid.h"
@ -732,7 +733,6 @@ GL_BuildLightmaps (model_t **models, int num_models)
continue;
}
brush = &m->brush;
r_pcurrentvertbase = brush->vertexes;
gl_currentmodel = m;
// non-bsp models don't have surfaces.
for (unsigned i = 0; i < brush->numsurfaces; i++) {
@ -742,7 +742,7 @@ GL_BuildLightmaps (model_t **models, int num_models)
SURF_DRAWSKY))
continue;
GL_CreateSurfaceLightmap (brush, brush->surfaces + i);
GL_BuildSurfaceDisplayList (brush->surfaces + i);
GL_BuildSurfaceDisplayList (brush, brush->surfaces + i);
}
}

View file

@ -54,6 +54,7 @@
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_draw.h"
#include "QF/GL/qf_lightmap.h"
#include "QF/GL/qf_particles.h"
#include "QF/GL/qf_rlight.h"
#include "QF/GL/qf_rmain.h"
@ -182,6 +183,8 @@ gl_R_Init (void)
Cmd_AddCommand ("loadsky", gl_R_LoadSky_f, "Load a skybox");
gl_Draw_Init ();
glrmain_init ();
gl_lightmap_init ();
SCR_Init ();
gl_R_InitBubble ();

View file

@ -817,13 +817,14 @@ gl_R_DrawWorld (void)
model_t *gl_currentmodel;
void
GL_BuildSurfaceDisplayList (msurface_t *surf)
GL_BuildSurfaceDisplayList (mod_brush_t *brush, msurface_t *surf)
{
float s, t;
float *vec;
int lindex, lnumverts, i;
glpoly_t *poly;
medge_t *pedges, *r_pedge;
mvertex_t *vertex_base = brush->vertexes;
// reconstruct the polygon
pedges = gl_currentmodel->brush.edges;
@ -843,10 +844,10 @@ GL_BuildSurfaceDisplayList (msurface_t *surf)
if (lindex > 0) {
r_pedge = &pedges[lindex];
vec = r_pcurrentvertbase[r_pedge->v[0]].position;
vec = vertex_base[r_pedge->v[0]].position;
} else {
r_pedge = &pedges[-lindex];
vec = r_pcurrentvertbase[r_pedge->v[1]].position;
vec = vertex_base[r_pedge->v[1]].position;
}
s = DotProduct (vec, texinfo->vecs[0]) + texinfo->vecs[0][3];
s /= texinfo->texture->width;

View file

@ -41,7 +41,6 @@
#include "r_internal.h"
mvertex_t *r_pcurrentvertbase;
static mleaf_t *r_oldviewleaf;
static set_t *solid;
@ -115,7 +114,7 @@ R_TextureAnimation (const entity_t *entity, msurface_t *surf)
if (!base->anim_total)
return base;
relative = (int) (vr_data.realtime * 10) % base->anim_total;
relative = (int) (r_data->realtime * 10) % base->anim_total;
count = 0;
while (base->anim_min > relative || base->anim_max <= relative) {

View file

@ -48,6 +48,7 @@ typedef struct glbspctx_s {
// current entity info
qboolean insubmodel;
vec3_t r_worldmodelorg;
mvertex_t *r_pcurrentvertbase;
static float entity_rotation[3][3];
int r_currentbkey;