Make a start on putting the pieces together.

Still many undefined and multiply defined symbols, but there seems to be a
light in this darkness. I just hope it's not an oncoming train :)
This commit is contained in:
Bill Currie 2012-02-22 21:53:17 +09:00
parent d445b4ef88
commit 65bd29353c
18 changed files with 361 additions and 108 deletions

View file

@ -1,5 +1,5 @@
/*
gl_draw.h
qf_draw.h
gl specific draw function

37
include/QF/GLSL/qf_draw.h Normal file
View file

@ -0,0 +1,37 @@
/*
qf_draw.h
glsl specific draw function
Copyright (C) 1996-1997 Id Software, Inc.
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
$Id: draw.h 10910 2004-05-07 03:54:35Z taniwha $
*/
#ifndef __gl_draw_h
#define __gl_draw_h
void GLSL_Set2D (void);
void GLSL_Set2DScaled (void);
void GLSL_DrawReset (void);
void GLSL_FlushText (void);
#endif//__gl_draw_h

View file

@ -12,9 +12,12 @@
extern viddef_t vid; // global video state
extern vid_render_data_t vid_render_data;
extern vid_render_funcs_t vid_render_funcs;
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;
#define vr_data vid_render_data
#define vr_funcs vid_render_funcs
extern refdef_t r_refdef;
extern int r_viewsize;

View file

@ -55,6 +55,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/vid.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_draw.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_rsurf.h"
#include "QF/GL/qf_textures.h"
@ -62,7 +63,6 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/GL/types.h"
#include "compat.h"
#include "gl_draw.h"
#include "r_internal.h"
#include "sbar.h"
#include "varrays.h"

View file

@ -1695,15 +1695,15 @@ gl_r_easter_eggs_f (cvar_t *var)
if (easter_eggs && !gl_feature_mach64) {
if (easter_eggs->int_val) {
if (r_particles_style->int_val) {
vr_funcs.particles = &particles_QF_egg;
gl_vid_render_funcs.particles = &particles_QF_egg;
} else {
vr_funcs.particles = &particles_ID_egg;
gl_vid_render_funcs.particles = &particles_ID_egg;
}
} else if (r_particles_style) {
if (r_particles_style->int_val) {
vr_funcs.particles = &particles_QF;
gl_vid_render_funcs.particles = &particles_QF;
} else {
vr_funcs.particles = &particles_ID;
gl_vid_render_funcs.particles = &particles_ID;
}
}
}

View file

@ -56,13 +56,13 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/vid.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_draw.h"
#include "QF/GL/qf_rlight.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_rsurf.h"
#include "QF/GL/qf_vid.h"
#include "compat.h"
#include "gl_draw.h"
#include "r_internal.h"
#include "varrays.h"

View file

@ -54,11 +54,11 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/va.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_draw.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_vid.h"
#include "compat.h"
#include "gl_draw.h"
#include "r_internal.h"
#include "sbar.h"

View file

@ -53,10 +53,10 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/GLSL/defines.h"
#include "QF/GLSL/funcs.h"
#include "QF/GLSL/qf_draw.h"
#include "QF/GLSL/qf_textures.h"
#include "QF/GLSL/qf_vid.h"
#include "gl_draw.h"
#include "r_internal.h"
typedef struct {
@ -676,7 +676,7 @@ glsl_Draw_ConsoleBackground (int lines, byte alpha)
{ 0, lines, 0, 1},
};
GL_FlushText (); // Flush text that should be rendered before the console
GLSL_FlushText (); // Flush text that should be rendered before the console
qfeglUseProgram (quake_icon.program);
qfeglEnableVertexAttribArray (quake_icon.vertex.location);
@ -732,7 +732,7 @@ glsl_Draw_FadeScreen (void)
{
static quat_t color = { 0, 0, 0, 0.7 };
GL_FlushText (); // Flush text that should be rendered before the menu
GLSL_FlushText (); // Flush text that should be rendered before the menu
draw_blendscreen (color);
}
@ -773,25 +773,25 @@ set_2d (int width, int height)
}
void
GL_Set2D (void)
GLSL_Set2D (void)
{
set_2d (vid.width, vid.height);
}
void
GL_Set2DScaled (void)
GLSL_Set2DScaled (void)
{
set_2d (vid.conwidth, vid.conheight);
}
void
GL_DrawReset (void)
GLSL_DrawReset (void)
{
char_queue->size = 0;
}
void
GL_FlushText (void)
GLSL_FlushText (void)
{
if (char_queue->size)
flush_text ();

View file

@ -56,7 +56,6 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/GLSL/qf_lightmap.h"
#include "QF/GLSL/qf_textures.h"
#include "gl_draw.h"
#include "r_internal.h"
mat4_t glsl_projection;
@ -290,8 +289,3 @@ glsl_R_ClearState (void)
R_ClearDlights ();
glsl_R_ClearParticles ();
}
void
D_FlushCaches (void)
{
}

View file

@ -350,7 +350,7 @@ R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength)
for (i = 0; i < j; i++) {
particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256,
vr_data.realtime + 0.3,
colorStart + (i % colorLength), 1.0, 0.0);
colorStart + (i % colorLength), 1.0, 0.0);
}
}
@ -1884,15 +1884,15 @@ glsl_r_easter_eggs_f (cvar_t *var)
if (easter_eggs) {
if (easter_eggs->int_val) {
if (r_particles_style->int_val) {
vr_funcs.particles = &particles_QF_egg;
glsl_vid_render_funcs.particles = &particles_QF_egg;
} else {
vr_funcs.particles = &particles_ID_egg;
glsl_vid_render_funcs.particles = &particles_ID_egg;
}
} else if (r_particles_style) {
if (r_particles_style->int_val) {
vr_funcs.particles = &particles_QF;
glsl_vid_render_funcs.particles = &particles_QF;
} else {
vr_funcs.particles = &particles_ID;
glsl_vid_render_funcs.particles = &particles_ID;
}
}
}

View file

@ -57,10 +57,10 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/GLSL/defines.h"
#include "QF/GLSL/funcs.h"
#include "QF/GLSL/qf_draw.h"
#include "QF/GLSL/qf_textures.h"
#include "QF/GLSL/qf_vid.h"
#include "gl_draw.h"
#include "r_internal.h"
/* Unknown renamed to GLErr_Unknown to solve conflict with winioctl.h */
@ -190,14 +190,14 @@ glsl_SCR_UpdateScreen (double realtime, SCR_Func scr_3dfunc,
scr_3dfunc ();
SCR_SetUpToDrawConsole ();
GL_Set2D ();
GL_DrawReset ();
GLSL_Set2D ();
GLSL_DrawReset ();
SCR_TileClear ();
GL_Set2DScaled ();
GLSL_Set2DScaled ();
while (*scr_funcs) {
(*scr_funcs)();
scr_funcs++;
GL_FlushText ();
GLSL_FlushText ();
}
qfeglFlush ();
}

View file

@ -829,7 +829,7 @@ static vid_particle_funcs_t particles_QF = {
static void
R_ParticleFunctionInit (void)
{
vr_funcs.particles = &particles_QF;
sw_vid_render_funcs.particles = &particles_QF;
}
void

View file

@ -840,7 +840,7 @@ static vid_particle_funcs_t particles_QF = {
static void
R_ParticleFunctionInit (void)
{
vr_funcs.particles = &particles_QF;
sw32_vid_render_funcs.particles = &particles_QF;
}
void

View file

@ -34,74 +34,6 @@
#include "mod_internal.h"
#include "r_internal.h"
static vid_model_funcs_t model_funcs = {
Mod_LoadExternalTextures,
Mod_LoadLighting,
Mod_SubdivideSurface,
Mod_ProcessTexture,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
};
vid_render_funcs_t vid_render_funcs = {
Draw_Init,
Draw_Character,
Draw_String,
Draw_nString,
Draw_AltString,
Draw_ConsoleBackground,
Draw_Crosshair,
Draw_CrosshairAt,
Draw_TileClear,
Draw_Fill,
Draw_TextBox,
Draw_FadeScreen,
Draw_BlendScreen,
Draw_CachePic,
Draw_UncachePic,
Draw_MakePic,
Draw_DestroyPic,
Draw_PicFromWad,
Draw_Pic,
Draw_Picf,
Draw_SubPic,
SCR_UpdateScreen,
SCR_DrawRam,
SCR_DrawTurtle,
SCR_DrawPause,
SCR_CaptureBGR,
SCR_ScreenShot,
SCR_DrawStringToSnap,
Fog_Update,
Fog_ParseWorldspawn,
R_ClearState,
R_LoadSkys,
R_NewMap,
R_AddEfrags,
R_RemoveEfrags,
R_EnqueueEntity,
R_LineGraph,
R_AllocDlight,
R_AllocEntity,
R_RenderView,
R_DecayLights,
D_FlushCaches,
0,
&model_funcs
};
vid_render_data_t vid_render_data = {
&vid, &r_refdef, &scr_vrect,
0, 0, 0,

View file

@ -28,12 +28,85 @@
# include "config.h"
#endif
#define NH_DEFINE
#include "gl/namehack.h"
#include "QF/plugin/general.h"
#include "QF/plugin/vid_render.h"
#include "mod_internal.h"
#include "r_internal.h"
#include "gl/namehack.h"
static vid_model_funcs_t model_funcs = {
Mod_LoadExternalTextures,
Mod_LoadLighting,
Mod_SubdivideSurface,
Mod_ProcessTexture,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
};
vid_render_funcs_t gl_vid_render_funcs = {
gl_Draw_Init,
gl_Draw_Character,
gl_Draw_String,
gl_Draw_nString,
gl_Draw_AltString,
gl_Draw_ConsoleBackground,
gl_Draw_Crosshair,
gl_Draw_CrosshairAt,
gl_Draw_TileClear,
gl_Draw_Fill,
gl_Draw_TextBox,
gl_Draw_FadeScreen,
gl_Draw_BlendScreen,
gl_Draw_CachePic,
gl_Draw_UncachePic,
gl_Draw_MakePic,
gl_Draw_DestroyPic,
gl_Draw_PicFromWad,
gl_Draw_Pic,
gl_Draw_Picf,
gl_Draw_SubPic,
gl_SCR_UpdateScreen,
SCR_DrawRam,
SCR_DrawTurtle,
SCR_DrawPause,
gl_SCR_CaptureBGR,
gl_SCR_ScreenShot,
SCR_DrawStringToSnap,
gl_Fog_Update,
gl_Fog_ParseWorldspawn,
gl_R_ClearState,
gl_R_LoadSkys,
gl_R_NewMap,
R_AddEfrags,
R_RemoveEfrags,
R_EnqueueEntity,
gl_R_LineGraph,
R_AllocDlight,
R_AllocEntity,
gl_R_RenderView,
R_DecayLights,
0,
0,
&model_funcs
};
static general_funcs_t plugin_info_general_funcs = {
};
@ -46,7 +119,7 @@ static plugin_funcs_t plugin_info_funcs = {
0,
0,
0,
&vid_render_funcs,
&gl_vid_render_funcs,
};
static plugin_data_t plugin_info_data = {

View file

@ -1,5 +1,5 @@
/*
vid_render_gl.c
vid_render_glsl.c
GLSL version of the renderer
@ -28,12 +28,85 @@
# include "config.h"
#endif
#define NH_DEFINE
#include "glsl/namehack.h"
#include "QF/plugin/general.h"
#include "QF/plugin/vid_render.h"
#include "mod_internal.h"
#include "r_internal.h"
#include "glsl/namehack.h"
static vid_model_funcs_t model_funcs = {
Mod_LoadExternalTextures,
Mod_LoadLighting,
Mod_SubdivideSurface,
Mod_ProcessTexture,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
};
vid_render_funcs_t glsl_vid_render_funcs = {
glsl_Draw_Init,
glsl_Draw_Character,
glsl_Draw_String,
glsl_Draw_nString,
glsl_Draw_AltString,
glsl_Draw_ConsoleBackground,
glsl_Draw_Crosshair,
glsl_Draw_CrosshairAt,
glsl_Draw_TileClear,
glsl_Draw_Fill,
glsl_Draw_TextBox,
glsl_Draw_FadeScreen,
glsl_Draw_BlendScreen,
glsl_Draw_CachePic,
glsl_Draw_UncachePic,
glsl_Draw_MakePic,
glsl_Draw_DestroyPic,
glsl_Draw_PicFromWad,
glsl_Draw_Pic,
glsl_Draw_Picf,
glsl_Draw_SubPic,
glsl_SCR_UpdateScreen,
SCR_DrawRam,
SCR_DrawTurtle,
SCR_DrawPause,
glsl_SCR_CaptureBGR,
glsl_SCR_ScreenShot,
SCR_DrawStringToSnap,
glsl_Fog_Update,
glsl_Fog_ParseWorldspawn,
glsl_R_ClearState,
glsl_R_LoadSkys,
glsl_R_NewMap,
R_AddEfrags,
R_RemoveEfrags,
R_EnqueueEntity,
glsl_R_LineGraph,
R_AllocDlight,
R_AllocEntity,
glsl_R_RenderView,
R_DecayLights,
0,
0,
&model_funcs
};
static general_funcs_t plugin_info_general_funcs = {
};
@ -46,7 +119,7 @@ static plugin_funcs_t plugin_info_funcs = {
0,
0,
0,
&vid_render_funcs,
&glsl_vid_render_funcs,
};
static plugin_data_t plugin_info_data = {

View file

@ -34,6 +34,74 @@
#include "mod_internal.h"
#include "r_internal.h"
static vid_model_funcs_t model_funcs = {
Mod_LoadExternalTextures,
Mod_LoadLighting,
Mod_SubdivideSurface,
Mod_ProcessTexture,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
};
vid_render_funcs_t sw_vid_render_funcs = {
Draw_Init,
Draw_Character,
Draw_String,
Draw_nString,
Draw_AltString,
Draw_ConsoleBackground,
Draw_Crosshair,
Draw_CrosshairAt,
Draw_TileClear,
Draw_Fill,
Draw_TextBox,
Draw_FadeScreen,
Draw_BlendScreen,
Draw_CachePic,
Draw_UncachePic,
Draw_MakePic,
Draw_DestroyPic,
Draw_PicFromWad,
Draw_Pic,
Draw_Picf,
Draw_SubPic,
SCR_UpdateScreen,
SCR_DrawRam,
SCR_DrawTurtle,
SCR_DrawPause,
SCR_CaptureBGR,
SCR_ScreenShot,
SCR_DrawStringToSnap,
0,
0,
R_ClearState,
R_LoadSkys,
R_NewMap,
R_AddEfrags,
R_RemoveEfrags,
R_EnqueueEntity,
R_LineGraph,
R_AllocDlight,
R_AllocEntity,
R_RenderView,
R_DecayLights,
D_FlushCaches,
0,
&model_funcs
};
static general_funcs_t plugin_info_general_funcs = {
};
@ -46,7 +114,7 @@ static plugin_funcs_t plugin_info_funcs = {
0,
0,
0,
&vid_render_funcs,
&sw_vid_render_funcs,
};
static plugin_data_t plugin_info_data = {

View file

@ -28,12 +28,85 @@
# include "config.h"
#endif
#define NH_DEFINE
#include "sw32/namehack.h"
#include "QF/plugin/general.h"
#include "QF/plugin/vid_render.h"
#include "mod_internal.h"
#include "r_internal.h"
#include "sw32/namehack.h"
static vid_model_funcs_t model_funcs = {
Mod_LoadExternalTextures,
Mod_LoadLighting,
Mod_SubdivideSurface,
Mod_ProcessTexture,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,
Skin_SetColormap,
Skin_SetSkin,
Skin_SetupSkin,
Skin_SetTranslation,
Skin_ProcessTranslation,
Skin_InitTranslations,
Skin_Init_Textures,
Skin_SetPlayerSkin,
};
vid_render_funcs_t sw32_vid_render_funcs = {
sw32_Draw_Init,
sw32_Draw_Character,
sw32_Draw_String,
sw32_Draw_nString,
sw32_Draw_AltString,
sw32_Draw_ConsoleBackground,
sw32_Draw_Crosshair,
sw32_Draw_CrosshairAt,
sw32_Draw_TileClear,
sw32_Draw_Fill,
sw32_Draw_TextBox,
sw32_Draw_FadeScreen,
sw32_Draw_BlendScreen,
sw32_Draw_CachePic,
sw32_Draw_UncachePic,
sw32_Draw_MakePic,
sw32_Draw_DestroyPic,
sw32_Draw_PicFromWad,
sw32_Draw_Pic,
sw32_Draw_Picf,
sw32_Draw_SubPic,
sw32_SCR_UpdateScreen,
SCR_DrawRam,
SCR_DrawTurtle,
SCR_DrawPause,
sw32_SCR_CaptureBGR,
sw32_SCR_ScreenShot,
SCR_DrawStringToSnap,
0,
0,
sw32_R_ClearState,
sw32_R_LoadSkys,
sw32_R_NewMap,
R_AddEfrags,
R_RemoveEfrags,
R_EnqueueEntity,
sw32_R_LineGraph,
R_AllocDlight,
R_AllocEntity,
sw32_R_RenderView,
R_DecayLights,
sw32_D_FlushCaches,
0,
&model_funcs
};
static general_funcs_t plugin_info_general_funcs = {
};
@ -46,7 +119,7 @@ static plugin_funcs_t plugin_info_funcs = {
0,
0,
0,
&vid_render_funcs,
&sw32_vid_render_funcs,
};
static plugin_data_t plugin_info_data = {