FTEQW
Documentation of the FTE engine source tree.
render.h
Go to the documentation of this file.
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20
21// refresh.h -- public interface to refresh functions
22
23// default soldier colors
24#define TOP_DEFAULT 1
25#define BOTTOM_DEFAULT 6
26
27#define TOP_RANGE (TOP_DEFAULT<<4)
28#define BOTTOM_RANGE (BOTTOM_DEFAULT<<4)
29
30struct msurface_s;
31struct batch_s;
32struct model_s;
33struct texnums_s;
34struct texture_s;
35
36static const texid_t r_nulltex = NULL;
37
38//GLES2 requires GL_UNSIGNED_SHORT (gles3 or GL_OES_element_index_uint relax this requirement)
39//geforce4 only does shorts. gffx can do ints, but with a performance hit (like most things on that gpu)
40//ati is generally more capable, but generally also has a smaller market share
41//desktop-gl will generally cope with ints, but expect a performance hit from that with old gpus (so we don't bother)
42//vulkan+dx10 can cope with ints, but might be 24bit
43//either way, all renderers in the same build need to use the same thing.
44#ifndef sizeof_index_t
45 #ifdef VERTEXINDEXBYTES //maybe set in config_*.h
46 #define sizeof_index_t VERTEXINDEXBYTES
47 #elif (defined(GLQUAKE) && defined(HAVE_LEGACY)) || defined(MINIMAL) || defined(D3D8QUAKE) || defined(D3D9QUAKE) || defined(ANDROID) || defined(FTE_TARGET_WEB)
48 #define sizeof_index_t 2
49 #endif
50#endif
51#if sizeof_index_t == 2
52 #define GL_INDEX_TYPE GL_UNSIGNED_SHORT
53 #define D3DFMT_QINDEX D3DFMT_INDEX16
54 #define DXGI_FORMAT_INDEX_UINT DXGI_FORMAT_R16_UINT
55 #define VK_INDEX_TYPE VK_INDEX_TYPE_UINT16
56 typedef unsigned short index_t;
57 #define MAX_INDICIES 0xffffu
58#else
59 #undef sizeof_index_t
60 #define sizeof_index_t 4
61 #define GL_INDEX_TYPE GL_UNSIGNED_INT
62 #define D3DFMT_QINDEX D3DFMT_INDEX32
63 #define DXGI_FORMAT_INDEX_UINT DXGI_FORMAT_R32_UINT
64 #define VK_INDEX_TYPE VK_INDEX_TYPE_UINT32
65 typedef unsigned int index_t;
66 #define MAX_INDICIES 0x00ffffffu
67#endif
68
69//=============================================================================
70
71//the eye doesn't see different colours in the same proportion.
72//must add to slightly less than 1
73#define NTSC_RED 0.299
74#define NTSC_GREEN 0.587
75#define NTSC_BLUE 0.114
76#define NTSC_SUM (NTSC_RED + NTSC_GREEN + NTSC_BLUE)
77
78typedef enum {
86 RT_PORTALSURFACE, // doesn't draw anything, just info for portals
87 //q3 ones stop here.
88
89 //fte ones start here
90 RT_PORTALCAMERA, // an alternative to RT_PORTALSURFACE.
91
94
95typedef unsigned int skinid_t; //skin 0 is 'unused'
96
97struct dlight_s;
98typedef struct entity_s
99{
100 //FIXME: instancing somehow. separate visentity+visinstance. only viable with full glsl though.
101 //will need to generate a vbo somehow for the instances.
102
103 int keynum; // for matching entities in different frames
105 vec3_t angles; // fixme: should be redundant.
107
108 vec4_t shaderRGBAf; /*colormod+alpha, available for shaders to mix*/
109 float shaderTime; /*timestamp, for syncing shader times to spawns*/
110 vec3_t glowmod; /*meant to be a multiplier for the fullbrights*/
111
112 int light_known; /*bsp lighting has been calced*/
113 vec3_t light_avg; /*midpoint level*/
114 vec3_t light_range; /*avg + this = max, avg - this = min*/
116
117 vec3_t oldorigin; /*for q2/q3 beams*/
118
119 struct model_s *model; // NULL = no model
120 int skinnum; // for Alias models
121 skinid_t customskin; // quake3 style skins
122
123 int playerindex; //for qw skins
124 int topcolour; //colourmapping
125 int bottomcolour; //colourmapping
126#ifdef HEXEN2
127 int h2playerclass; //hexen2's quirky colourmapping
128#endif
129
130// struct efrag_s *efrag; // linked list of efrags (FIXME)
131// int visframe; // last frame this entity was
132 // found in an active leaf
133 // only used for static objects
134
135// int dlightframe; // dynamic lighting
136// dlightbitmask_t dlightbits;
137
138// FIXME: could turn these into a union
139// int trivial_accept;
140// struct mnode_s *topnode; // for bmodels, first world node
141 // that splits bmodel, or NULL if
142 // not split
143
145
146 int flags;
147
149 float rotation;
150
152
153 pvscache_t pvscache; //for culling of csqc ents.
154
155#ifdef PEXT_SCALE
156 float scale;
157#endif
158#ifdef PEXT_FATNESS
159 float fatness;
160#endif
161#ifdef HEXEN2
164#endif
166
167#define MAX_GEOMSETS 32
168#define Q1UNSPECIFIED 0x00ffffff //0xffRRGGBB or 0x0000000V are both valid values. so this is an otherwise-illegal value to say its not been set.
169typedef struct
170{
172 char skinname[MAX_QPATH];
175 qbyte geomset[MAX_GEOMSETS]; //allows selecting a single set of geometry from alternatives. this might be a can of worms.
176#ifdef QWSKINS
177 char qwskinname[MAX_QPATH];
179 unsigned int q1upper; //Q1UNSPECIFIED
180 unsigned int q1lower; //Q1UNSPECIFIED
181#endif
182 struct
183 {
184 char surface[MAX_QPATH];
187 int needsfree; //which textures need to be freed.
188 } mappings[1];
189} skinfile_t;
190
191// plane_t structure
192typedef struct mplane_s
193{
195 float dist;
196 qbyte type; // for texture axis selection and fast side tests
197 qbyte signbits; // signx + signy<<1 + signz<<1
200#define MAXFRUSTUMPLANES 7 //4 side, 1 near, 1 far (fog), 1 water plane.
201
202typedef struct
203{
204 //note: uniforms expect specific padding/ordering. be really careful with reordering this
205 vec3_t colour; //w_fog[0].xyz
206 float alpha; //w_fog[0].w scales clamped fog value
207 float density; //w_fog[1].x egads, everyone has a different opinion.
208 float depthbias; //w_fog[1].y distance until the fog actually starts
209 float glslpad1; //w_fog[1].z
210 float glslpad2; //w_fog[1].w
211
212// float start;
213// float end;
214// float height;
215// float fadedepth;
216
217 float time; //timestamp for when its current.
218} fogstate_t;
219void CL_BlendFog(fogstate_t *result, fogstate_t *oldf, float time, fogstate_t *newf);
220void CL_ResetFog(int fogtype);
221
222typedef enum {
229
230 //these are internal methods and do not form part of any public API
234
235typedef enum
236{
238 PROJ_STEREOGRAPHIC = 1, //aka panini
239 PROJ_FISHEYE = 2, //standard fisheye
240 PROJ_PANORAMA = 3, //for nice panoramas
241 PROJ_LAEA = 4, //lambert azimuthal equal-area
242 PROJ_EQUIRECTANGULAR = 5 //projects a sphere into 2d. used by vr screenshots.
244
245typedef struct {
246 char texname[MAX_QPATH];
247} rtname_t;
248#define R_MAX_RENDERTARGETS 8
249
250#ifndef R_MAX_RECURSE
251#define R_MAX_RECURSE 6
252#endif
253#define RDFD_FOV 1
254typedef struct refdef_s
255{
256 vrect_t grect; // game rectangle. fullscreen except for csqc/splitscreen/hud.
257 vrect_t vrect; // subwindow in grect for 3d view. equal to grect if no hud.
258
259 vec3_t pvsorigin; /*render the view using this point for pvs (useful for mirror views)*/
260 vec3_t vieworg; /*logical view center*/
262 vec3_t viewaxis[3]; /*forward, left, up (NOT RIGHT)*/
263 vec3_t eyeoffset; /*world space, for vr screenies*/
264 vec2_t projectionoffset; /*for off-centre rendering*/
265
266 qboolean base_known; /*otherwise we do some fallback behaviour (ie: viewangles.0y0 and forcing input_angles)*/
267 vec3_t base_angles, base_origin; /*for vr output, overrides per-eye viewangles according to that eye's matrix.*/
268
269 vec3_t weaponmatrix[4]; /*forward/left/up/origin*/
270 vec3_t weaponmatrix_bob[4]; /*forward/left/up/origin*/
271
272 float fov_x, fov_y, afov;
273 float fovv_x, fovv_y; //viewmodel fovs
274 float mindist, maxdist; //maxdist may be 0, for 'infinite', in which case mindist probably isn't valid either.
275
278 int flags; //(Q2)RDF_ flags
279 int dirty;
280
282// int currentplayernum;
283
284 float time;
285// float waterheight; //updated by the renderer. stuff sitting at this height generate ripple effects
286
287 float m_projection_std[16]; //projection matrix for normal stuff
288 float m_projection_view[16]; //projection matrix for the viewmodel. because people are weird.
289 float m_view[16];
290 qbyte *scenevis; /*this is the vis that's currently being draw*/
291 int *sceneareas; /*this is the area info for the camera (should normally be count+one area, but could be two areas near an opaque water plane)*/
292
293 mplane_t frustum[MAXFRUSTUMPLANES];
294 int frustum_numworldplanes; //all but far, which isn't culled because this wouldn't cover the entire screen.
295 int frustum_numplanes; //includes far plane (which is reduced with fog).
296
299
300 vec3_t skyroom_pos; /*the camera position for sky rooms*/
301 vec4_t skyroom_spin; /*the camera spin for sky rooms*/
302 qboolean skyroom_enabled; /*whether a skyroom position is defined*/
303 int firstvisedict; /*so we can skip visedicts in skies*/
304
305 pxrect_t pxrect; /*vrect, but in pixels rather than virtual coords*/
306 qboolean externalview; /*draw external models and not viewmodels*/
307 int recurse; /*in a mirror/portal/half way through drawing something else*/
308 qboolean forcevis; /*if true, vis comes from the forcedvis field instead of recalculated*/
309 unsigned int flipcull; /*reflected/flipped view, requires inverted culling (should be set to SHADER_CULL_FLIPPED or 0 - its implemented as a xor)*/
310 unsigned int colourmask; /*shaderbits mask. anything not here will be forced to 0. this is for red/green type stereo*/
311 qboolean useperspective; /*not orthographic*/
312
314 rtname_t rt_destcolour[R_MAX_RENDERTARGETS]; /*used for 2d. written by 3d*/
315 rtname_t rt_sourcecolour; /*read by 2d. not used for 3d. */
316 rtname_t rt_depth; /*read by 2d. used by 3d (renderbuffer used if not set)*/
317 rtname_t rt_ripplemap; /*read by 2d. used by 3d (internal ripplemap buffer used if not set)*/
318 rtname_t nearenvmap; /*provides a fallback endmap cubemap to render with*/
319
320 qbyte *forcedvis; /*set if forcevis is set*/
322 qbyte areabits[MAX_MAP_AREA_BYTES];
323
324 vec4_t userdata[16]; /*for custom glsl*/
325
326 qboolean warndraw; /*buggy gamecode likes drawing outside of te drawing logic*/
328
329extern refdef_t r_refdef;
331
332extern struct texture_s *r_notexture_mip;
333
335
336void BE_GenModelBatches(struct batch_s **batches, const struct dlight_s *dl, unsigned int bemode, const qbyte *worldpvs, const int *worldareas); //if dl, filters based upon the dlight.
337
338//gl_alias.c
340void R_GAlias_DrawBatch(struct batch_s *batch);
341void R_GAlias_GenerateBatches(entity_t *e, struct batch_s **batches);
342void R_LightArraysByte_BGR(const entity_t *entity, vecV_t *coords, byte_vec4_t *colours, int vertcount, vec3_t *normals, qboolean colormod);
343void R_LightArrays(const entity_t *entity, vecV_t *coords, avec4_t *colours, int vertcount, vec3_t *normals, float scale, qboolean colormod);
344
345qboolean R_DrawSkyChain (struct batch_s *batch); /*called from the backend, and calls back into it*/
346void R_InitSky (shader_t *shader, const char *skyname, uploadfmt_t fmt, qbyte *src, unsigned int width, unsigned int height); /*generate q1 sky texnums*/
347
348void R_Clutter_Emit(struct batch_s **batches);
349void R_Clutter_Purge(void);
350
351//r_surf.c
352void Surf_NewMap (struct model_s *worldmodel);
353void Surf_PreNewMap(void);
354void Surf_SetupFrame(void); //determine pvs+viewcontents
355void Surf_DrawWorld(void);
356void Surf_GenBrushBatches(struct batch_s **batches, entity_t *ent);
357void Surf_StainSurf(struct model_s *mod, struct msurface_s *surf, float *parms);
358void Surf_AddStain(vec3_t org, float red, float green, float blue, float radius);
359void Surf_LessenStains(void);
360void Surf_WipeStains(void);
361void Surf_DeInit(void);
362void Surf_Clear(struct model_s *mod);
363void Surf_BuildLightmaps(void); //enables Surf_BuildModelLightmaps, calls it for each bsp.
364void Surf_ClearSceneCache(void); //stops Surf_BuildModelLightmaps from working.
365void Surf_BuildModelLightmaps (struct model_s *m); //rebuild lightmaps for a single bsp. beware of submodels.
367void Surf_RenderAmbientLightmaps (struct msurface_s *fa, int ambient);
368int Surf_LightmapShift (struct model_s *model);
369#define LMBLOCK_SIZE_MAX 2048 //single axis
370typedef struct glRect_s {
371 unsigned short l,t,r,b;
373typedef unsigned char stmap;
374struct mesh_s;
375typedef struct {
377 qboolean modified; //data was changed. consult rectchange to see the bounds.
378 qboolean external; //the data was loaded from a file (q3bsp feature where we shouldn't be blending lightmaps at all)
379 qboolean hasdeluxe; //says that the next lightmap index contains deluxemap info
380 uploadfmt_t fmt; //texture format that we're using
381 qbyte pixbytes; //yes, this means no compressed formats.
382 int width;
385 qbyte *lightmaps; //[pixbytes*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
386 stmap *stainmaps; //[3*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //rgb no a. added to lightmap for added (hopefully) speed.
387#ifdef GLQUAKE
388 int pbo_handle; //when set, lightmaps is a persistently mapped write-only pbo for us to scribble data into, ready to be copied to the actual texture without waiting for glTexSubImage to complete.
389#endif
391extern lightmapinfo_t **lightmap;
392extern int numlightmaps;
393
394void QDECL Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue);
395
396
397void R_Sky_Register(void);
398void R_SkyShutdown(void);
399void R_SetSky(const char *skyname);
401
402#if defined(GLQUAKE)
403void GLR_Init (void);
405void GLR_InitEfrags (void);
406void GLR_RenderView (void); // must set r_refdef first
407 // called whenever r_refdef or vid change
408void GLR_DrawPortal(struct batch_s *batch, struct batch_s **blist, struct batch_s *depthmasklist[2], int portaltype);
409
410void GLR_PushDlights (void);
412
413void GLVID_DeInit (void);
414void GLR_DeInit (void);
415void GLSCR_DeInit (void);
417#endif
418int R_LightPoint (vec3_t p);
419void R_RenderDlights (void);
420
421typedef struct
422{
423 int allocated[LMBLOCK_SIZE_MAX];
425 int lmnum;
426 unsigned int width;
427 unsigned int height;
429} lmalloc_t;
430void Mod_LightmapAllocInit(lmalloc_t *lmallocator, qboolean hasdeluxe, unsigned int width, unsigned int height, int firstlm); //firstlm is for debugging stray lightmap indexes
431//void Mod_LightmapAllocDone(lmalloc_t *lmallocator, model_t *mod);
432void Mod_LightmapAllocBlock(lmalloc_t *lmallocator, int w, int h, unsigned short *x, unsigned short *y, int *tnum);
433
435{
436 /*warning: many of these flags only apply the first time it is requested*/
437 IF_CLAMP = 1<<0, //disable texture coord wrapping.
438 IF_NOMIPMAP = 1<<1, //disable mipmaps.
439 IF_NEAREST = 1<<2, //force nearest
440 IF_LINEAR = 1<<3, //force linear
441 IF_UIPIC = 1<<4, //subject to texturemode2d
442 //IF_DEPTHCMD = 1<<5, //Reserved for d3d11
443 IF_SRGB = 1<<6, //texture data is srgb (read-as-linear)
444 /*WARNING: If the above are changed, be sure to change shader pass flags*/
445
447 IF_NOALPHA = 1<<8, /*hint rather than requirement*/
448 IF_NOGAMMA = 1<<9, /*do not apply texture-based gamma*/
449 IF_TEXTYPEMASK = (1<<10) | (1<<11) | (1<<12), /*0=2d, 1=3d, 2=cubeface, 3=2d array texture*/
450#define IF_TEXTYPESHIFT 10
451#define IF_TEXTYPE_2D (PTI_2D<<IF_TEXTYPESHIFT)
452#define IF_TEXTYPE_3D (PTI_3D<<IF_TEXTYPESHIFT)
453#define IF_TEXTYPE_CUBE (PTI_CUBE<<IF_TEXTYPESHIFT)
454#define IF_TEXTYPE_2D_ARRAY (PTI_2D_ARRAY<<IF_TEXTYPESHIFT)
455#define IF_TEXTYPE_CUBE_ARRAY (PTI_CUBE_ARRAY<<IF_TEXTYPESHIFT)
456#define IF_TEXTYPE_ANY (PTI_ANY<<IF_TEXTYPESHIFT)
457 IF_MIPCAP = 1<<13, //allow the use of d_mipcap
458 IF_PREMULTIPLYALPHA = 1<<14, //rgb *= alpha
459
460 IF_UNUSED15 = 1<<15, //
461 IF_UNUSED16 = 1<<16, //
462 IF_INEXACT = 1<<17, //subdir info isn't to be used for matching
463
464 IF_WORLDTEX = 1<<18, //gl_picmip_world
465 IF_SPRITETEX = 1<<19, //gl_picmip_sprites
466 IF_NOSRGB = 1<<20, //ignore srgb when loading. this is guarenteed to be linear, for normalmaps etc.
467
468 IF_PALETTIZE = 1<<21, //convert+load it as an RTI_P8 texture for the current palette/colourmap
469 IF_NOPURGE = 1<<22, //texture is not flushed when no more shaders refer to it (for C code that holds a permanant reference to it - still purged on vid_reloads though)
470 IF_HIGHPRIORITY = 1<<23, //pushed to start of worker queue instead of end...
471 IF_LOWPRIORITY = 1<<24, //
472 IF_LOADNOW = 1<<25, /*hit the disk now, and delay the gl load until its actually needed. this is used only so that the width+height are known in advance. valid on worker threads.*/
473 IF_NOPCX = 1<<26, /*block pcx format. meaning qw skins can use team colours and cropping*/
474 IF_TRYBUMP = 1<<27, /*attempt to load _bump if the specified _norm texture wasn't found*/
475 IF_RENDERTARGET = 1<<28, /*never loaded from disk, loading can't fail*/
476 IF_EXACTEXTENSION = 1<<29, /*don't mangle extensions, use what is specified and ONLY that*/
477 IF_NOREPLACE = 1<<30, /*don't load a replacement, for some reason*/
478 IF_NOWORKER = 1u<<31 /*don't pass the work to a loader thread. this gives fully synchronous loading. only valid from the main thread.*/
480
481#define R_LoadTexture8(id,w,h,d,f,t) Image_GetTexture(id, NULL, f, d, NULL, w, h, t?TF_TRANS8:TF_SOLID8)
482#define R_LoadTexture32(id,w,h,d,f) Image_GetTexture(id, NULL, f, d, NULL, w, h, TF_RGBA32)
483#define R_LoadTextureFB(id,w,h,d,f) Image_GetTexture(id, NULL, f, d, NULL, w, h, TF_TRANS8_FULLBRIGHT)
484#define R_LoadTexture(id,w,h,fmt,d,fl) Image_GetTexture(id, NULL, fl, d, NULL, w, h, fmt)
485
487image_t *Image_FindTexture (const char *identifier, const char *subpath, unsigned int flags);
488image_t *Image_CreateTexture(const char *identifier, const char *subpath, unsigned int flags);
489image_t *QDECL Image_GetTexture (const char *identifier, const char *subpath, unsigned int flags, void *fallbackdata, void *fallbackpalette, int fallbackwidth, int fallbackheight, uploadfmt_t fallbackfmt);
490qboolean Image_UnloadTexture(image_t *tex); //true if it did something.
492qboolean Image_LoadTextureFromMemory(texid_t tex, int flags, const char *iname, const char *fname, qbyte *filedata, int filesize); //intended really for worker threads, but should be fine from the main thread too
493qboolean Image_LocateHighResTexture(image_t *tex, flocation_t *bestloc, char *bestname, size_t bestnamesize, unsigned int *bestflags);
494void Image_Upload (texid_t tex, uploadfmt_t fmt, void *data, void *palette, int width, int height, int depth, unsigned int flags);
495void Image_Purge(void); //purge any textures which are not needed any more (releases memory, but doesn't give null pointers).
496void Image_Init(void);
497void Image_Shutdown(void);
498void Image_PrintInputFormatVersions(void); //for version info
499qboolean Image_WriteKTXFile(const char *filename, enum fs_relative fsroot, struct pendingtextureinfo *mips);
500qboolean Image_WriteDDSFile(const char *filename, enum fs_relative fsroot, struct pendingtextureinfo *mips);
501void Image_BlockSizeForEncoding(uploadfmt_t encoding, unsigned int *blockbytes, unsigned int *blockwidth, unsigned int *blockheight, unsigned int *blockdepth);
502const char *Image_FormatName(uploadfmt_t encoding);
504image_t *Image_LoadTexture (const char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags);
505struct pendingtextureinfo *Image_LoadMipsFromMemory(int flags, const char *iname, const char *fname, qbyte *filedata, int filesize);
506void Image_ChangeFormat(struct pendingtextureinfo *mips, qboolean *allowedformats, uploadfmt_t origfmt, const char *imagename);
508void *Image_FlipImage(const void *inbuffer, void *outbuffer, int *inoutwidth, int *inoutheight, int pixelbytes, qboolean flipx, qboolean flipy, qboolean flipd);
509
510typedef struct
511{
512 const char *loadername;
515 struct pendingtextureinfo *(*ReadImageFile)(unsigned int imgflags, const char *fname, qbyte *filedata, size_t filesize);
516#define plugimageloaderfuncs_name "ImageLoader"
519
520#ifdef D3D8QUAKE
521void D3D8_Set2D (void);
522void D3D8_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis);
525#endif
526#ifdef D3D9QUAKE
527void D3D9_Set2D (void);
528void D3D9_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis);
531#endif
532#ifdef D3D11QUAKE
533void D3D11_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis);
536#endif
537
538//extern int image_width, image_height;
539texid_t R_LoadReplacementTexture(const char *name, const char *subpath, unsigned int flags, void *lowres, int lowreswidth, int lowresheight, uploadfmt_t fmt);
540texid_tf R_LoadHiResTexture(const char *name, const char *subpath, unsigned int flags);
541texid_tf R_LoadBumpmapTexture(const char *name, const char *subpath);
542void R_LoadNumberedLightTexture(struct dlight_s *dl, int cubetexnum);
543
547extern texid_t balltexture;
548extern texid_t beamtexture;
549extern texid_t ptritexture;
550
551skinid_t Mod_RegisterSkinFile(const char *skinname);
552skinid_t Mod_ReadSkinFile(const char *skinname, const char *skintext);
553void Mod_WipeSkin(skinid_t id, qboolean force);
555
557void Mod_Shutdown (qboolean final);
558int Mod_TagNumForName(struct model_s *model, const char *name, int firsttag);
559int Mod_SkinNumForName(struct model_s *model, int surfaceidx, const char *name);
560int Mod_FrameNumForName(struct model_s *model, int surfaceidx, const char *name);
561int Mod_FrameNumForAction(struct model_s *model, int surfaceidx, int actionid);
562float Mod_GetFrameDuration(struct model_s *model, int surfaceidx, int frameno);
563
564void Mod_ResortShaders(void);
565void Mod_ClearAll (void);
566struct model_s *Mod_FindName (const char *name);
567void *Mod_Extradata (struct model_s *mod); // handles caching
568void Mod_TouchModel (const char *name);
569void Mod_RebuildLightmaps (void);
570
571void Mod_NowLoadExternal(struct model_s *loadmodel);
572void GLR_LoadSkys (void);
573void R_BloomRegister(void);
574
575int Mod_RegisterModelFormatText(void *module, const char *formatname, char *magictext, qboolean (QDECL *load) (struct model_s *mod, void *buffer, size_t fsize));
576int Mod_RegisterModelFormatMagic(void *module, const char *formatname, qbyte *magic, size_t magicsize, qboolean (QDECL *load) (struct model_s *mod, void *buffer, size_t fsize));
577void Mod_UnRegisterModelFormat(void *module, int idx);
579void Mod_ModelLoaded(void *ctx, void *data, size_t a, size_t b);
580void Mod_SubmodelLoaded(struct model_s *mod, int state);
581
582#ifdef RUNTIMELIGHTING
583struct relight_ctx_s;
584struct llightinfo_s;
585void LightPlane (struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[MAXCPULIGHTMAPS], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale); //special version that doesn't know what a face is or anything.
586struct relight_ctx_s *LightStartup(struct relight_ctx_s *ctx, struct model_s *model, qboolean shadows, qboolean skiplit);
587void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles);
588void LightShutdown(struct relight_ctx_s *ctx);
589extern const size_t lightthreadctxsize;
590
591qboolean RelightSetup (struct model_s *model, size_t lightsamples, qboolean generatelit);
592void RelightThink (void);
593const char *RelightGetProgress(float *progress); //reports filename and progress
594void RelightTerminate(struct model_s *mod); //NULL acts as a wildcard
595#endif
596
598{
599 void (*buildfunc)(struct model_s *mod, struct msurface_s *surf, struct builddata_s *bd);
601 void *facedata;
602};
603void Mod_Batches_Build(struct model_s *mod, struct builddata_s *bd);
604shader_t *Mod_RegisterBasicShader(struct model_s *mod, const char *texname, unsigned int usageflags, const char *shadertext, uploadfmt_t pixelfmt, unsigned int width, unsigned int height, void *pixeldata, void *palettedata);
605
606extern struct model_s *currentmodel;
607
608void Media_CaptureDemoEnd(void);
609void Media_RecordFrame (void);
611int Media_Capturing (void);
612double Media_TweekCaptureFrameTime(double oldtime, double time);
614void Media_VideoRestarting(void);
615void Media_VideoRestarted(void);
616
617void MYgluPerspective(double fovx, double fovy, double zNear, double zFar);
618
619void R_PushDlights (void);
620void R_SetFrustum (float projmat[16], float viewmat[16]);
623struct plugvrfuncs_s;
624qboolean R_RegisterVRDriver(void *module, struct plugvrfuncs_s *vrfuncs);
626void R_AnimateLight (void);
627void R_UpdateHDR(vec3_t org);
628void R_UpdateLightStyle(unsigned int style, const char *stylestring, float r, float g, float b);
629void R_BumpLightstyles(unsigned int maxstyle); //bumps the cl_max_lightstyles array size, if needed.
631struct texture_s *R_TextureAnimation (int frame, struct texture_s *base); //mostly deprecated, only lingers for rtlights so world only.
632struct texture_s *R_TextureAnimation_Q2 (struct texture_s *base); //mostly deprecated, only lingers for rtlights so world only.
633void RQ_Init(void);
634void RQ_Shutdown(void);
635
636qboolean WritePCXfile (const char *filename, enum fs_relative fsroot, qbyte *data, int width, int height, int rowbytes, qbyte *palette, qboolean upload); //data is 8bit.
637qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height);
638void *ReadTargaFile(qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean greyonly, uploadfmt_t forceformat);
639qbyte *ReadPNGFile(const char *fname, qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean force_rgb32);
641
642qbyte *ReadRawImageFile(qbyte *buf, int len, int *width, int *height, uploadfmt_t *format, qboolean force_rgba8, const char *fname);
643void *Image_ResampleTexture (uploadfmt_t format, const void *in, int inwidth, int inheight, void *out, int outwidth, int outheight);
644void Image_ReadExternalAlpha(qbyte *rgbadata, size_t imgwidth, size_t imgheight, const char *fname, uploadfmt_t *format);
646void SaturateR8G8B8(qbyte *data, int size, float sat);
647void AddOcranaLEDsIndexed (qbyte *image, int h, int w);
648
649void Renderer_Init(void);
650void Renderer_Start(void);
652void R_ShutdownRenderer(qboolean videotoo);
653void R_RestartRenderer_f (void);//this goes here so we can save some stack when first initing the sw renderer.
654
655//used to live in glquake.h
656qbyte GetPaletteIndexRange(int first, int stop, int red, int green, int blue);
657qbyte GetPaletteIndex(int red, int green, int blue);
658extern cvar_t r_norefresh;
660extern cvar_t r_drawworld;
663extern cvar_t r_speeds;
664extern cvar_t r_waterwarp;
665extern cvar_t r_fullbright;
666extern cvar_t r_lightmap;
668extern cvar_t r_skyfog; //additional fog alpha on sky
677extern cvar_t r_mirroralpha;
678extern cvar_t r_wateralpha;
679extern cvar_t r_lavaalpha;
680extern cvar_t r_slimealpha;
681extern cvar_t r_telealpha;
682extern cvar_t r_waterstyle;
683extern cvar_t r_lavastyle;
684extern cvar_t r_slimestyle;
685extern cvar_t r_telestyle;
686extern cvar_t r_dynamic;
688extern cvar_t r_novis;
689extern cvar_t r_netgraph;
692#ifdef RTLIGHTS
693extern qboolean r_fakeshadows; //enables the use of ortho model-only shadows
694#endif
695extern float r_blobshadows;
699extern int r_lightprepass; //0=off,1=16bit,2=32bit
700
701#ifdef R_XFLIP
702extern cvar_t r_xflip;
703#endif
704
706extern cvar_t r_clear;
707extern cvar_t r_clearcolour;
708extern cvar_t gl_poly;
710extern cvar_t r_renderscale;
711extern cvar_t gl_nohwblend;
718#ifdef QWSKINS
719extern cvar_t gl_nocolors;
720#endif
721extern cvar_t gl_load24bit;
722extern cvar_t gl_finish;
723
724extern cvar_t gl_max_size;
725extern cvar_t gl_playermip;
726
728
729#ifdef FTEPLUGIN //evil hack... boo hiss.
731extern cvar_t *cvar_r_meshroll;
732#define r_meshpitch (*cvar_r_meshpitch)
733#define r_meshroll (*cvar_r_meshroll)
734#else
735extern cvar_t r_meshpitch;
736extern cvar_t r_meshroll; //gah!
737#endif
739
740enum {
761
764extern int rspeeds[RSPEED_MAX];
765
766enum {
767 RQUANT_MSECS, //old r_speeds
773
778
783
786extern int rquant[RQUANT_MAX];
787
788#define RQuantAdd(type,quant) rquant[type] += quant
789
790#if 0//defined(NDEBUG) || !defined(_WIN32)
791#define RSpeedLocals()
792#define RSpeedMark()
793#define RSpeedRemark()
794#define RSpeedEnd(spt)
795#else
796#define RSpeedLocals() double rsp
797#define RSpeedMark() double rsp = (r_speeds.ival>1)?Sys_DoubleTime()*1000000:0
798#define RSpeedRemark() rsp = (r_speeds.ival>1)?Sys_DoubleTime()*1000000:0
799
800#if defined(_WIN32) && defined(GLQUAKE)
801extern void (_stdcall *qglFinish) (void);
802#define RSpeedEnd(spt) do {if(r_speeds.ival > 1){if(r_speeds.ival > 2 && qglFinish)qglFinish(); rspeeds[spt] += (double)(Sys_DoubleTime()*1000000) - rsp;}}while (0)
803#else
804#define RSpeedEnd(spt) rspeeds[spt] += (r_speeds.ival>1)?Sys_DoubleTime()*1000000 - rsp:0
805#endif
806#endif
qboolean
Definition: api_menu.h:34
vec_t vec3_t[3]
Definition: api_menu.h:40
vec_t vec4_t[4]
Definition: api_menu.h:41
vec_t vec2_t[2]
Definition: api_menu.h:39
unsigned int width
Definition: bymorphed.h:4
unsigned int height
Definition: bymorphed.h:5
cvar_t model
Definition: cl_main.c:153
double time
Definition: cl_main.c:306
entity_t * ent
Definition: com_mesh.c:717
vecV_t * coords
Definition: com_mesh.c:710
dVector3 result
Definition: com_phys_ode.c:519
dReal depth
Definition: com_phys_ode.c:320
dReal dReal radius
Definition: com_phys_ode.c:289
fs_relative
Definition: common.h:661
unsigned char qbyte
Definition: common.h:127
intptr_t qintptr_t
Definition: common.h:38
char filename[64]
Definition: generatebuiltin.c:8
image_t * image
Definition: gl_font.c:402
size_t magicsize
Definition: gl_model.c:911
char * formatname
Definition: gl_model.c:908
qbyte * magic
Definition: gl_model.c:910
GLdouble GLdouble GLdouble GLdouble zNear
Definition: gl_vidcommon.c:166
GLdouble GLdouble GLdouble GLdouble GLdouble zFar
Definition: gl_vidcommon.c:166
GLclampf GLclampf blue
Definition: gl_vidcommon.c:39
GLclampf green
Definition: gl_vidcommon.c:39
static EGLSurface surface
Definition: gl_videgl.c:43
static EGLSurface EGLSurface EGLContext ctx
Definition: gl_videgl.c:47
GLfloat GLfloat y
Definition: glquake.h:158
GLsizei const GLcharARB const GLint * length
Definition: glquake.h:149
GLuint GLcharARB * name
Definition: glquake.h:155
GLint size
Definition: glquake.h:157
GLfloat x
Definition: glquake.h:158
GLdouble GLdouble r
Definition: glquake.h:969
GLfloat GLfloat GLfloat GLfloat w
Definition: glquake.h:158
GLenum format
Definition: glsupp.h:502
GLint GLfloat * parms
Definition: glsupp.h:612
GLenum GLsizei len
Definition: glsupp.h:502
void * module
Definition: image.c:236
static png_inforp png_colorp * palette
Definition: image.c:1410
char fname[MAX_QPATH]
Definition: m_mp3.c:160
int base
Definition: menu.c:1054
struct texid_s texid_tf
Definition: merged.h:292
char ** data
Definition: p_script.c:63
int const void * p
Definition: pr_lua.c:232
int b
Definition: pr_lua.c:242
const char * var
Definition: pr_lua.c:225
int const char * e
Definition: pr_lua.c:259
int idx
Definition: pr_lua.c:221
float scale
Definition: pr_menu.c:106
shader_t * shader
Definition: r_2d.c:51
uploadfmt_t fmt
Definition: r_2d.c:48
texid_t tex
Definition: r_2d.c:52
cm_surface_t * surf
Definition: r_d3.c:697
texid_t particlecqtexture
Definition: renderer.c:2998
void Mod_LightmapAllocBlock(lmalloc_t *lmallocator, int w, int h, unsigned short *x, unsigned short *y, int *tnum)
Definition: gl_model.c:3045
cvar_t vid_hardwaregamma
Definition: renderer.c:504
void Media_VideoRestarted(void)
Definition: m_mp3.c:3924
qbyte GetPaletteIndexRange(int first, int stop, int red, int green, int blue)
Definition: r_2d.c:138
refEntityType_t
Definition: render.h:78
@ RT_RAIL_CORE
Definition: render.h:83
@ RT_POLY
Definition: render.h:80
@ RT_SPRITE
Definition: render.h:81
@ RT_BEAM
Definition: render.h:82
@ RT_PORTALCAMERA
Definition: render.h:90
@ RT_RAIL_RINGS
Definition: render.h:84
@ RT_LIGHTNING
Definition: render.h:85
@ RT_PORTALSURFACE
Definition: render.h:86
@ RT_MAX_REF_ENTITY_TYPE
Definition: render.h:92
@ RT_MODEL
Definition: render.h:79
int Media_Capturing(void)
Definition: m_mp3.c:3393
void D3D9_Set2D(void)
Definition: vid_d3d.c:932
cvar_t r_lightstylespeed
Definition: renderer.c:189
cvar_t r_lightmap_scale
Definition: renderer.c:191
void Mod_ResortShaders(void)
Definition: gl_model.c:312
@ RSPEED_PROTOCOL
Definition: render.h:750
@ RSPEED_TOTALREFRESH
Definition: render.h:741
@ RSPEED_CSQCREDRAW
Definition: render.h:743
@ RSPEED_RTLIGHTS
Definition: render.h:748
@ RSPEED_DYNAMIC
Definition: render.h:746
@ RSPEED_LINKENTITIES
Definition: render.h:744
@ RSPEED_CSQCPHYSICS
Definition: render.h:742
@ RSPEED_OPAQUE
Definition: render.h:747
@ RSPEED_PARTICLES
Definition: render.h:751
@ RSPEED_TRANSPARENTS
Definition: render.h:749
@ RSPEED_SERVER
Definition: render.h:755
@ RSPEED_AUDIO
Definition: render.h:756
@ RSPEED_ACQUIRE
Definition: render.h:760
@ RSPEED_SETUP
Definition: render.h:757
@ RSPEED_WORLDNODE
Definition: render.h:745
@ RSPEED_PALETTEFLASHES
Definition: render.h:753
@ RSPEED_SUBMIT
Definition: render.h:758
@ RSPEED_2D
Definition: render.h:754
@ RSPEED_MAX
Definition: render.h:762
@ RSPEED_PRESENT
Definition: render.h:759
@ RSPEED_PARTICLESDRAW
Definition: render.h:752
int Mod_FrameNumForName(struct model_s *model, int surfaceidx, const char *name)
Definition: com_mesh.c:5524
void GLR_Init(void)
Definition: gl_rmisc.c:448
void R_UpdateHDR(vec3_t org)
Definition: gl_rlight.c:67
texid_tf R_LoadHiResTexture(const char *name, const char *subpath, unsigned int flags)
void Image_Init(void)
void Renderer_Start(void)
Definition: renderer.c:1066
void Media_RecordFrame(void)
Definition: m_mp3.c:3446
cvar_t r_coronas_fadedist
Definition: render.h:712
int Mod_FrameNumForAction(struct model_s *model, int surfaceidx, int actionid)
Definition: com_mesh.c:5555
void Mod_Shutdown(qboolean final)
Definition: gl_model.c:747
cvar_t r_lightmap
Definition: renderer.c:144
float r_blobshadows
Definition: cl_ents.c:53
unsigned int skinid_t
Definition: render.h:95
void Image_Purge(void)
void AddOcranaLEDsIndexed(qbyte *image, int h, int w)
cvar_t r_skyfog
Definition: gl_warp.c:43
void GLR_LoadSkys(void)
cvar_t gl_maxdist
Definition: render.h:705
void GLSCR_DeInit(void)
void R_SetFrustum(float projmat[16], float viewmat[16])
Definition: renderer.c:2812
void * Mod_Extradata(struct model_s *mod)
Definition: gl_model.c:783
cvar_t r_deluxemapping_cvar
Definition: renderer.c:380
void Surf_ClearSceneCache(void)
Definition: r_surf.c:3926
void Surf_LessenStains(void)
Definition: r_surf.c:267
struct texture_s * R_TextureAnimation(int frame, struct texture_s *base)
Definition: renderer.c:2627
texid_t beamtexture
Definition: renderer.c:3001
void Surf_BuildLightmaps(void)
Definition: r_surf.c:3949
@ RQUANT_MSECS
Definition: render.h:767
@ RQUANT_RTLIGHT_CULL_SCISSOR
Definition: render.h:782
@ RQUANT_RTLIGHT_CULL_PVS
Definition: render.h:781
@ RQUANT_SHADOWSIDES
Definition: render.h:776
@ RQUANT_SHADOWEDGES
Definition: render.h:775
@ RQUANT_ENTBATCHES
Definition: render.h:770
@ RQUANT_RTLIGHT_DRAWN
Definition: render.h:779
@ RQUANT_RTLIGHT_CULL_FRUSTUM
Definition: render.h:780
@ RQUANT_MAX
Definition: render.h:784
@ RQUANT_WORLDBATCHES
Definition: render.h:771
@ RQUANT_2DBATCHES
Definition: render.h:772
@ RQUANT_SHADOWINDICIES
Definition: render.h:774
@ RQUANT_DRAWS
Definition: render.h:769
@ RQUANT_PRIMITIVEINDICIES
Definition: render.h:768
@ RQUANT_LITFACES
Definition: render.h:777
cvar_t r_shadow_realtime_dlight
Definition: gl_shadow.c:62
void Surf_DeInit(void)
Definition: r_surf.c:3309
cvar_t r_softwarebanding_cvar
Definition: renderer.c:216
void GLR_InitTextures(void)
cvar_t * cvar_r_meshpitch
Definition: com_phys_ode.c:62
void Surf_PreNewMap(void)
Definition: r_surf.c:4116
void Mod_NowLoadExternal(struct model_s *loadmodel)
Definition: gl_model.c:1538
stereomethod_t
Definition: render.h:222
@ STEREO_OFF
Definition: render.h:223
@ STEREO_RED_BLUE
Definition: render.h:226
@ STEREO_RED_GREEN
Definition: render.h:227
@ STEREO_QUAD
Definition: render.h:224
@ STEREO_LEFTONLY
Definition: render.h:231
@ STEREO_RED_CYAN
Definition: render.h:225
@ STEREO_CROSSEYED
Definition: render.h:228
@ STEREO_RIGHTONLY
Definition: render.h:232
qboolean Image_UnloadTexture(image_t *tex)
cvar_t gl_max_size
Definition: renderer.c:411
skinid_t Mod_ReadSkinFile(const char *skinname, const char *skintext)
Definition: gl_alias.c:249
cvar_t r_telestyle
Definition: renderer.c:499
struct refdef_s refdef_t
void Image_PrintInputFormatVersions(void)
void Mod_ClearAll(void)
Definition: gl_model.c:515
void Surf_DrawWorld(void)
Definition: r_surf.c:2968
void LightShutdown(struct relight_ctx_s *ctx)
Definition: ltface.c:128
struct relight_ctx_s * LightStartup(struct relight_ctx_s *ctx, struct model_s *model, qboolean shadows, qboolean skiplit)
Definition: ltface.c:133
void GLR_PushDlights(void)
void R_PushDlights(void)
Definition: gl_rlight.c:724
vec3_t vright
Definition: render.h:330
qboolean r_deluxemapping
Definition: renderer.c:383
cvar_t r_shadow_realtime_world_shadows
Definition: render.h:674
void BoostGamma(qbyte *rgba, int width, int height, uploadfmt_t fmt)
void R_Clutter_Purge(void)
Definition: r_part.c:474
qboolean Image_RegisterLoader(void *module, plugimageloaderfuncs_t *loader)
Definition: image.c:240
void Media_CaptureDemoEnd(void)
Definition: m_mp3.c:4121
vec3_t vup
Definition: render.h:330
qboolean WritePCXfile(const char *filename, enum fs_relative fsroot, qbyte *data, int width, int height, int rowbytes, qbyte *palette, qboolean upload)
Definition: image.c:2669
void Mod_Batches_Build(struct model_s *mod, struct builddata_s *bd)
Definition: gl_model.c:3277
cvar_t r_norefresh
Definition: renderer.c:340
struct texture_s * r_notexture_mip
Definition: renderer.c:25
image_t * Image_TextureIsValid(qintptr_t address)
int rquant[RQUANT_MAX]
Definition: renderer.c:31
texid_t explosiontexture
Definition: renderer.c:2999
qboolean Image_LocateHighResTexture(image_t *tex, flocation_t *bestloc, char *bestname, size_t bestnamesize, unsigned int *bestflags)
texid_t particletexture
Definition: renderer.c:2997
cvar_t r_shadow_realtime_world
Definition: gl_shadow.c:57
qboolean D3D9_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
void D3D8_Set2D(void)
Definition: vid_d3d8.c:963
void Surf_NewMap(struct model_s *worldmodel)
Definition: r_surf.c:3999
qboolean r_fakeshadows
Definition: gl_shadow.c:2807
void Image_BlockSizeForEncoding(uploadfmt_t encoding, unsigned int *blockbytes, unsigned int *blockwidth, unsigned int *blockheight, unsigned int *blockdepth)
vec3_t r_origin
Definition: renderer.c:20
cvar_t r_shadow_shadowmapping
Definition: gl_shadow.c:68
void R_Clutter_Emit(struct batch_s **batches)
Definition: r_part.c:349
qboolean R_UnRegisterModule(void *module)
void R_LoadNumberedLightTexture(struct dlight_s *dl, int cubetexnum)
cvar_t gl_mindist
Definition: renderer.c:415
qboolean Renderer_Started(void)
Definition: renderer.c:1061
cvar_t r_coronas
Definition: renderer.c:168
qboolean D3D8_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
cvar_t * cvar_r_meshroll
Definition: com_phys_ode.c:63
void GLR_DeInit(void)
Definition: gl_rmisc.c:433
qboolean Image_WriteKTXFile(const char *filename, enum fs_relative fsroot, struct pendingtextureinfo *mips)
void RQ_Init(void)
Definition: renderque.c:168
cvar_t r_clear
Definition: renderer.c:408
void R_LightArraysByte_BGR(const entity_t *entity, vecV_t *coords, byte_vec4_t *colours, int vertcount, vec3_t *normals, qboolean colormod)
Definition: com_mesh.c:748
cvar_t r_shadow_realtime_world_importlightentitiesfrommap
Definition: render.h:674
cvar_t gl_load24bit
Definition: renderer.c:405
cvar_t gl_poly
cvar_t r_drawviewmodelinvis
Definition: renderer.c:154
cvar_t r_shadow_realtime_dlight_specular
Definition: gl_shadow.c:66
unsigned char stmap
Definition: render.h:373
void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles)
Definition: ltface.c:146
void SaturateR8G8B8(qbyte *data, int size, float sat)
texid_tf R_LoadBumpmapTexture(const char *name, const char *subpath)
refdef_t r_refdef
Definition: renderer.c:19
cvar_t r_lightprepass_cvar
Definition: renderer.c:479
qboolean D3D11_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
void BE_GenModelBatches(struct batch_s **batches, const struct dlight_s *dl, unsigned int bemode, const qbyte *worldpvs, const int *worldareas)
unsigned short index_t
Definition: render.h:56
image_t *QDECL Image_GetTexture(const char *identifier, const char *subpath, unsigned int flags, void *fallbackdata, void *fallbackpalette, int fallbackwidth, int fallbackheight, uploadfmt_t fallbackfmt)
cvar_t r_lightstylesmooth
Definition: renderer.c:187
qbyte * ReadRawImageFile(qbyte *buf, int len, int *width, int *height, uploadfmt_t *format, qboolean force_rgba8, const char *fname)
void * Image_ResampleTexture(uploadfmt_t format, const void *in, int inwidth, int inheight, void *out, int outwidth, int outheight)
skinfile_t * Mod_LookupSkin(skinid_t id)
Definition: gl_alias.c:118
void R_GAlias_DrawBatch(struct batch_s *batch)
Definition: gl_alias.c:1674
texid_t R_GetDefaultEnvmap(void)
Definition: gl_warp.c:61
shader_t * Mod_RegisterBasicShader(struct model_s *mod, const char *texname, unsigned int usageflags, const char *shadertext, uploadfmt_t pixelfmt, unsigned int width, unsigned int height, void *pixeldata, void *palettedata)
Definition: gl_shader.c:6403
void R_AnimateLight(void)
Definition: gl_rlight.c:107
void GLR_RenderView(void)
Definition: gl_rmain.c:1997
float r_shadow_realtime_world_lightmaps_force
Definition: gl_shadow.c:60
void GLVID_DeInit(void)
Definition: gl_viddroid.c:58
struct pendingtextureinfo * Image_LoadMipsFromMemory(int flags, const char *iname, const char *fname, qbyte *filedata, int filesize)
qboolean Media_PausedDemo(qboolean fortiming)
Definition: m_mp3.c:3405
void R_RestartRenderer_f(void)
Definition: renderer.c:2316
void CL_BlendFog(fogstate_t *result, fogstate_t *oldf, float time, fogstate_t *newf)
Definition: cl_main.c:1914
void D3D8_DestroyTexture(texid_t tex)
Definition: d3d8_image.c:18
double Media_TweekCaptureFrameTime(double oldtime, double time)
Definition: m_mp3.c:3426
qbyte * ReadPCXPalette(qbyte *buf, int len, qbyte *out)
Definition: image.c:2919
void * Image_FlipImage(const void *inbuffer, void *outbuffer, int *inoutwidth, int *inoutheight, int pixelbytes, qboolean flipx, qboolean flipy, qboolean flipd)
cvar_t r_fullbright
Definition: renderer.c:337
int r_lightprepass
Definition: renderer.c:480
lightmapinfo_t ** lightmap
Definition: r_surf.c:48
void D3D11_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis)
Definition: d3d11_backend.c:307
void Image_ChangeFormat(struct pendingtextureinfo *mips, qboolean *allowedformats, uploadfmt_t origfmt, const char *imagename)
cvar_t r_shadow_realtime_dlight_ambient
Definition: gl_shadow.c:64
int numlightmaps
Definition: r_surf.c:49
cvar_t r_glsl_offsetmapping
Definition: renderer.c:489
int rspeeds[RSPEED_MAX]
Definition: renderer.c:30
float Mod_GetFrameDuration(struct model_s *model, int surfaceidx, int frameno)
Definition: com_mesh.c:5863
cvar_t r_renderscale
Definition: renderer.c:224
void Media_VideoRestarting(void)
Definition: m_mp3.c:3920
struct mplane_s mplane_t
cvar_t r_lightstylescale
Definition: renderer.c:190
struct glRect_s glRect_t
void Renderer_Init(void)
Definition: renderer.c:753
void GLR_DrawPortal(struct batch_s *batch, struct batch_s **blist, struct batch_s *depthmasklist[2], int portaltype)
Definition: gl_rmain.c:1101
void Surf_SetupFrame(void)
Definition: r_surf.c:2173
void CL_ResetFog(int fogtype)
Definition: cl_main.c:1931
cvar_t gl_affinemodels
Definition: gl_rmain.c:52
void Media_WriteCurrentTrack(sizebuf_t *buf)
Definition: m_mp3.c:325
cvar_t r_meshroll
Definition: com_mesh.c:49
cvar_t r_slimealpha
Definition: renderer.c:236
void Mod_TouchModel(const char *name)
Definition: gl_model.c:899
cvar_t r_coronas_mindist
Definition: render.h:712
cvar_t gl_nocolors
Definition: renderer.c:109
qbyte * ReadPNGFile(const char *fname, qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean force_rgb32)
Definition: image.c:1573
cvar_t r_drawentities
Definition: renderer.c:334
cvar_t r_dynamic
Definition: renderer.c:155
vec3_t vpn
Definition: render.h:330
void RQ_Shutdown(void)
Definition: renderque.c:161
texid_t balltexture
Definition: renderer.c:3000
cvar_t gl_playermip
cvar_t r_shadow_realtime_dlight_diffuse
Definition: gl_shadow.c:65
void Surf_BuildModelLightmaps(struct model_s *m)
Definition: r_surf.c:3720
cvar_t r_flashblendscale
Definition: render.h:712
entity_t r_worldentity
Definition: renderer.c:21
void Mod_UnRegisterModelFormat(void *module, int idx)
Definition: gl_model.c:978
void GLR_DrawWaterSurfaces(void)
void R_LightArrays(const entity_t *entity, vecV_t *coords, avec4_t *colours, int vertcount, vec3_t *normals, float scale, qboolean colormod)
Definition: com_mesh.c:795
void Mod_ModelLoaded(void *ctx, void *data, size_t a, size_t b)
Definition: gl_model.c:1011
void Mod_Init(qboolean initial)
Definition: gl_model.c:648
void Surf_GenBrushBatches(struct batch_s **batches, entity_t *ent)
Definition: r_surf.c:2285
qboolean RelightSetup(struct model_s *model, size_t lightsamples, qboolean generatelit)
Definition: ltface.c:1135
void Surf_StainSurf(struct model_s *mod, struct msurface_s *surf, float *parms)
Definition: r_surf.c:83
void Mod_SubmodelLoaded(struct model_s *mod, int state)
Definition: gl_model.c:1077
void D3D9_DestroyTexture(texid_t tex)
Definition: d3d_image.c:11
int Mod_RegisterModelFormatMagic(void *module, const char *formatname, qbyte *magic, size_t magicsize, qboolean(QDECL *load)(struct model_s *mod, void *buffer, size_t fsize))
void(_stdcall *qglFinish)(void)
image_t * Image_LoadTexture(const char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags)
qboolean R_RegisterVRDriver(void *module, struct plugvrfuncs_s *vrfuncs)
Definition: renderer.c:1137
void R_SetSky(const char *skyname)
Definition: gl_warp.c:72
void GLR_InitEfrags(void)
void D3D8_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis)
void MYgluPerspective(double fovx, double fovy, double zNear, double zFar)
cvar_t r_xflip
Definition: gl_rmain.c:80
qprojection_t
Definition: render.h:236
@ PROJ_LAEA
Definition: render.h:241
@ PROJ_FISHEYE
Definition: render.h:239
@ PROJ_PANORAMA
Definition: render.h:240
@ PROJ_STANDARD
Definition: render.h:237
@ PROJ_STEREOGRAPHIC
Definition: render.h:238
@ PROJ_EQUIRECTANGULAR
Definition: render.h:242
qboolean Image_LoadTextureFromMemory(texid_t tex, int flags, const char *iname, const char *fname, qbyte *filedata, int filesize)
qboolean Image_FormatHasAlpha(uploadfmt_t encoding)
cvar_t r_wateralpha
Definition: renderer.c:232
struct model_s * Mod_FindName(const char *name)
Definition: gl_model.c:831
cvar_t r_netgraph
Definition: renderer.c:339
void R_BloomRegister(void)
Definition: gl_bloom.c:83
int Mod_SkinNumForName(struct model_s *model, int surfaceidx, const char *name)
Definition: com_mesh.c:5627
void R_SetRenderer(rendererinfo_t *ri)
Definition: renderer.c:1316
const size_t lightthreadctxsize
Definition: ltface.c:333
void D3D11_DestroyTexture(texid_t tex)
Definition: d3d11_image.c:25
cvar_t r_waterstyle
Definition: renderer.c:496
qboolean r_softwarebanding
Definition: renderer.c:217
qboolean R_RegisterRenderer(void *module, rendererinfo_t *ri)
Definition: renderer.c:1113
void R_RenderDlights(void)
Definition: gl_rlight.c:382
int Mod_RegisterModelFormatText(void *module, const char *formatname, char *magictext, qboolean(QDECL *load)(struct model_s *mod, void *buffer, size_t fsize))
void Surf_AddStain(vec3_t org, float red, float green, float blue, float radius)
Definition: r_surf.c:209
cvar_t r_novis
Definition: renderer.c:341
cvar_t r_slimestyle
Definition: renderer.c:497
void Surf_WipeStains(void)
Definition: r_surf.c:255
cvar_t r_waterwarp
Definition: renderer.c:343
cvar_t r_speeds
Definition: renderer.c:342
cvar_t r_lavaalpha
Definition: renderer.c:234
void R_GAlias_GenerateBatches(entity_t *e, struct batch_s **batches)
Definition: gl_alias.c:1718
int Mod_TagNumForName(struct model_s *model, const char *name, int firsttag)
Definition: com_mesh.c:5469
void Image_Upload(texid_t tex, uploadfmt_t fmt, void *data, void *palette, int width, int height, int depth, unsigned int flags)
cvar_t r_clearcolour
Definition: renderer.c:410
void GLVID_Console_Resize(void)
void Surf_RenderDynamicLightmaps(struct msurface_s *fa)
Definition: r_surf.c:1985
void Image_Premultiply(struct pendingtextureinfo *mips)
void Mod_UnRegisterAllModelFormats(void *module)
Definition: gl_model.c:999
imageflags
Definition: render.h:435
@ IF_WORLDTEX
Definition: render.h:464
@ IF_SPRITETEX
Definition: render.h:465
@ IF_NOGAMMA
Definition: render.h:448
@ IF_NEAREST
Definition: render.h:439
@ IF_SRGB
Definition: render.h:443
@ IF_LOWPRIORITY
Definition: render.h:471
@ IF_HIGHPRIORITY
Definition: render.h:470
@ IF_LOADNOW
Definition: render.h:472
@ IF_TRYBUMP
Definition: render.h:474
@ IF_EXACTEXTENSION
Definition: render.h:476
@ IF_TEXTYPEMASK
Definition: render.h:449
@ IF_MIPCAP
Definition: render.h:457
@ IF_INEXACT
Definition: render.h:462
@ IF_PALETTIZE
Definition: render.h:468
@ IF_NOPICMIP
Definition: render.h:446
@ IF_UNUSED15
Definition: render.h:460
@ IF_NOALPHA
Definition: render.h:447
@ IF_RENDERTARGET
Definition: render.h:475
@ IF_UIPIC
Definition: render.h:441
@ IF_NOPURGE
Definition: render.h:469
@ IF_LINEAR
Definition: render.h:440
@ IF_NOMIPMAP
Definition: render.h:438
@ IF_NOPCX
Definition: render.h:473
@ IF_UNUSED16
Definition: render.h:461
@ IF_NOSRGB
Definition: render.h:466
@ IF_PREMULTIPLYALPHA
Definition: render.h:458
@ IF_CLAMP
Definition: render.h:437
@ IF_NOREPLACE
Definition: render.h:477
@ IF_NOWORKER
Definition: render.h:478
cvar_t r_drawworld
cvar_t r_shadow_realtime_dlight_shadows
Definition: render.h:670
texid_t R_LoadReplacementTexture(const char *name, const char *subpath, unsigned int flags, void *lowres, int lowreswidth, int lowresheight, uploadfmt_t fmt)
cvar_t r_drawviewmodel
Definition: renderer.c:153
void R_InitSky(shader_t *shader, const char *skyname, uploadfmt_t fmt, qbyte *src, unsigned int width, unsigned int height)
Definition: gl_warp.c:1178
void Surf_Clear(struct model_s *mod)
Definition: r_surf.c:3347
cvar_t gl_finish
Definition: gl_rmain.c:53
qbyte GetPaletteIndex(int red, int green, int blue)
Definition: r_2d.c:86
struct entity_s entity_t
cvar_t r_lightmap_saturation
Definition: renderer.c:186
void Surf_RenderAmbientLightmaps(struct msurface_s *fa, int ambient)
Definition: r_surf.c:2066
void RelightTerminate(struct model_s *mod)
Definition: ltface.c:1044
void Mod_LightmapAllocInit(lmalloc_t *lmallocator, qboolean hasdeluxe, unsigned int width, unsigned int height, int firstlm)
Definition: gl_model.c:3019
void R_UpdateLightStyle(unsigned int style, const char *stylestring, float r, float g, float b)
Definition: gl_rlight.c:44
void QDECL Surf_RebuildLightmap_Callback(struct cvar_s *var, char *oldvalue)
Definition: r_surf.c:77
qboolean R_DrawSkyChain(struct batch_s *batch)
Definition: gl_warp.c:381
qboolean Image_WriteDDSFile(const char *filename, enum fs_relative fsroot, struct pendingtextureinfo *mips)
void R_GAliasFlushSkinCache(qboolean final)
Definition: gl_alias.c:578
cvar_t r_lavastyle
Definition: renderer.c:498
void R_ShutdownRenderer(qboolean videotoo)
Definition: renderer.c:1359
qbyte * ReadPCXFile(qbyte *buf, int length, int *width, int *height)
Definition: image.c:2745
const char * Image_FormatName(uploadfmt_t encoding)
cvar_t r_lightstylesmooth_limit
Definition: renderer.c:188
image_t * Image_CreateTexture(const char *identifier, const char *subpath, unsigned int flags)
void LightPlane(struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[MAXCPULIGHTMAPS], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale)
Definition: ltface.c:776
void D3D9_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis)
Definition: d3d_backend.c:326
cvar_t r_meshpitch
Definition: com_mesh.c:47
void Mod_RebuildLightmaps(void)
Definition: gl_model.c:292
void Image_ReadExternalAlpha(qbyte *rgbadata, size_t imgwidth, size_t imgheight, const char *fname, uploadfmt_t *format)
int Surf_LightmapShift(struct model_s *model)
Definition: r_surf.c:66
int R_LightPoint(vec3_t p)
Definition: gl_rlight.c:2664
cvar_t r_temporalscenecache
Definition: r_surf.c:2956
texid_t ptritexture
Definition: renderer.c:3002
void R_BumpLightstyles(unsigned int maxstyle)
Definition: gl_rlight.c:34
struct model_s * currentmodel
Definition: r_surf.c:42
cvar_t r_shadow_playershadows
Definition: gl_shadow.c:67
cvar_t r_shadow_realtime_world_lightmaps
Definition: render.h:674
cvar_t r_coronas_occlusion
Definition: render.h:712
image_t * Image_FindTexture(const char *identifier, const char *subpath, unsigned int flags)
struct texture_s * R_TextureAnimation_Q2(struct texture_s *base)
Definition: renderer.c:2656
void R_Sky_Register(void)
Definition: gl_warp.c:1338
cvar_t r_telealpha
Definition: renderer.c:238
const char * RelightGetProgress(float *progress)
Definition: ltface.c:1149
void Image_Shutdown(void)
cvar_t gl_nohwblend
Definition: renderer.c:431
void RelightThink(void)
Definition: ltface.c:1161
cvar_t r_flashblend
Definition: render.h:712
cvar_t r_mirroralpha
Definition: renderer.c:338
cvar_t r_coronas_intensity
Definition: render.h:712
void R_SkyShutdown(void)
Definition: gl_warp.c:53
void Mod_WipeSkin(skinid_t id, qboolean force)
Definition: gl_alias.c:75
skinid_t Mod_RegisterSkinFile(const char *skinname)
Definition: gl_alias.c:431
void * ReadTargaFile(qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean greyonly, uploadfmt_t forceformat)
Definition: image.c:449
void Image_DestroyTexture(image_t *tex)
qboolean R_CalcModelLighting(entity_t *e, struct model_s *clmodel)
Definition: gl_alias.c:1350
rendererinfo_t * ri
Definition: renderer.c:1110
enum uploadfmt uploadfmt_t
static ALC_API ALCvoid * buffer
Definition: snd_al.c:259
static spx_int16_t * in
Definition: snd_dma.c:488
static SpeexBits spx_int16_t * out
Definition: snd_dma.c:492
OggVorbis_File char * initial
Definition: snd_ov.c:46
Definition: gl_model.h:133
Definition: render.h:598
void(* buildfunc)(struct model_s *mod, struct msurface_s *surf, struct builddata_s *bd)
Definition: render.h:599
void * facedata
Definition: render.h:601
qboolean paintlightmaps
Definition: render.h:600
Definition: cvar.h:59
Definition: client.h:315
Definition: render.h:99
vec3_t angles
Definition: render.h:105
int flags
Definition: render.h:146
float scale
Definition: render.h:156
int h2playerclass
Definition: render.h:127
int abslight
Definition: render.h:163
int topcolour
Definition: render.h:124
float rotation
Definition: render.h:149
float fatness
Definition: render.h:159
vec3_t light_range
Definition: render.h:114
int keynum
Definition: render.h:103
struct shader_s * forcedshader
Definition: render.h:151
vec3_t origin
Definition: render.h:104
int playerindex
Definition: render.h:123
int bottomcolour
Definition: render.h:125
int drawflags
Definition: render.h:162
vec3_t oldorigin
Definition: render.h:117
vec3_t axis[3]
Definition: render.h:106
int light_known
Definition: render.h:112
vec3_t light_dir
Definition: render.h:115
refEntityType_t rtype
Definition: render.h:148
pvscache_t pvscache
Definition: render.h:153
skinid_t customskin
Definition: render.h:121
vec4_t shaderRGBAf
Definition: render.h:108
int skinnum
Definition: render.h:120
framestate_t framestate
Definition: render.h:144
vec3_t glowmod
Definition: render.h:110
float shaderTime
Definition: render.h:109
vec3_t light_avg
Definition: render.h:113
struct model_s * model
Definition: render.h:119
Definition: common.h:577
Definition: render.h:203
float glslpad1
Definition: render.h:209
float glslpad2
Definition: render.h:210
float time
Definition: render.h:217
vec3_t colour
Definition: render.h:205
float alpha
Definition: render.h:206
float density
Definition: render.h:207
float depthbias
Definition: render.h:208
Definition: merged.h:59
Definition: render.h:370
unsigned short t
Definition: render.h:371
unsigned short b
Definition: render.h:371
unsigned short l
Definition: render.h:371
unsigned short r
Definition: render.h:371
Definition: merged.h:238
Definition: render.h:375
texid_t lightmap_texture
Definition: render.h:376
int width
Definition: render.h:382
qboolean hasdeluxe
Definition: render.h:379
stmap * stainmaps
Definition: render.h:386
qbyte * lightmaps
Definition: render.h:385
uploadfmt_t fmt
Definition: render.h:380
int pbo_handle
Definition: render.h:388
qboolean modified
Definition: render.h:377
int height
Definition: render.h:383
qboolean external
Definition: render.h:378
glRect_t rectchange
Definition: render.h:384
qbyte pixbytes
Definition: render.h:381
Definition: render.h:422
int firstlm
Definition: render.h:424
unsigned int height
Definition: render.h:427
unsigned int width
Definition: render.h:426
qboolean deluxe
Definition: render.h:428
int lmnum
Definition: render.h:425
Definition: gl_model.h:90
Definition: gl_model.h:972
Definition: render.h:193
qbyte type
Definition: render.h:196
qbyte pad[2]
Definition: render.h:198
qbyte signbits
Definition: render.h:197
vec3_t normal
Definition: render.h:194
float dist
Definition: render.h:195
Definition: gl_model.h:459
Definition: merged.h:302
Definition: client.h:639
Definition: render.h:511
size_t pendingtextureinfosize
Definition: render.h:513
qboolean canloadcubemaps
Definition: render.h:514
const char * loadername
Definition: render.h:512
Definition: vr.h:72
Definition: bspfile.h:939
Definition: vid.h:69
Definition: client.h:32
Definition: render.h:255
float fov_x
Definition: render.h:272
qbyte * forcedvis
Definition: render.h:320
int frustum_numworldplanes
Definition: render.h:294
stereomethod_t stereomethod
Definition: render.h:313
qboolean areabitsknown
Definition: render.h:321
vrect_t vrect
Definition: render.h:257
qboolean warndraw
Definition: render.h:326
vrect_t grect
Definition: render.h:256
vec3_t base_angles
Definition: render.h:267
vec3_t vieworg
Definition: render.h:260
rtname_t rt_ripplemap
Definition: render.h:317
float mindist
Definition: render.h:274
float m_projection_std[16]
Definition: render.h:287
rtname_t rt_destcolour[R_MAX_RENDERTARGETS]
Definition: render.h:314
float maxdist
Definition: render.h:274
vec3_t viewaxis[3]
Definition: render.h:262
vec4_t userdata[16]
Definition: render.h:324
playerview_t * playerview
Definition: render.h:281
rtname_t rt_sourcecolour
Definition: render.h:315
pxrect_t pxrect
Definition: render.h:305
vec3_t viewangles
Definition: render.h:261
vec3_t weaponmatrix[4]
Definition: render.h:269
vec3_t skyroom_pos
Definition: render.h:300
rtname_t rt_depth
Definition: render.h:316
qboolean useperspective
Definition: render.h:311
qboolean skyroom_enabled
Definition: render.h:302
qboolean externalview
Definition: render.h:306
float fovv_y
Definition: render.h:273
vec3_t eyeoffset
Definition: render.h:263
int flags
Definition: render.h:278
float time
Definition: render.h:284
vec4_t skyroom_spin
Definition: render.h:301
int firstvisedict
Definition: render.h:303
rtname_t nearenvmap
Definition: render.h:318
float fovv_x
Definition: render.h:273
vec3_t weaponmatrix_bob[4]
Definition: render.h:270
qboolean base_known
Definition: render.h:266
vec3_t base_origin
Definition: render.h:267
int dirty
Definition: render.h:279
int * sceneareas
Definition: render.h:291
qboolean drawsbar
Definition: render.h:276
unsigned int colourmask
Definition: render.h:310
float m_projection_view[16]
Definition: render.h:288
float hdr_value
Definition: render.h:298
float m_view[16]
Definition: render.h:289
qbyte * scenevis
Definition: render.h:290
float fov_y
Definition: render.h:272
vec3_t pvsorigin
Definition: render.h:259
mplane_t frustum[MAXFRUSTUMPLANES]
Definition: render.h:293
fogstate_t globalfog
Definition: render.h:297
qbyte areabits[MAX_MAP_AREA_BYTES]
Definition: render.h:322
int recurse
Definition: render.h:307
qboolean forcevis
Definition: render.h:308
int frustum_numplanes
Definition: render.h:295
qboolean drawcrosshair
Definition: render.h:277
vec2_t projectionoffset
Definition: render.h:264
float afov
Definition: render.h:272
unsigned int flipcull
Definition: render.h:309
Definition: merged.h:422
Definition: render.h:245
Definition: shader.h:602
Definition: common.h:196
Definition: render.h:170
unsigned int q1lower
Definition: render.h:180
texnums_t texnums
Definition: render.h:186
int maxmappings
Definition: render.h:174
int refcount
Definition: render.h:171
shader_t * shader
Definition: render.h:185
int needsfree
Definition: render.h:187
unsigned int q1upper
Definition: render.h:179
struct qwskin_s * qwskin
Definition: render.h:178
int nummappings
Definition: render.h:173
Definition: merged.h:383
Definition: gl_model.h:365
Definition: vid.h:65
netadr_t a
Definition: sv_master.c:141
unsigned char buf[KBRINGSIZE]
Definition: sys_dos.c:27
unsigned int flags
Definition: valid.c:313
ctx first
Definition: zone.c:587