2012-02-14 08:28:09 +00:00
|
|
|
/*
|
|
|
|
#FILENAME#
|
|
|
|
|
|
|
|
#DESCRIPTION#
|
|
|
|
|
|
|
|
Copyright (C) 2001 #AUTHOR#
|
|
|
|
|
|
|
|
Author: #AUTHOR#
|
|
|
|
Date: #DATE#
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "QF/cvar.h"
|
|
|
|
#include "QF/qtypes.h"
|
|
|
|
#include "QF/render.h"
|
|
|
|
#include "QF/sys.h"
|
|
|
|
|
2012-02-23 12:17:32 +00:00
|
|
|
#include "QF/plugin/general.h"
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2021-01-12 12:10:22 +00:00
|
|
|
#include "r_scrap.h"
|
2019-07-08 04:40:29 +00:00
|
|
|
#include "vid_internal.h"
|
2012-02-14 08:28:09 +00:00
|
|
|
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
char *vidrend_plugin;
|
|
|
|
static cvar_t vidrend_plugin_cvar = {
|
|
|
|
.name = "vid_render",
|
|
|
|
.description =
|
|
|
|
"Video Render Plugin to use",
|
|
|
|
.default_value = VID_RENDER_DEFAULT,
|
|
|
|
.flags = CVAR_ROM,
|
|
|
|
.value = { .type = 0, .value = &vidrend_plugin },
|
|
|
|
};
|
2012-02-14 08:28:09 +00:00
|
|
|
plugin_t *vidrendmodule = NULL;
|
|
|
|
|
|
|
|
VID_RENDER_PLUGIN_PROTOS
|
|
|
|
static plugin_list_t vidrend_plugin_list[] = {
|
|
|
|
VID_RENDER_PLUGIN_LIST
|
|
|
|
};
|
|
|
|
|
|
|
|
vid_render_data_t *r_data;
|
|
|
|
vid_render_funcs_t *r_funcs;
|
|
|
|
|
|
|
|
#define U __attribute__ ((used))
|
|
|
|
static U void (*const r_progs_init)(struct progs_s *) = R_Progs_Init;
|
2021-01-12 12:10:22 +00:00
|
|
|
static U void (*const r_scrapdelete)(rscrap_t *) = R_ScrapDelete;
|
2012-02-14 08:28:09 +00:00
|
|
|
#undef U
|
|
|
|
|
2019-07-12 15:36:21 +00:00
|
|
|
static void
|
2020-06-25 05:03:52 +00:00
|
|
|
R_shutdown (void *data)
|
2019-07-12 15:36:21 +00:00
|
|
|
{
|
2021-06-22 10:47:20 +00:00
|
|
|
if (vidrendmodule->functions->general->shutdown) {
|
|
|
|
vidrendmodule->functions->general->shutdown ();
|
2019-07-12 15:36:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
VISIBLE void
|
2019-07-08 05:02:24 +00:00
|
|
|
R_LoadModule (vid_internal_t *vid_internal)
|
2012-02-14 08:28:09 +00:00
|
|
|
{
|
|
|
|
PI_RegisterPlugins (vidrend_plugin_list);
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
Cvar_Register (&vidrend_plugin_cvar, 0, 0);
|
|
|
|
vidrendmodule = PI_LoadPlugin ("vid_render", vidrend_plugin);
|
2012-02-14 08:28:09 +00:00
|
|
|
if (!vidrendmodule) {
|
|
|
|
Sys_Error ("Loading of video render module: %s failed!\n",
|
[cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.
As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.
The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).
While not used yet (partly due to working out the design), cvars can
have a validation function.
Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.
nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-23 03:22:45 +00:00
|
|
|
vidrend_plugin);
|
2012-02-14 08:28:09 +00:00
|
|
|
}
|
|
|
|
r_funcs = vidrendmodule->functions->vid_render;
|
2012-02-23 02:25:08 +00:00
|
|
|
mod_funcs = r_funcs->model_funcs;
|
2012-02-14 08:28:09 +00:00
|
|
|
r_data = vidrendmodule->data->vid_render;
|
2019-07-08 05:02:24 +00:00
|
|
|
r_data->vid->vid_internal = vid_internal;
|
2012-02-23 12:17:32 +00:00
|
|
|
|
2021-06-26 06:43:17 +00:00
|
|
|
r_funcs->init ();
|
2020-06-25 05:03:52 +00:00
|
|
|
Sys_RegisterShutdown (R_shutdown, 0);
|
2012-02-14 08:28:09 +00:00
|
|
|
}
|
2012-04-10 04:27:53 +00:00
|
|
|
|
|
|
|
VISIBLE void
|
|
|
|
R_Init (void)
|
|
|
|
{
|
|
|
|
r_funcs->R_Init ();
|
2022-03-07 07:59:01 +00:00
|
|
|
R_ClearEfrags (); //FIXME force link of r_efrag.o for qwaq
|
2022-03-07 17:10:47 +00:00
|
|
|
Fog_Init ();
|
2012-04-10 04:27:53 +00:00
|
|
|
}
|