From 33c5320c0e823ddbc9098390821e491f67b2c411 Mon Sep 17 00:00:00 2001 From: Bill Currie <bill@taniwha.org> Date: Fri, 23 Dec 2011 12:19:50 +0900 Subject: [PATCH] Create stubs for most of the required render functions. nq-glslx almost links. Just some suspicious references in host.c I want to check before doing anything more. --- include/QF/render.h | 9 -- include/r_local.h | 10 ++ libs/models/brush/glsl_model_brush.c | 2 + libs/video/renderer/glsl/Makefile.am | 3 +- libs/video/renderer/glsl/glsl_draw.c | 121 ++++++++++++++++++++ libs/video/renderer/glsl/glsl_main.c | 161 +++++++++++++++++++++++++++ 6 files changed, 296 insertions(+), 10 deletions(-) create mode 100644 libs/video/renderer/glsl/glsl_draw.c create mode 100644 libs/video/renderer/glsl/glsl_main.c diff --git a/include/QF/render.h b/include/QF/render.h index 9f67600ef..dd56ab96a 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -180,16 +180,7 @@ void Fog_StartAdditive (void); void Fog_StopAdditive (void); void Fog_Init (void); -// Surface cache related ========== -extern int reinit_surfcache; // if 1, surface cache is currently empty -extern qboolean r_cache_thrash; // set if thrashing the surface cache -extern qboolean r_inhibit_viewmodel; -extern qboolean r_force_fullscreen; -extern qboolean r_paused; -extern entity_t *r_view_model; -extern entity_t *r_player_entity; extern int r_lineadj; -extern qboolean r_active; void *D_SurfaceCacheAddress (void); int D_SurfaceCacheForRes (int width, int height); diff --git a/include/r_local.h b/include/r_local.h index 26be09c45..e36e9da1b 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -32,6 +32,7 @@ #include "QF/mathlib.h" #include "QF/vid.h" #include "QF/model.h" +#include "QF/render.h" #include "r_shared.h" #define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0) @@ -148,6 +149,15 @@ extern int vstartscan; void R_ClearPolyList (void); void R_DrawPolyList (void); +// Surface cache related ========== +extern int reinit_surfcache; // if 1, surface cache is currently empty +extern qboolean r_cache_thrash; // set if thrashing the surface cache +extern qboolean r_inhibit_viewmodel; +extern qboolean r_force_fullscreen; +extern qboolean r_paused; +extern entity_t *r_view_model; +extern entity_t *r_player_entity; +extern qboolean r_active; // current entity info extern qboolean insubmodel; diff --git a/libs/models/brush/glsl_model_brush.c b/libs/models/brush/glsl_model_brush.c index 869e37b6a..f7efd0e16 100644 --- a/libs/models/brush/glsl_model_brush.c +++ b/libs/models/brush/glsl_model_brush.c @@ -56,6 +56,8 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #include "compat.h" +VISIBLE int mod_lightmap_bytes; + void Mod_ProcessTexture (miptex_t *mt, texture_t *tx) { diff --git a/libs/video/renderer/glsl/Makefile.am b/libs/video/renderer/glsl/Makefile.am index e99713706..1fbcbe691 100644 --- a/libs/video/renderer/glsl/Makefile.am +++ b/libs/video/renderer/glsl/Makefile.am @@ -9,7 +9,8 @@ else noinst_LTLIBRARIES= endif -glsl_src = +glsl_src = \ + glsl_draw.c glsl_main.c libglsl_la_SOURCES= $(glsl_src) diff --git a/libs/video/renderer/glsl/glsl_draw.c b/libs/video/renderer/glsl/glsl_draw.c new file mode 100644 index 000000000..bef15d8ef --- /dev/null +++ b/libs/video/renderer/glsl/glsl_draw.c @@ -0,0 +1,121 @@ +/* + glsl_draw.c + + 2D drawing support for GLSL + + Copyright (C) 2011 Bill Currie <bill@taniwha.org> + + Author: Bill Currie <bill@taniwha.org> + Date: 2011/12/23 + + 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 + +static __attribute__ ((used)) const char rcsid[] = "$Id$"; + +#include "QF/draw.h" + +VISIBLE byte *draw_chars; + +VISIBLE qpic_t * +Draw_PicFromWad (const char *name) +{ + return 0; +} + +VISIBLE qpic_t * +Draw_CachePic (const char *path, qboolean alpha) +{ + return 0; +} + +VISIBLE void +Draw_TextBox (int x, int y, int width, int lines, byte alpha) +{ +} + +VISIBLE void +Draw_Init (void) +{ +} + +VISIBLE void +Draw_Character (int x, int y, unsigned int chr) +{ +} + +VISIBLE void +Draw_String (int x, int y, const char *str) +{ +} + +VISIBLE void +Draw_nString (int x, int y, const char *str, int count) +{ +} + +void +Draw_AltString (int x, int y, const char *str) +{ +} + +VISIBLE void +Draw_Crosshair (void) +{ +} + +void +Draw_CrosshairAt (int ch, int x, int y) +{ +} + +VISIBLE void +Draw_Pic (int x, int y, qpic_t *pic) +{ +} + +VISIBLE void +Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, + int height) +{ +} + +VISIBLE void +Draw_ConsoleBackground (int lines, byte alpha) +{ +} + +VISIBLE void +Draw_TileClear (int x, int y, int w, int h) +{ +} + +VISIBLE void +Draw_Fill (int x, int y, int w, int h, int c) +{ +} + +VISIBLE void +Draw_FadeScreen (void) +{ +} diff --git a/libs/video/renderer/glsl/glsl_main.c b/libs/video/renderer/glsl/glsl_main.c new file mode 100644 index 000000000..5bf004cb5 --- /dev/null +++ b/libs/video/renderer/glsl/glsl_main.c @@ -0,0 +1,161 @@ +/* + glsl_main.c + + GLSL rendering + + Copyright (C) 2011 Bill Currie <bill@taniwha.org> + + Author: Bill Currie <bill@taniwha.org> + Date: 2011/12/23 + + 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 + +static __attribute__ ((used)) const char rcsid[] = "$Id$"; + +#include "QF/cvar.h" +#include "QF/render.h" +#include "QF/screen.h" +#include "QF/skin.h" + +#include "QF/GL/qf_textures.h" + +#include "r_cvar.h" +#include "r_dynamic.h" +#include "r_screen.h" + +VISIBLE refdef_t r_refdef; +qboolean r_cache_thrash; +int r_init; +int r_framecount; +int d_lightstylevalue[256]; +int r_visframecount; +entity_t r_worldentity; + +void +r_easter_eggs_f (cvar_t *var) +{ +} + +void +r_particles_style_f (cvar_t *var) +{ +} + +void +gl_overbright_f (cvar_t *var) +{ +} + +VISIBLE void +R_ViewChanged (float aspect) +{ +} + +VISIBLE void +R_RenderView (void) +{ +} + +VISIBLE void +R_Init (void) +{ +} + +VISIBLE void +R_Particles_Init_Cvars (void) +{ +} + +VISIBLE void +R_ClearParticles (void) +{ +} + +VISIBLE void +SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) +{ +} + +VISIBLE void +R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) +{ +} + +VISIBLE void +R_LoadSkys (const char *sky) +{ +} + +VISIBLE void +Fog_Update (float density, float red, float green, float blue, float time) +{ +} + +VISIBLE void +Fog_ParseWorldspawn (struct plitem_s *worldspawn) +{ +} + +VISIBLE void +Skin_Set_Translate (int top, int bottom, void *_dest) +{ +} + +VISIBLE void +Skin_Do_Translation_Model (struct model_s *model, int skinnum, int slot, + skin_t *skin) +{ +} + +VISIBLE void +Skin_Process (skin_t *skin, struct tex_s * tex) +{ +} + +VISIBLE void +Skin_Init_Translation (void) +{ +} + +VISIBLE void +R_LineGraph (int x, int y, int *h_vals, int count) +{ +} + +VISIBLE void +R_InitParticles (void) +{ +} + +VISIBLE void +SCR_ScreenShot_f (void) +{ +} + +VISIBLE int +GL_LoadTexture (const char *identifier, int width, int height, byte *data, + qboolean mipmap, qboolean alpha, int bytesperpixel) +{ + return 0; +}