1 /*
2 	vid_render_glsl.c
3 
4 	GLSL version of the renderer
5 
6 	Copyright (C) 2012 Bill Currie <bill@taniwha.org>
7 
8 	This program is free software; you can redistribute it and/or
9 	modify it under the terms of the GNU General Public License
10 	as published by the Free Software Foundation; either version 2
11 	of the License, or (at your option) any later version.
12 
13 	This program is distributed in the hope that it will be useful,
14 	but WITHOUT ANY WARRANTY; without even the implied warranty of
15 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 	See the GNU General Public License for more details.
18 
19 	You should have received a copy of the GNU General Public License
20 	along with this program; if not, write to:
21 
22 		Free Software Foundation, Inc.
23 		59 Temple Place - Suite 330
24 		Boston, MA  02111-1307, USA
25 
26 */
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #define NH_DEFINE
32 #include "glsl/namehack.h"
33 
34 #include "QF/plugin/general.h"
35 #include "QF/plugin/vid_render.h"
36 
37 #include "QF/GLSL/qf_vid.h"
38 
39 #include "mod_internal.h"
40 #include "r_internal.h"
41 
42 #include "glsl/namehack.h"
43 
44 static vid_model_funcs_t model_funcs = {
45 	glsl_Mod_LoadExternalTextures,
46 	glsl_Mod_LoadLighting,
47 	glsl_Mod_SubdivideSurface,
48 	glsl_Mod_ProcessTexture,
49 
50 	Mod_LoadIQM,
51 	Mod_LoadAliasModel,
52 	Mod_LoadSpriteModel,
53 
54 	glsl_Mod_MakeAliasModelDisplayLists,
55 	glsl_Mod_LoadSkin,
56 	glsl_Mod_FinalizeAliasModel,
57 	glsl_Mod_LoadExternalSkins,
58 	glsl_Mod_IQMFinish,
59 	0,
60 	glsl_Mod_SpriteLoadTexture,
61 
62 	Skin_SetColormap,
63 	Skin_SetSkin,
64 	glsl_Skin_SetupSkin,
65 	Skin_SetTranslation,
66 	glsl_Skin_ProcessTranslation,
67 	glsl_Skin_InitTranslations,
68 };
69 
70 vid_render_funcs_t glsl_vid_render_funcs = {
71 	glsl_Draw_Init,
72 	glsl_Draw_Character,
73 	glsl_Draw_String,
74 	glsl_Draw_nString,
75 	glsl_Draw_AltString,
76 	glsl_Draw_ConsoleBackground,
77 	glsl_Draw_Crosshair,
78 	glsl_Draw_CrosshairAt,
79 	glsl_Draw_TileClear,
80 	glsl_Draw_Fill,
81 	glsl_Draw_TextBox,
82 	glsl_Draw_FadeScreen,
83 	glsl_Draw_BlendScreen,
84 	glsl_Draw_CachePic,
85 	glsl_Draw_UncachePic,
86 	glsl_Draw_MakePic,
87 	glsl_Draw_DestroyPic,
88 	glsl_Draw_PicFromWad,
89 	glsl_Draw_Pic,
90 	glsl_Draw_Picf,
91 	glsl_Draw_SubPic,
92 
93 	glsl_SCR_UpdateScreen,
94 	SCR_DrawRam,
95 	SCR_DrawTurtle,
96 	SCR_DrawPause,
97 	glsl_SCR_CaptureBGR,
98 	glsl_SCR_ScreenShot,
99 	SCR_DrawStringToSnap,
100 
101 	glsl_Fog_Update,
102 	glsl_Fog_ParseWorldspawn,
103 
104 	glsl_R_Init,
105 	glsl_R_ClearState,
106 	glsl_R_LoadSkys,
107 	glsl_R_NewMap,
108 	R_AddEfrags,
109 	R_RemoveEfrags,
110 	R_EnqueueEntity,
111 	glsl_R_LineGraph,
112 	R_AllocDlight,
113 	R_AllocEntity,
114 	glsl_R_RenderView,
115 	R_DecayLights,
116 	glsl_R_ViewChanged,
117 	glsl_R_ClearParticles,
118 	glsl_R_InitParticles,
119 	glsl_SCR_ScreenShot_f,
120 	glsl_r_easter_eggs_f,
121 	glsl_r_particles_style_f,
122 	0,
123 	&model_funcs
124 };
125 
126 static void
glsl_vid_render_init(void)127 glsl_vid_render_init (void)
128 {
129 	vr_data.vid->set_palette = GLSL_SetPalette;
130 	vr_data.vid->init_gl = GLSL_Init_Common;
131 	vr_data.vid->load_gl ();
132 	vr_funcs = &glsl_vid_render_funcs;
133 	m_funcs = &model_funcs;
134 }
135 
136 static void
glsl_vid_render_shutdown(void)137 glsl_vid_render_shutdown (void)
138 {
139 }
140 
141 static general_funcs_t plugin_info_general_funcs = {
142 	glsl_vid_render_init,
143 	glsl_vid_render_shutdown,
144 };
145 
146 static general_data_t plugin_info_general_data;
147 
148 static plugin_funcs_t plugin_info_funcs = {
149 	&plugin_info_general_funcs,
150 	0,
151 	0,
152 	0,
153 	0,
154 	0,
155 	&glsl_vid_render_funcs,
156 };
157 
158 static plugin_data_t plugin_info_data = {
159 	&plugin_info_general_data,
160 	0,
161 	0,
162 	0,
163 	0,
164 	0,
165 	&vid_render_data,
166 };
167 
168 static plugin_t plugin_info = {
169 	qfp_snd_render,
170 	0,
171 	QFPLUGIN_VERSION,
172 	"0.1",
173 	"GLSL Renderer",
174 	"Copyright (C) 1996-1997  Id Software, Inc.\n"
175 	"Copyright (C) 1999-2012  contributors of the QuakeForge project\n"
176 	"Please see the file \"AUTHORS\" for a list of contributors",
177 	&plugin_info_funcs,
178 	&plugin_info_data,
179 };
180 
PLUGIN_INFO(vid_render,glsl)181 PLUGIN_INFO(vid_render, glsl)
182 {
183 	return &plugin_info;
184 }
185