UFO: Alien Invasion
r_local.h
Go to the documentation of this file.
1
6/*
7All original material Copyright (C) 2002-2022 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#pragma once
27
28#include "../../common/common.h"
29#include "../../common/qfiles.h"
30#include "../cl_renderer.h"
31#include "../cl_video.h"
32
33#include "r_gl.h"
34#include "r_state.h"
35#include "r_array.h"
36#include "r_material.h"
37#include "r_image.h"
38#include "r_model.h"
39#include "r_thread.h"
40#include "r_framebuffer.h"
41#include "r_lightmap.h"
42#include "r_corona.h"
43#include "r_flare.h"
44
45#define MIN_GL_CONSTANT_ATTENUATION 0.01
46
47void R_DrawSurfaces(const mBspSurfaces_t* surfs, glElementIndex_t* indexPtr);
48void R_DrawMaterialSurfaces(const mBspSurfaces_t* surfs, glElementIndex_t* indexPtr);
49
50void R_SetSurfaceBumpMappingParameters(const mBspSurface_t* surf, const image_t* normalMap, const image_t* specularMap);
51
52/*==================================================== */
53
54extern cvar_t* r_drawworld;
56extern cvar_t* r_nocull;
57extern cvar_t* r_isometric;
58extern cvar_t* r_anisotropic;
59extern cvar_t* r_texture_lod; /* lod_bias */
60extern cvar_t* r_materials;
66extern cvar_t* r_lightmap;
71extern cvar_t* r_checkerror;
72extern cvar_t* r_particles;
73extern cvar_t* r_showbox;
74extern cvar_t* r_shadows;
76extern cvar_t* r_drawbuffer;
77extern cvar_t* r_driver;
79extern cvar_t* r_multisample;
80extern cvar_t* r_threads;
81extern cvar_t* r_wire;
83extern cvar_t* r_maxlightmap;
84extern cvar_t* r_warp;
85extern cvar_t* r_programs;
87extern cvar_t* r_postprocess;
88extern cvar_t* r_shownormals;
89extern cvar_t* r_bumpmap;
90extern cvar_t* r_specular;
91extern cvar_t* r_hardness;
92extern cvar_t* r_parallax;
93extern cvar_t* r_fog;
94extern cvar_t* r_flares;
95extern cvar_t* r_coronas;
97extern cvar_t* r_drawtags;
98
99/* private renderer variables */
100typedef struct rlocals_s {
101 /* view origin angle vectors */
105
106 /* for box culling */
107 cBspPlane_t frustum[4];
108
109 int frame;
111
112 float world_matrix[16];
113
119} rlocals_t;
120
121extern rlocals_t r_locals;
122
123bool R_CullMeshModel(const entity_t* e);
124
126void R_DrawBspNormals(int tile);
127bool R_CullBspModel(const entity_t* e);
128bool R_CullSphere(const vec3_t centre, const float radius, const unsigned int clipflags);
129void R_GetLevelSurfaceLists(void);
130void R_GetEntityLists(void);
131void R_DrawInitLocal(void);
132void R_DrawParticles(void);
133void R_SetupFrustum(void);
134
135void R_ClearBspRRefs(void);
136void R_AddBspRRef(const mBspModel_t* model, const vec3_t origin, const vec3_t angles, const bool forceVisibility);
137void R_RenderOpaqueBspRRefs(void);
140void R_RenderMaterialBspRRefs(void);
141void R_RenderFlareBspRRefs(void);
142void R_RenderBlendBspRRefs(void);
144
145
146typedef enum {
153
155typedef struct {
156 const char* rendererString;
157 const char* vendorString;
158 const char* versionString;
159 const char* extensionsString;
160
163
166
177
178 char lodDir[8];
179
181
183
188
191
194
199
203} rconfig_t;
204
205extern rconfig_t r_config;
206
207/*
208====================================================================
209IMPLEMENTATION SPECIFIC FUNCTIONS
210====================================================================
211*/
212
213bool Rimp_Init(void);
214void Rimp_Shutdown(void);
215bool R_InitGraphics(const viddefContext_t* context);
voidpf uLong int origin
Definition: ioapi.h:45
OpenGL bindings.
GLuint glElementIndex_t
Definition: r_gl.h:57
lightmap definitions
cvar_t * r_default_hardness
Definition: r_main.cpp:83
cvar_t * r_specular
Definition: r_main.cpp:104
cvar_t * r_bumpmap
Definition: r_main.cpp:103
cvar_t * r_maxlightmap
Definition: r_main.cpp:101
void R_DrawSurfaces(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
General surface drawing function, that draw the surface chains.
Definition: r_surface.cpp:98
cvar_t * r_shownormals
Definition: r_main.cpp:102
cvar_t * r_screenshot_jpeg_quality
Definition: r_main.cpp:67
cvar_t * r_drawbuffer
Definition: r_main.cpp:85
cvar_t * r_vertexbuffers
Definition: r_main.cpp:94
cvar_t * r_overridematerial
Definition: r_main.cpp:81
cvar_t * r_hardness
Definition: r_main.cpp:105
void R_DrawParticles(void)
Definition: r_particle.cpp:266
void R_DrawMaterialSurfaces(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
Iterates the specified surfaces list, updating materials as they are encountered, and rendering all v...
Definition: r_material.cpp:399
void R_RenderBlendWarpBspRRefs(void)
Draw all warped translucent bsp surfaces via warp shader and with blend enabled.
Definition: r_bsp.cpp:475
cvar_t * r_postprocess
Definition: r_main.cpp:100
void R_SetupFrustum(void)
Definition: r_main.cpp:137
void R_RenderOpaqueBspRRefs(void)
Draw all simple opaque bsp surfaces with multitexture enabled and light enabled.
Definition: r_bsp.cpp:410
void R_SetSurfaceBumpMappingParameters(const mBspSurface_t *surf, const image_t *normalMap, const image_t *specularMap)
Definition: r_surface.cpp:32
hardwareType_t
Definition: r_local.h:146
@ GLHW_INTEL
Definition: r_local.h:149
@ GLHW_GENERIC
Definition: r_local.h:147
@ GLHW_MESA
Definition: r_local.h:148
@ GLHW_ATI
Definition: r_local.h:150
@ GLHW_NVIDIA
Definition: r_local.h:151
cvar_t * r_screenshot_format
Definition: r_main.cpp:66
cvar_t * r_shadows
Definition: r_main.cpp:87
void R_GetLevelSurfaceLists(void)
Fills the surface chains for the current worldlevel and hide other levels.
Definition: r_bsp.cpp:281
cvar_t * r_drawworld
Definition: r_main.cpp:61
void Rimp_Shutdown(void)
Definition: r_sdl.cpp:282
cvar_t * r_flares
Definition: r_main.cpp:108
cvar_t * r_ext_texture_compression
Definition: r_main.cpp:73
bool R_InitGraphics(const viddefContext_t *context)
Init the SDL window.
Definition: r_sdl.cpp:218
cvar_t * r_wire
Definition: r_main.cpp:91
cvar_t * r_default_specular
Definition: r_main.cpp:82
cvar_t * r_swapinterval
Definition: r_main.cpp:89
cvar_t * r_particles
Definition: r_particle.cpp:32
void R_RenderOpaqueWarpBspRRefs(void)
Draw all warped opaque bsp surfaces via warp shader.
Definition: r_bsp.cpp:426
cvar_t * r_drawtags
Definition: r_main.cpp:110
cvar_t * r_coronas
Definition: r_main.cpp:109
cvar_t * r_nocull
Definition: r_main.cpp:62
void R_DrawBspNormals(int tile)
Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals wh...
Definition: r_bsp.cpp:134
bool R_CullBspModel(const entity_t *e)
Returns true if the specified entity is completely culled by the view frustum, false otherwise.
Definition: r_bsp.cpp:108
cvar_t * r_driver
Definition: r_main.cpp:86
cvar_t * r_checkerror
Definition: r_main.cpp:84
cvar_t * r_showbox
Definition: r_main.cpp:92
void R_DrawModelParticle(modelInfo_t *mi)
Renders a particle model for the battlescape.
Definition: r_mesh.cpp:397
cvar_t * r_fog
Definition: r_main.cpp:107
cvar_t * r_debug_normals
Definition: r_main.cpp:69
void R_RenderMaterialBspRRefs(void)
Definition: r_bsp.cpp:449
void R_RenderBlendBspRRefs(void)
Draw all translucent bsp surfaces with multitexture enabled and blend enabled.
Definition: r_bsp.cpp:462
void R_GetEntityLists(void)
Primary entry point for drawing all entities.
Definition: r_entity.cpp:625
cvar_t * r_debug_lights
Definition: r_main.cpp:71
cvar_t * r_drawentities
Definition: r_main.cpp:60
cvar_t * r_parallax
Definition: r_main.cpp:106
bool R_CullSphere(const vec3_t centre, const float radius, const unsigned int clipflags)
Performs a spherical frustum check.
Definition: r_bsp.cpp:83
cvar_t * r_multisample
Definition: r_main.cpp:90
cvar_t * r_programs
Definition: r_main.cpp:97
cvar_t * r_materials
Definition: r_main.cpp:80
void R_AddBspRRef(const mBspModel_t *model, const vec3_t origin, const vec3_t angles, const bool forceVisibility)
Adds bsp render references.
Definition: r_bsp.cpp:324
void R_RenderAlphaTestBspRRefs(void)
Definition: r_bsp.cpp:436
rconfig_t r_config
Definition: r_main.cpp:47
cvar_t * r_lightmap
Definition: r_main.cpp:68
cvar_t * r_stencilshadows
Definition: r_main.cpp:88
void R_DrawInitLocal(void)
Loads some textures and init the 3d globe.
Definition: r_draw.cpp:83
cvar_t * r_isometric
Definition: r_main.cpp:63
bool R_CullMeshModel(const entity_t *e)
Checks whether a model is visible in the current scene.
Definition: r_mesh.cpp:446
cvar_t * r_dynamic_lights
Definition: r_main.cpp:96
cvar_t * r_anisotropic
Definition: r_main.cpp:64
void R_ClearBspRRefs(void)
Definition: r_bsp.cpp:311
cvar_t * r_texture_lod
Definition: r_main.cpp:65
cvar_t * r_glsl_version
The GLSL version being used (not necessarily a supported version by the OpenGL implementation)....
Definition: r_main.cpp:99
bool Rimp_Init(void)
Definition: r_sdl.cpp:72
rlocals_t r_locals
Definition: r_main.cpp:49
cvar_t * r_warp
Definition: r_main.cpp:95
cvar_t * r_debug_tangents
Definition: r_main.cpp:70
void R_RenderFlareBspRRefs(void)
Definition: r_bsp.cpp:454
cvar_t * r_threads
Definition: r_main.cpp:93
Header file for the render material subsystem.
Brush model header file.
plane_t structure
Definition: typedefs.h:20
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
Definition: cvar.h:71
brush model
surfaces are assigned to arrays based on their primary rendering type and then sorted by world textur...
GL config stuff.
Definition: r_local.h:155
int maxVertexTextureImageUnits
Definition: r_local.h:176
bool drawBuffers
Definition: r_local.h:187
bool lod_bias
Definition: r_local.h:198
int maxDrawBuffers
Definition: r_local.h:173
hardwareType_t hardwareType
Definition: r_local.h:202
int gl_alpha_format
Definition: r_local.h:190
int glVersionMinor
Definition: r_local.h:162
int gl_filter_min
Definition: r_local.h:195
int maxColorAttachments
Definition: r_local.h:175
int glVersionMajor
Definition: r_local.h:161
int gl_compressed_alpha_format
Definition: r_local.h:193
bool hwgamma
Definition: r_local.h:182
const char * rendererString
Definition: r_local.h:156
int maxVertexBufferSize
Definition: r_local.h:171
int gl_compressed_solid_format
Definition: r_local.h:192
const char * versionString
Definition: r_local.h:158
bool anisotropic
Definition: r_local.h:185
int maxLights
Definition: r_local.h:172
int videoMemory
Definition: r_local.h:180
int maxTextureUnits
Definition: r_local.h:168
int glslVersionMinor
Definition: r_local.h:165
int gl_solid_format
Definition: r_local.h:189
int maxTextureCoords
Definition: r_local.h:169
int maxRenderbufferSize
Definition: r_local.h:174
int32_t maxAnisotropic
Definition: r_local.h:184
int maxTextureSize
Definition: r_local.h:167
const char * extensionsString
Definition: r_local.h:159
int maxVertexAttribs
Definition: r_local.h:170
bool frameBufferObject
Definition: r_local.h:186
int glslVersionMajor
Definition: r_local.h:164
int gl_filter_max
Definition: r_local.h:196
bool nonPowerOfTwo
Definition: r_local.h:200
const char * vendorString
Definition: r_local.h:157
vec3_t up
Definition: r_local.h:102
int frame
Definition: r_local.h:109
const model_t * bufferMapTile
this is the currently handled bsp model
Definition: r_local.h:118
vec3_t forward
Definition: r_local.h:103
int tracenum
Definition: r_local.h:110
vec3_t right
Definition: r_local.h:104
Contains the game screen context, everything that is needed to create the graphic context....
Definition: cl_video.h:43
vec_t vec3_t[3]
Definition: ufotypes.h:39