mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Ensure code paths stay within the one renderer.
The gl renderer calling sw functions is bad news. Still all black, but I think that's because palette setting is disabled.
This commit is contained in:
parent
898bfa5e5f
commit
525dbcc13e
15 changed files with 197 additions and 51 deletions
|
@ -158,6 +158,13 @@ typedef struct vid_render_funcs_s {
|
|||
void (*R_RenderView) (void);
|
||||
void (*R_DecayLights) (double frametime);
|
||||
|
||||
void (*R_ViewChanged) (float aspect);
|
||||
void (*R_ClearParticles) (void);
|
||||
void (*R_InitParticles) (void);
|
||||
void (*SCR_ScreenShot_f) (void);
|
||||
void (*r_easter_eggs_f) (struct cvar_s *var);
|
||||
void (*r_particles_style_f) (struct cvar_s *var);
|
||||
|
||||
vid_particle_funcs_t *particles;
|
||||
vid_model_funcs_t *model_funcs;
|
||||
} vid_render_funcs_t;
|
||||
|
|
|
@ -16,8 +16,10 @@ extern vid_render_funcs_t gl_vid_render_funcs;
|
|||
extern vid_render_funcs_t glsl_vid_render_funcs;
|
||||
extern vid_render_funcs_t sw_vid_render_funcs;
|
||||
extern vid_render_funcs_t sw32_vid_render_funcs;
|
||||
extern vid_render_funcs_t *vid_render_funcs;
|
||||
|
||||
#define vr_data vid_render_data
|
||||
#define vr_funcs vid_render_funcs
|
||||
|
||||
extern refdef_t r_refdef;
|
||||
extern int r_viewsize;
|
||||
|
|
|
@ -1722,9 +1722,43 @@ R_ParticleFunctionInit (void)
|
|||
gl_r_easter_eggs_f (easter_eggs);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_nearclip_f (cvar_t *var)
|
||||
{
|
||||
Cvar_SetValue (r_particles_nearclip, bound (r_nearclip->value, var->value,
|
||||
r_farclip->value));
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (var, r_particles_max);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_max_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (r_particles, var);
|
||||
}
|
||||
|
||||
void
|
||||
gl_R_Particles_Init_Cvars (void)
|
||||
{
|
||||
easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, r_easter_eggs_f,
|
||||
"Enables easter eggs.");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, r_particles_f,
|
||||
"Toggles drawing of particles.");
|
||||
r_particles_max = Cvar_Get ("r_particles_max", "2048", CVAR_ARCHIVE,
|
||||
r_particles_max_f, "Maximum amount of "
|
||||
"particles to display. No maximum, minimum "
|
||||
"is 0.");
|
||||
r_particles_nearclip = Cvar_Get ("r_particles_nearclip", "32",
|
||||
CVAR_ARCHIVE, r_particles_nearclip_f,
|
||||
"Distance of the particle near clipping "
|
||||
"plane from the player.");
|
||||
r_particles_style = Cvar_Get ("r_particles_style", "1", CVAR_ARCHIVE,
|
||||
r_particles_style_f, "Sets particle style. "
|
||||
"0 for Id, 1 for QF.");
|
||||
R_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1911,9 +1911,43 @@ R_ParticleFunctionInit (void)
|
|||
glsl_r_easter_eggs_f (easter_eggs);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_nearclip_f (cvar_t *var)
|
||||
{
|
||||
Cvar_SetValue (r_particles_nearclip, bound (r_nearclip->value, var->value,
|
||||
r_farclip->value));
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (var, r_particles_max);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_max_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (r_particles, var);
|
||||
}
|
||||
|
||||
void
|
||||
glsl_R_Particles_Init_Cvars (void)
|
||||
{
|
||||
easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, r_easter_eggs_f,
|
||||
"Enables easter eggs.");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, r_particles_f,
|
||||
"Toggles drawing of particles.");
|
||||
r_particles_max = Cvar_Get ("r_particles_max", "2048", CVAR_ARCHIVE,
|
||||
r_particles_max_f, "Maximum amount of "
|
||||
"particles to display. No maximum, minimum "
|
||||
"is 0.");
|
||||
r_particles_nearclip = Cvar_Get ("r_particles_nearclip", "32",
|
||||
CVAR_ARCHIVE, r_particles_nearclip_f,
|
||||
"Distance of the particle near clipping "
|
||||
"plane from the player.");
|
||||
r_particles_style = Cvar_Get ("r_particles_style", "1", CVAR_ARCHIVE,
|
||||
r_particles_style_f, "Sets particle style. "
|
||||
"0 for Id, 1 for QF.");
|
||||
R_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
|
|
|
@ -117,18 +117,6 @@ crosshaircolor_f (cvar_t *var)
|
|||
QuatScale (color, 1.0 / 255, crosshair_color);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (var, r_particles_max);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_max_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (r_particles, var);
|
||||
}
|
||||
|
||||
static void
|
||||
r_lightmap_components_f (cvar_t *var)
|
||||
{
|
||||
|
@ -164,13 +152,6 @@ r_nearclip_f (cvar_t *var)
|
|||
r_farclip->value));
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_nearclip_f (cvar_t *var)
|
||||
{
|
||||
Cvar_SetValue (r_particles_nearclip, bound (r_nearclip->value, var->value,
|
||||
r_farclip->value));
|
||||
}
|
||||
|
||||
static void
|
||||
scr_fisheye_f (cvar_t *var)
|
||||
{
|
||||
|
@ -205,9 +186,6 @@ viewsize_f (cvar_t *var)
|
|||
void
|
||||
R_Init_Cvars (void)
|
||||
{
|
||||
easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, r_easter_eggs_f,
|
||||
"Enables easter eggs.");
|
||||
|
||||
cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, NULL,
|
||||
"Sets the position of the crosshair on the X-axis.");
|
||||
cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL,
|
||||
|
@ -286,19 +264,6 @@ R_Init_Cvars (void)
|
|||
r_numsurfs = Cvar_Get ("r_numsurfs", "0", CVAR_NONE, NULL,
|
||||
"Toggles the displaying of number of surfaces "
|
||||
"currently being viewed");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, r_particles_f,
|
||||
"Toggles drawing of particles.");
|
||||
r_particles_max = Cvar_Get ("r_particles_max", "2048", CVAR_ARCHIVE,
|
||||
r_particles_max_f, "Maximum amount of "
|
||||
"particles to display. No maximum, minimum "
|
||||
"is 0.");
|
||||
r_particles_nearclip = Cvar_Get ("r_particles_nearclip", "32",
|
||||
CVAR_ARCHIVE, r_particles_nearclip_f,
|
||||
"Distance of the particle near clipping "
|
||||
"plane from the player.");
|
||||
r_particles_style = Cvar_Get ("r_particles_style", "1", CVAR_ARCHIVE,
|
||||
r_particles_style_f, "Sets particle style. "
|
||||
"0 for Id, 1 for QF.");
|
||||
r_reportedgeout = Cvar_Get ("r_reportedgeout", "0", CVAR_NONE, NULL,
|
||||
"Toggle the display of how many edges were "
|
||||
"not displayed");
|
||||
|
|
|
@ -70,13 +70,13 @@ R_TimeGraph (void)
|
|||
x = r_refdef.vrect.width - l;
|
||||
a = timex - l;
|
||||
if (a < 0) {
|
||||
R_LineGraph (x, r_refdef.vrect.height - 2,
|
||||
vr_funcs->R_LineGraph (x, r_refdef.vrect.height - 2,
|
||||
&r_timings[a + MAX_TIMINGS], -a);
|
||||
x -= a;
|
||||
l += a;
|
||||
a = 0;
|
||||
}
|
||||
R_LineGraph (x, r_refdef.vrect.height - 2, &r_timings[a], l);
|
||||
vr_funcs->R_LineGraph (x, r_refdef.vrect.height - 2, &r_timings[a], l);
|
||||
|
||||
timex = (timex + 1) % MAX_TIMINGS;
|
||||
}
|
||||
|
@ -95,5 +95,5 @@ R_ZGraph (void)
|
|||
height[r_framecount & 255] = ((int) r_origin[2]) & 31;
|
||||
|
||||
x = 0;
|
||||
R_LineGraph (x, r_refdef.vrect.height - 2, height, w);
|
||||
vr_funcs->R_LineGraph (x, r_refdef.vrect.height - 2, height, w);
|
||||
}
|
||||
|
|
|
@ -83,10 +83,10 @@ R_MaxParticlesCheck (cvar_t *r_particles, cvar_t *r_particles_max)
|
|||
sizeof (particle_t *));
|
||||
}
|
||||
|
||||
R_ClearParticles ();
|
||||
vr_funcs->R_ClearParticles ();
|
||||
|
||||
if (r_init)
|
||||
R_InitParticles ();
|
||||
vr_funcs->R_InitParticles ();
|
||||
}
|
||||
|
||||
static int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
|
||||
|
|
|
@ -177,7 +177,7 @@ SCR_CalcRefdef (void)
|
|||
CalcFov (refdef->fov_x, refdef->vrect.width, refdef->vrect.height);
|
||||
|
||||
// notify the refresh of the change
|
||||
R_ViewChanged (vid.aspect);
|
||||
vr_funcs->R_ViewChanged (vid.aspect);
|
||||
}
|
||||
|
||||
float
|
||||
|
@ -197,6 +197,12 @@ CalcFov (float fov_x, float width, float height)
|
|||
return a;
|
||||
}
|
||||
|
||||
static void
|
||||
ScreenShot_f (void)
|
||||
{
|
||||
vr_funcs->SCR_ScreenShot_f ();
|
||||
}
|
||||
|
||||
/*
|
||||
SCR_SizeUp_f
|
||||
|
||||
|
@ -232,7 +238,7 @@ SCR_DrawRam (void)
|
|||
if (!r_cache_thrash)
|
||||
return;
|
||||
|
||||
Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram);
|
||||
vr_funcs->Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -252,7 +258,7 @@ SCR_DrawTurtle (void)
|
|||
if (count < 3)
|
||||
return;
|
||||
|
||||
Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
|
||||
vr_funcs->Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -266,8 +272,8 @@ SCR_DrawPause (void)
|
|||
if (!vr_data.paused)
|
||||
return;
|
||||
|
||||
pic = Draw_CachePic ("gfx/pause.lmp", true);
|
||||
Draw_Pic ((vid.conwidth - pic->width) / 2,
|
||||
pic = vr_funcs->Draw_CachePic ("gfx/pause.lmp", true);
|
||||
vr_funcs->Draw_Pic ((vid.conwidth - pic->width) / 2,
|
||||
(vid.conheight - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
||||
|
@ -359,14 +365,14 @@ void
|
|||
SCR_Init (void)
|
||||
{
|
||||
// register our commands
|
||||
Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot, "
|
||||
Cmd_AddCommand ("screenshot", ScreenShot_f, "Take a screenshot, "
|
||||
"saves as qfxxx.pcx in the current directory");
|
||||
Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increases the screen size");
|
||||
Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decreases the screen size");
|
||||
|
||||
scr_ram = Draw_PicFromWad ("ram");
|
||||
scr_net = Draw_PicFromWad ("net");
|
||||
scr_turtle = Draw_PicFromWad ("turtle");
|
||||
scr_ram = vr_funcs->Draw_PicFromWad ("ram");
|
||||
scr_net = vr_funcs->Draw_PicFromWad ("net");
|
||||
scr_turtle = vr_funcs->Draw_PicFromWad ("turtle");
|
||||
|
||||
vid = *vr_data.vid; // cache
|
||||
scr_initialized = true;
|
||||
|
|
|
@ -832,9 +832,43 @@ R_ParticleFunctionInit (void)
|
|||
sw_vid_render_funcs.particles = &particles_QF;
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_nearclip_f (cvar_t *var)
|
||||
{
|
||||
Cvar_SetValue (r_particles_nearclip, bound (r_nearclip->value, var->value,
|
||||
r_farclip->value));
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (var, r_particles_max);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_max_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (r_particles, var);
|
||||
}
|
||||
|
||||
void
|
||||
R_Particles_Init_Cvars (void)
|
||||
{
|
||||
easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, r_easter_eggs_f,
|
||||
"Enables easter eggs.");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, r_particles_f,
|
||||
"Toggles drawing of particles.");
|
||||
r_particles_max = Cvar_Get ("r_particles_max", "2048", CVAR_ARCHIVE,
|
||||
r_particles_max_f, "Maximum amount of "
|
||||
"particles to display. No maximum, minimum "
|
||||
"is 0.");
|
||||
r_particles_nearclip = Cvar_Get ("r_particles_nearclip", "32",
|
||||
CVAR_ARCHIVE, r_particles_nearclip_f,
|
||||
"Distance of the particle near clipping "
|
||||
"plane from the player.");
|
||||
r_particles_style = Cvar_Get ("r_particles_style", "1", CVAR_ARCHIVE,
|
||||
r_particles_style_f, "Sets particle style. "
|
||||
"0 for Id, 1 for QF.");
|
||||
R_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
|
|
|
@ -843,9 +843,43 @@ R_ParticleFunctionInit (void)
|
|||
sw32_vid_render_funcs.particles = &particles_QF;
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_nearclip_f (cvar_t *var)
|
||||
{
|
||||
Cvar_SetValue (r_particles_nearclip, bound (r_nearclip->value, var->value,
|
||||
r_farclip->value));
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (var, r_particles_max);
|
||||
}
|
||||
|
||||
static void
|
||||
r_particles_max_f (cvar_t *var)
|
||||
{
|
||||
R_MaxParticlesCheck (r_particles, var);
|
||||
}
|
||||
|
||||
void
|
||||
sw32_R_Particles_Init_Cvars (void)
|
||||
{
|
||||
easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, r_easter_eggs_f,
|
||||
"Enables easter eggs.");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, r_particles_f,
|
||||
"Toggles drawing of particles.");
|
||||
r_particles_max = Cvar_Get ("r_particles_max", "2048", CVAR_ARCHIVE,
|
||||
r_particles_max_f, "Maximum amount of "
|
||||
"particles to display. No maximum, minimum "
|
||||
"is 0.");
|
||||
r_particles_nearclip = Cvar_Get ("r_particles_nearclip", "32",
|
||||
CVAR_ARCHIVE, r_particles_nearclip_f,
|
||||
"Distance of the particle near clipping "
|
||||
"plane from the player.");
|
||||
r_particles_style = Cvar_Get ("r_particles_style", "1", CVAR_ARCHIVE,
|
||||
r_particles_style_f, "Sets particle style. "
|
||||
"0 for Id, 1 for QF.");
|
||||
R_ParticleFunctionInit ();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,3 +48,5 @@ vid_render_data_t vid_render_data = {
|
|||
0,
|
||||
r_origin, vpn, vright, vup
|
||||
};
|
||||
|
||||
vid_render_funcs_t *vid_render_funcs;
|
||||
|
|
|
@ -111,6 +111,12 @@ vid_render_funcs_t gl_vid_render_funcs = {
|
|||
R_AllocEntity,
|
||||
gl_R_RenderView,
|
||||
R_DecayLights,
|
||||
gl_R_ViewChanged,
|
||||
gl_R_ClearParticles,
|
||||
gl_R_InitParticles,
|
||||
gl_SCR_ScreenShot_f,
|
||||
gl_r_easter_eggs_f,
|
||||
gl_r_particles_style_f,
|
||||
0,
|
||||
&model_funcs
|
||||
};
|
||||
|
@ -120,6 +126,7 @@ gl_vid_render_init (void)
|
|||
{
|
||||
vr_data.vid->init_gl = GL_Init_Common;
|
||||
vr_data.vid->load_gl ();
|
||||
vr_funcs = &gl_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
|
|
@ -109,6 +109,12 @@ vid_render_funcs_t glsl_vid_render_funcs = {
|
|||
R_AllocEntity,
|
||||
glsl_R_RenderView,
|
||||
R_DecayLights,
|
||||
glsl_R_ViewChanged,
|
||||
glsl_R_ClearParticles,
|
||||
glsl_R_InitParticles,
|
||||
glsl_SCR_ScreenShot_f,
|
||||
glsl_r_easter_eggs_f,
|
||||
glsl_r_particles_style_f,
|
||||
0,
|
||||
&model_funcs
|
||||
};
|
||||
|
@ -116,6 +122,7 @@ vid_render_funcs_t glsl_vid_render_funcs = {
|
|||
static void
|
||||
glsl_vid_render_init (void)
|
||||
{
|
||||
vr_funcs = &glsl_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,12 @@ vid_render_funcs_t sw_vid_render_funcs = {
|
|||
R_AllocEntity,
|
||||
R_RenderView,
|
||||
R_DecayLights,
|
||||
R_ViewChanged,
|
||||
R_ClearParticles,
|
||||
R_InitParticles,
|
||||
SCR_ScreenShot_f,
|
||||
r_easter_eggs_f,
|
||||
r_particles_style_f,
|
||||
0,
|
||||
&model_funcs
|
||||
};
|
||||
|
@ -111,6 +117,7 @@ vid_render_funcs_t sw_vid_render_funcs = {
|
|||
static void
|
||||
sw_vid_render_init (void)
|
||||
{
|
||||
vr_funcs = &sw_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
|
|
@ -109,6 +109,12 @@ vid_render_funcs_t sw32_vid_render_funcs = {
|
|||
R_AllocEntity,
|
||||
sw32_R_RenderView,
|
||||
R_DecayLights,
|
||||
sw32_R_ViewChanged,
|
||||
sw32_R_ClearParticles,
|
||||
sw32_R_InitParticles,
|
||||
sw32_SCR_ScreenShot_f,
|
||||
sw32_r_easter_eggs_f,
|
||||
sw32_r_particles_style_f,
|
||||
0,
|
||||
&model_funcs
|
||||
};
|
||||
|
@ -116,6 +122,7 @@ vid_render_funcs_t sw32_vid_render_funcs = {
|
|||
static void
|
||||
sw32_vid_render_init (void)
|
||||
{
|
||||
vr_funcs = &sw32_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue