2012-02-14 08:28:09 +00:00
|
|
|
/*
|
|
|
|
QF/plugin/vid_render.h
|
|
|
|
|
|
|
|
Video Renderer plugin data types
|
|
|
|
|
|
|
|
Copyright (C) 2001 Jeff Teunissen <deek@quakeforge.net>
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
*/
|
2021-06-22 10:47:20 +00:00
|
|
|
#ifndef __QF_plugin_vid_render_h
|
|
|
|
#define __QF_plugin_vid_render_h
|
2012-02-14 08:28:09 +00:00
|
|
|
|
|
|
|
#include <QF/draw.h>
|
|
|
|
#include <QF/plugin.h>
|
|
|
|
#include <QF/qtypes.h>
|
|
|
|
#include <QF/render.h>
|
|
|
|
#include <QF/screen.h>
|
|
|
|
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
#include "QF/scene/entity.h"//FIXME
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
struct plitem_s;
|
|
|
|
struct cvar_s;
|
2022-05-05 05:41:46 +00:00
|
|
|
struct scene_s;
|
2012-02-14 12:25:19 +00:00
|
|
|
struct skin_s;
|
2012-02-14 08:28:09 +00:00
|
|
|
|
2021-02-01 12:11:45 +00:00
|
|
|
struct mod_alias_ctx_s;
|
2021-12-13 23:36:19 +00:00
|
|
|
struct mod_sprite_ctx_s;
|
2022-03-17 08:50:38 +00:00
|
|
|
struct entqueue_s;
|
2022-03-24 06:45:01 +00:00
|
|
|
struct framebuffer_s;
|
2022-03-25 15:29:34 +00:00
|
|
|
struct vrect_s;
|
2022-05-26 05:41:08 +00:00
|
|
|
struct texture_s;
|
2021-02-01 12:11:45 +00:00
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
/*
|
|
|
|
All video plugins must export these functions
|
|
|
|
*/
|
|
|
|
|
2012-02-14 12:25:19 +00:00
|
|
|
typedef struct vid_model_funcs_s {
|
2021-01-19 04:05:39 +00:00
|
|
|
size_t texture_render_size;// size of renderer specific texture data
|
2021-02-01 05:39:00 +00:00
|
|
|
void (*Mod_LoadLighting) (model_t *mod, bsp_t *bsp);
|
|
|
|
void (*Mod_SubdivideSurface) (model_t *mod, msurface_t *fa);
|
2022-05-26 05:41:08 +00:00
|
|
|
void (*Mod_ProcessTexture) (model_t *mod, struct texture_s *tx);
|
2012-04-27 05:40:06 +00:00
|
|
|
void (*Mod_LoadIQM) (model_t *mod, void *buffer);
|
2012-02-14 12:25:19 +00:00
|
|
|
void (*Mod_LoadAliasModel) (model_t *mod, void *buffer,
|
|
|
|
cache_allocator_t allocator);
|
|
|
|
void (*Mod_LoadSpriteModel) (model_t *mod, void *buffer);
|
2021-02-01 12:11:45 +00:00
|
|
|
void (*Mod_MakeAliasModelDisplayLists) (struct mod_alias_ctx_s *alias_ctx,
|
2012-02-23 03:55:50 +00:00
|
|
|
void *_m, int _s, int extra);
|
[model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 06:38:27 +00:00
|
|
|
void (*Mod_LoadAllSkins) (struct mod_alias_ctx_s *alias_ctx);
|
2021-02-01 12:11:45 +00:00
|
|
|
void (*Mod_FinalizeAliasModel) (struct mod_alias_ctx_s *alias_ctx);
|
|
|
|
void (*Mod_LoadExternalSkins) (struct mod_alias_ctx_s *alias_ctx);
|
2012-05-14 14:02:06 +00:00
|
|
|
void (*Mod_IQMFinish) (model_t *mod);
|
2012-02-23 03:55:50 +00:00
|
|
|
int alias_cache;
|
2021-12-13 23:36:19 +00:00
|
|
|
void (*Mod_SpriteLoadFrames) (struct mod_sprite_ctx_s *sprite_ctx);
|
2012-02-14 12:25:19 +00:00
|
|
|
|
2022-05-12 13:46:31 +00:00
|
|
|
void (*Skin_Free) (struct skin_s *skin);
|
2012-02-14 12:25:19 +00:00
|
|
|
struct skin_s *(*Skin_SetColormap) (struct skin_s *skin, int cmap);
|
|
|
|
struct skin_s *(*Skin_SetSkin) (struct skin_s *skin, int cmap,
|
|
|
|
const char *skinname);
|
|
|
|
void (*Skin_SetupSkin) (struct skin_s *skin, int cmap);
|
|
|
|
void (*Skin_SetTranslation) (int cmap, int top, int bottom);
|
|
|
|
void (*Skin_ProcessTranslation) (int cmap, const byte *translation);
|
|
|
|
void (*Skin_InitTranslations) (void);
|
|
|
|
} vid_model_funcs_t;
|
|
|
|
|
2022-03-31 10:07:15 +00:00
|
|
|
struct tex_s;
|
2022-12-07 06:11:08 +00:00
|
|
|
struct font_s;
|
2022-09-15 05:24:33 +00:00
|
|
|
struct draw_charbuffer_s;
|
|
|
|
|
2022-03-31 10:07:15 +00:00
|
|
|
typedef void (*capfunc_t) (struct tex_s *screencap, void *data);
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
typedef struct vid_render_funcs_s {
|
2021-06-26 06:43:17 +00:00
|
|
|
void (*init) (void);
|
2022-09-15 05:24:33 +00:00
|
|
|
void (*Draw_CharBuffer) (int x, int y, struct draw_charbuffer_s *buffer);
|
2022-11-13 13:23:56 +00:00
|
|
|
void (*Draw_SetScale) (int scale);
|
2012-02-14 08:28:09 +00:00
|
|
|
void (*Draw_Character) (int x, int y, unsigned ch);
|
|
|
|
void (*Draw_String) (int x, int y, const char *str);
|
|
|
|
void (*Draw_nString) (int x, int y, const char *str, int count);
|
|
|
|
void (*Draw_AltString) (int x, int y, const char *str);
|
|
|
|
void (*Draw_ConsoleBackground) (int lines, byte alpha);
|
|
|
|
void (*Draw_Crosshair) (void);
|
|
|
|
void (*Draw_CrosshairAt) (int ch, int x, int y);
|
|
|
|
void (*Draw_TileClear) (int x, int y, int w, int h);
|
|
|
|
void (*Draw_Fill) (int x, int y, int w, int h, int c);
|
2022-05-28 09:14:26 +00:00
|
|
|
void (*Draw_Line) (int x0, int y0, int x1, int y1, int c);
|
2012-02-14 08:28:09 +00:00
|
|
|
void (*Draw_TextBox) (int x, int y, int width, int lines, byte alpha);
|
|
|
|
void (*Draw_FadeScreen) (void);
|
|
|
|
void (*Draw_BlendScreen) (quat_t color);
|
|
|
|
qpic_t *(*Draw_CachePic) (const char *path, qboolean alpha);
|
|
|
|
void (*Draw_UncachePic) (const char *path);
|
|
|
|
qpic_t *(*Draw_MakePic) (int width, int height, const byte *data);
|
|
|
|
void (*Draw_DestroyPic) (qpic_t *pic);
|
|
|
|
qpic_t *(*Draw_PicFromWad) (const char *name);
|
|
|
|
void (*Draw_Pic) (int x, int y, qpic_t *pic);
|
|
|
|
void (*Draw_Picf) (float x, float y, qpic_t *pic);
|
|
|
|
void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height);
|
2022-12-07 06:11:08 +00:00
|
|
|
int (*Draw_AddFont) (struct font_s *font);
|
2022-12-10 09:55:08 +00:00
|
|
|
void (*Draw_Glyph) (int x, int y, int fontid, int glyphid, int c);
|
2012-02-14 08:28:09 +00:00
|
|
|
|
|
|
|
|
2021-12-19 05:47:25 +00:00
|
|
|
struct psystem_s *(*ParticleSystem) (void);
|
2012-04-10 04:27:53 +00:00
|
|
|
void (*R_Init) (void);
|
2012-02-14 08:28:09 +00:00
|
|
|
void (*R_ClearState) (void);
|
|
|
|
void (*R_LoadSkys) (const char *);
|
2022-05-05 05:41:46 +00:00
|
|
|
void (*R_NewScene) (struct scene_s *scene);
|
2021-07-11 01:59:27 +00:00
|
|
|
void (*R_LineGraph) (int x, int y, int *h_vals, int count, int height);
|
2012-04-11 13:45:23 +00:00
|
|
|
|
2022-03-07 14:32:44 +00:00
|
|
|
void (*begin_frame) (void);
|
|
|
|
void (*render_view) (void);
|
2022-03-17 08:50:38 +00:00
|
|
|
void (*draw_particles) (struct psystem_s *psystem);
|
2022-03-17 15:14:48 +00:00
|
|
|
void (*draw_transparent) (void);
|
2022-03-24 06:45:01 +00:00
|
|
|
void (*post_process) (struct framebuffer_s *src);
|
2022-03-15 06:42:43 +00:00
|
|
|
void (*set_2d) (int scaled);
|
2022-03-07 14:32:44 +00:00
|
|
|
void (*end_frame) (void);
|
|
|
|
|
2022-03-24 06:45:01 +00:00
|
|
|
struct framebuffer_s *(*create_cube_map) (int side);
|
2022-03-24 03:22:27 +00:00
|
|
|
struct framebuffer_s *(*create_frame_buffer) (int width, int height);
|
2022-09-21 14:47:14 +00:00
|
|
|
void (*destroy_frame_buffer) (struct framebuffer_s *framebuffer);
|
2022-03-24 03:22:27 +00:00
|
|
|
void (*bind_framebuffer) (struct framebuffer_s *framebuffer);
|
2022-03-25 15:29:34 +00:00
|
|
|
void (*set_viewport) (const struct vrect_s *view);
|
2022-03-30 05:55:32 +00:00
|
|
|
// x and y are tan(f/2) for fov_x and fov_y
|
|
|
|
void (*set_fov) (float x, float y);
|
2022-03-24 03:22:27 +00:00
|
|
|
|
2022-03-31 10:07:15 +00:00
|
|
|
void (*capture_screen) (capfunc_t callback, void *data);
|
|
|
|
|
2012-02-14 13:19:17 +00:00
|
|
|
vid_model_funcs_t *model_funcs;
|
2012-02-14 08:28:09 +00:00
|
|
|
} vid_render_funcs_t;
|
|
|
|
|
|
|
|
typedef struct vid_render_data_s {
|
|
|
|
viddef_t *vid;
|
|
|
|
refdef_t *refdef;
|
|
|
|
int scr_copytop;
|
|
|
|
int scr_copyeverything;
|
|
|
|
int scr_fullupdate; // set to 0 to force full redraw
|
[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
|
|
|
void (*viewsize_callback) (int view_size);
|
|
|
|
int *scr_viewsize;
|
|
|
|
int *graphheight;
|
2012-02-14 08:28:09 +00:00
|
|
|
float min_wateralpha;
|
|
|
|
qboolean force_fullscreen;
|
|
|
|
qboolean inhibit_viewmodel;
|
|
|
|
qboolean paused;
|
|
|
|
int lineadj;
|
[scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).
While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 01:32:09 +00:00
|
|
|
entity_t view_model; //FIXME still?!?
|
2012-02-14 08:28:09 +00:00
|
|
|
double frametime;
|
|
|
|
double realtime;
|
|
|
|
lightstyle_t *lightstyle;
|
|
|
|
} vid_render_data_t;
|
|
|
|
|
2021-06-22 10:47:20 +00:00
|
|
|
#endif // __QF_plugin_vid_render_h
|