mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
[renderer] Move r_screen and r_cvar into main bin
r_screen because of SCR_UpdateScreen, and r_cvar because the cvars really should never have been in a plugin in the first place (and r_screen needed access).
This commit is contained in:
parent
93aa038d9e
commit
858ac19327
10 changed files with 51 additions and 39 deletions
|
@ -153,6 +153,7 @@ typedef struct vid_render_funcs_s {
|
|||
void (*R_LineGraph) (int x, int y, int *h_vals, int count);
|
||||
dlight_t *(*R_AllocDlight) (int key);
|
||||
entity_t *(*R_AllocEntity) (void);
|
||||
void (*R_MaxDlightsCheck) (struct cvar_s *var);
|
||||
void (*R_RenderView) (void);
|
||||
void (*R_DecayLights) (double frametime);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ video_renderer_common_sources = \
|
|||
libs/video/renderer/noisetextures.c \
|
||||
libs/video/renderer/r_alias.c \
|
||||
libs/video/renderer/r_bsp.c \
|
||||
libs/video/renderer/r_cvar.c \
|
||||
libs/video/renderer/r_dyn_textures.c \
|
||||
libs/video/renderer/r_efrag.c \
|
||||
libs/video/renderer/r_ent.c \
|
||||
|
@ -26,7 +25,6 @@ video_renderer_common_sources = \
|
|||
libs/video/renderer/r_light.c \
|
||||
libs/video/renderer/r_main.c \
|
||||
libs/video/renderer/r_part.c \
|
||||
libs/video/renderer/r_screen.c \
|
||||
libs/video/renderer/vid_common.c
|
||||
|
||||
renderer_libs= \
|
||||
|
@ -37,7 +35,9 @@ libs_video_renderer_libQFrenderer_la_LDFLAGS= @STATIC@
|
|||
libs_video_renderer_libQFrenderer_la_LIBADD= $(renderer_libs)
|
||||
libs_video_renderer_libQFrenderer_la_DEPENDENCIES= $(renderer_libs)
|
||||
libs_video_renderer_libQFrenderer_la_SOURCES=\
|
||||
libs/video/renderer/r_cvar.c \
|
||||
libs/video/renderer/r_init.c \
|
||||
libs/video/renderer/r_screen.c \
|
||||
libs/video/renderer/r_progs.c
|
||||
|
||||
video_renderer_gl_libs= \
|
||||
|
|
|
@ -138,7 +138,7 @@ r_farclip_f (cvar_t *var)
|
|||
Cvar_SetValue (r_particles_nearclip,
|
||||
bound (r_nearclip->value, r_particles_nearclip->value,
|
||||
r_farclip->value));
|
||||
vid.recalc_refdef = true;
|
||||
r_data->vid->recalc_refdef = true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -149,7 +149,7 @@ r_nearclip_f (cvar_t *var)
|
|||
Cvar_SetValue (r_particles_nearclip,
|
||||
bound (r_nearclip->value, r_particles_nearclip->value,
|
||||
r_farclip->value));
|
||||
vid.recalc_refdef = true;
|
||||
r_data->vid->recalc_refdef = true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -176,13 +176,19 @@ viewsize_f (cvar_t *var)
|
|||
if (var->int_val < 30 || var->int_val > 120) {
|
||||
Cvar_SetValue (var, bound (30, var->int_val, 120));
|
||||
} else {
|
||||
vid.recalc_refdef = true;
|
||||
r_data->vid->recalc_refdef = true;
|
||||
r_viewsize = bound (0, var->int_val, 100);
|
||||
if (vr_data.viewsize_callback)
|
||||
vr_data.viewsize_callback (var);
|
||||
if (r_data->viewsize_callback)
|
||||
r_data->viewsize_callback (var);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
r_dlight_max_f (cvar_t *var)
|
||||
{
|
||||
r_funcs->R_MaxDlightsCheck (var);
|
||||
}
|
||||
|
||||
void
|
||||
R_Init_Cvars (void)
|
||||
{
|
||||
|
@ -218,7 +224,7 @@ R_Init_Cvars (void)
|
|||
NULL, "Set to 1 for high quality dynamic "
|
||||
"lighting.");
|
||||
r_dlight_max = Cvar_Get ("r_dlight_max", "32", CVAR_ARCHIVE,
|
||||
R_MaxDlightsCheck, "Number of dynamic lights.");
|
||||
r_dlight_max_f, "Number of dynamic lights.");
|
||||
r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL,
|
||||
"Toggles drawing of entities (almost "
|
||||
"everything but the world)");
|
||||
|
@ -309,6 +315,6 @@ R_Init_Cvars (void)
|
|||
scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, viewsize_f,
|
||||
"Set the screen size 30 minimum, 120 maximum");
|
||||
|
||||
vr_data.graphheight = r_graphheight;
|
||||
vr_data.scr_viewsize = scr_viewsize;
|
||||
r_data->graphheight = r_graphheight;
|
||||
r_data->scr_viewsize = scr_viewsize;
|
||||
}
|
||||
|
|
|
@ -70,8 +70,6 @@ vec3_t r_entorigin; // the currently rendering entity in world
|
|||
entity_t *currententity;
|
||||
entity_t r_worldentity;
|
||||
|
||||
qboolean r_cache_thrash; // set if surface cache is thrashing
|
||||
|
||||
// view origin
|
||||
vec3_t vup, base_vup;
|
||||
vec3_t vpn, base_vpn;
|
||||
|
|
|
@ -97,6 +97,8 @@ byte *draw_chars; // 8*8 graphic characters FIXME location
|
|||
float oldfov;
|
||||
int oldsbar;
|
||||
|
||||
qboolean r_cache_thrash; // set if surface cache is thrashing
|
||||
|
||||
qboolean scr_initialized; // ready to draw
|
||||
|
||||
qpic_t *scr_ram;
|
||||
|
@ -117,7 +119,7 @@ R_SetVrect (vrect_t *vrectin, vrect_t *vrect, int lineadj)
|
|||
|
||||
// intermission is always full screen
|
||||
size = min (r_viewsize, 100);
|
||||
if (vr_data.force_fullscreen) {
|
||||
if (r_data->force_fullscreen) {
|
||||
size = 100.0;
|
||||
lineadj = 0;
|
||||
}
|
||||
|
@ -148,18 +150,18 @@ SCR_CalcRefdef (void)
|
|||
refdef_t *refdef = r_data->refdef;
|
||||
|
||||
// force a background redraw
|
||||
vr_data.scr_fullupdate = 0;
|
||||
vid.recalc_refdef = 0;
|
||||
r_data->scr_fullupdate = 0;
|
||||
r_data->vid->recalc_refdef = 0;
|
||||
|
||||
// bound field of view
|
||||
Cvar_SetValue (scr_fov, bound (1, scr_fov->value, 170));
|
||||
|
||||
vrect.x = 0;
|
||||
vrect.y = 0;
|
||||
vrect.width = vid.width;
|
||||
vrect.height = vid.height;
|
||||
vrect.width = r_data->vid->width;
|
||||
vrect.height = r_data->vid->height;
|
||||
|
||||
R_SetVrect (&vrect, &scr_vrect, vr_data.lineadj);
|
||||
R_SetVrect (&vrect, &scr_vrect, r_data->lineadj);
|
||||
|
||||
refdef->vrect = scr_vrect;
|
||||
refdef->fov_x = scr_fov->value;
|
||||
|
@ -167,7 +169,7 @@ SCR_CalcRefdef (void)
|
|||
CalcFov (refdef->fov_x, refdef->vrect.width, refdef->vrect.height);
|
||||
|
||||
// notify the refresh of the change
|
||||
vr_funcs->R_ViewChanged (vid.aspect);
|
||||
r_funcs->R_ViewChanged (r_data->vid->aspect);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -186,19 +188,19 @@ SCR_UpdateScreen (double realtime, SCR_Func scr_3dfunc, SCR_Func *scr_funcs)
|
|||
return;
|
||||
}
|
||||
|
||||
vr_data.realtime = realtime;
|
||||
scr_copytop = vr_data.scr_copyeverything = 0;
|
||||
r_data->realtime = realtime;
|
||||
scr_copytop = r_data->scr_copyeverything = 0;
|
||||
|
||||
if (oldfov != scr_fov->value) {
|
||||
oldfov = scr_fov->value;
|
||||
vid.recalc_refdef = true;
|
||||
r_data->vid->recalc_refdef = true;
|
||||
}
|
||||
|
||||
if (vid.recalc_refdef) {
|
||||
if (r_data->vid->recalc_refdef) {
|
||||
SCR_CalcRefdef ();
|
||||
}
|
||||
|
||||
vr_funcs->R_RenderFrame (scr_3dfunc, scr_funcs);
|
||||
r_funcs->R_RenderFrame (scr_3dfunc, scr_funcs);
|
||||
}
|
||||
|
||||
float
|
||||
|
@ -221,7 +223,7 @@ CalcFov (float fov_x, float width, float height)
|
|||
static void
|
||||
ScreenShot_f (void)
|
||||
{
|
||||
vr_funcs->SCR_ScreenShot_f ();
|
||||
r_funcs->SCR_ScreenShot_f ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -234,7 +236,7 @@ SCR_SizeUp_f (void)
|
|||
{
|
||||
if (scr_viewsize->int_val < 120) {
|
||||
Cvar_SetValue (scr_viewsize, scr_viewsize->int_val + 10);
|
||||
vid.recalc_refdef = 1;
|
||||
r_data->vid->recalc_refdef = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,7 +249,7 @@ static void
|
|||
SCR_SizeDown_f (void)
|
||||
{
|
||||
Cvar_SetValue (scr_viewsize, scr_viewsize->int_val - 10);
|
||||
vid.recalc_refdef = 1;
|
||||
r_data->vid->recalc_refdef = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -259,7 +261,7 @@ SCR_DrawRam (void)
|
|||
if (!r_cache_thrash)
|
||||
return;
|
||||
|
||||
vr_funcs->Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram);
|
||||
r_funcs->Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -270,7 +272,7 @@ SCR_DrawTurtle (void)
|
|||
if (!scr_showturtle->int_val)
|
||||
return;
|
||||
|
||||
if (vr_data.frametime < 0.1) {
|
||||
if (r_data->frametime < 0.1) {
|
||||
count = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -279,7 +281,7 @@ SCR_DrawTurtle (void)
|
|||
if (count < 3)
|
||||
return;
|
||||
|
||||
vr_funcs->Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
|
||||
r_funcs->Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -290,12 +292,12 @@ SCR_DrawPause (void)
|
|||
if (!scr_showpause->int_val) // turn off for screenshots
|
||||
return;
|
||||
|
||||
if (!vr_data.paused)
|
||||
if (!r_data->paused)
|
||||
return;
|
||||
|
||||
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);
|
||||
pic = r_funcs->Draw_CachePic ("gfx/pause.lmp", true);
|
||||
r_funcs->Draw_Pic ((r_data->vid->conwidth - pic->width) / 2,
|
||||
(r_data->vid->conheight - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -323,9 +325,9 @@ MipColor (int r, int g, int b)
|
|||
for (i = 0; i < 256; i++) {
|
||||
int j;
|
||||
j = i * 3;
|
||||
r1 = vid.palette[j] - r;
|
||||
g1 = vid.palette[j + 1] - g;
|
||||
b1 = vid.palette[j + 2] - b;
|
||||
r1 = r_data->vid->palette[j] - r;
|
||||
g1 = r_data->vid->palette[j + 1] - g;
|
||||
b1 = r_data->vid->palette[j + 2] - b;
|
||||
dist = r1 * r1 + g1 * g1 + b1 * b1;
|
||||
if (dist < bestdist) {
|
||||
bestdist = dist;
|
||||
|
@ -391,8 +393,8 @@ SCR_Init (void)
|
|||
Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increases the screen size");
|
||||
Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decreases the screen size");
|
||||
|
||||
scr_ram = vr_funcs->Draw_PicFromWad ("ram");
|
||||
scr_turtle = vr_funcs->Draw_PicFromWad ("turtle");
|
||||
scr_ram = r_funcs->Draw_PicFromWad ("ram");
|
||||
scr_turtle = r_funcs->Draw_PicFromWad ("turtle");
|
||||
|
||||
scr_initialized = true;
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ vid_render_funcs_t gl_vid_render_funcs = {
|
|||
gl_R_LineGraph,
|
||||
R_AllocDlight,
|
||||
R_AllocEntity,
|
||||
R_MaxDlightsCheck,
|
||||
gl_R_RenderView,
|
||||
R_DecayLights,
|
||||
gl_R_ViewChanged,
|
||||
|
|
|
@ -114,6 +114,7 @@ vid_render_funcs_t glsl_vid_render_funcs = {
|
|||
glsl_R_LineGraph,
|
||||
R_AllocDlight,
|
||||
R_AllocEntity,
|
||||
R_MaxDlightsCheck,
|
||||
glsl_R_RenderView,
|
||||
R_DecayLights,
|
||||
glsl_R_ViewChanged,
|
||||
|
|
|
@ -107,6 +107,7 @@ vid_render_funcs_t sw_vid_render_funcs = {
|
|||
R_LineGraph,
|
||||
R_AllocDlight,
|
||||
R_AllocEntity,
|
||||
R_MaxDlightsCheck,
|
||||
R_RenderView,
|
||||
R_DecayLights,
|
||||
R_ViewChanged,
|
||||
|
|
|
@ -112,6 +112,7 @@ vid_render_funcs_t sw32_vid_render_funcs = {
|
|||
sw32_R_LineGraph,
|
||||
R_AllocDlight,
|
||||
R_AllocEntity,
|
||||
R_MaxDlightsCheck,
|
||||
sw32_R_RenderView,
|
||||
R_DecayLights,
|
||||
sw32_R_ViewChanged,
|
||||
|
|
|
@ -360,6 +360,7 @@ vid_render_funcs_t vulkan_vid_render_funcs = {
|
|||
0,//vulkan_R_LineGraph,
|
||||
R_AllocDlight,
|
||||
R_AllocEntity,
|
||||
R_MaxDlightsCheck,
|
||||
0,//vulkan_R_RenderView,
|
||||
R_DecayLights,
|
||||
vulkan_R_ViewChanged,
|
||||
|
|
Loading…
Reference in a new issue