UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_renderer.h
Go to the documentation of this file.
1 
5 /*
6 All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
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 the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 #include "renderer/r_image.h"
28 #include "renderer/r_model.h"
29 #include "renderer/r_program.h"
30 
31 #include <SDL.h>
32 
33 /* e.g. used for sequences and particle editor */
34 #define RDF_NOWORLDMODEL 1
35 #define RDF_IRGOGGLES 2
37 #define WEATHER_NONE 0
38 #define WEATHER_FOG 1
39 
40 #define VID_NORM_WIDTH 1024
41 #define VID_NORM_HEIGHT 768
42 
43 #define MAX_PTL_ART 1024
44 #define MAX_PTLS 2048
45 
47 typedef struct corona_s {
49  float radius;
51 } corona_t;
52 
53 #define MAX_CORONAS 128
54 
55 #define MAX_GL_LIGHTS 8
56 
57 typedef struct {
59  const char* name;
61  float* origin;
62  float* angles;
63  float* scale;
64  float* center;
66  int frame, oldframe;
67  float backlerp;
69  int skin;
70  int mesh;
71  float* color;
72 } modelInfo_t;
73 
74 typedef struct ptlCmd_s {
77  int ref;
79 } ptlCmd_t;
80 
81 typedef struct ptlDef_s {
82  char name[MAX_VAR];
88 } ptlDef_t;
89 
91 typedef enum artType_s {
94 } artType_t;
95 
96 typedef struct ptlArt_s {
97  char name[MAX_VAR];
98  int frame;
99  int skin;
100  union {
101  const image_t* image;
103  } art;
105 } ptlArt_t;
106 
107 typedef struct ptl_s {
108  bool inuse;
109  bool invis;
129 
130  int skin;
132  struct ptl_s* children;
133  struct ptl_s* next;
134  struct ptl_s* parent;
136  /* private */
140  float fps;
141  float lastFrame;
142  float tps;
143  float lastThink;
145  float t;
146  float dt;
147  float life;
148  int rounds;
150  float scrollS;
151  float scrollT;
156  bool physics;
157  bool autohide;
160  bool stayalive;
161  bool weather;
163  bool hitSolid;
164  bool stick;
165  bool bounce;
166 } ptl_t;
167 
168 typedef struct {
169  bool ready;
171  float fieldOfViewX, fieldOfViewY;
174  float time;
177  int brushCount, aliasCount, batchCount;
178  int FFPToShaderCount, shaderToShaderCount, shaderToFFPCount;
179 
180  int weather;
188  /* entity, dynamic lights and corona lists are repopulated each frame, don't use them as persistent */
191  light_t dynamicLights[MAX_GL_LIGHTS];
192 
193  /* static lights (populated when loading the world) */
194  light_t staticLights[MAX_STATIC_LIGHTS];
196 
199 
202 
205 
206 extern rendererData_t refdef;
207 
208 /* threading state */
209 typedef enum {
215 } threadstate_t;
216 
217 typedef enum {
221 
223 } longlines_t;
224 
225 typedef struct renderer_threadstate_s {
226  SDL_Thread* thread;
229 
231 
232 void R_Color(const vec4_t rgba);
233 
234 void R_ModBeginLoading(const char* tiles, bool day, const char* pos, const char* mapName, const char* mapZone);
235 void R_SwitchModelMemPoolTag(void);
236 
237 void R_LoadImage(const char* name, byte** pic, int* width, int* height);
238 
239 void R_FontShutdown(void);
240 void R_FontInit(void);
241 void R_FontRegister(const char* name, int size, const char* path, const char* style);
242 void R_FontSetTruncationMarker(const char* marker);
243 
244 void R_FontTextSize(const char* fontId, const char* text, int maxWidth, longlines_t method, int* width, int* height, int* lines, bool* isTruncated);
245 int R_FontDrawString(const char* fontId, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char* c, int boxHeight, int scrollPos, int* curLine, longlines_t method);
vec4_t sunDiffuseColor
Definition: cl_renderer.h:184
struct ptl_s * children
Definition: cl_renderer.h:132
bool invis
Definition: cl_renderer.h:109
float tps
Definition: cl_renderer.h:142
int levelFlags
Definition: cl_renderer.h:128
vec4_t color
Definition: cl_renderer.h:120
float * origin
Definition: cl_renderer.h:61
int roundsCnt
Definition: cl_renderer.h:149
vec3_t omega
Definition: cl_renderer.h:155
renderer_threadstate_t r_threadstate
Definition: r_thread.cpp:34
vec3_t s
Definition: cl_renderer.h:121
float dt
Definition: cl_renderer.h:146
float backlerp
Definition: cl_renderer.h:67
float * color
Definition: cl_renderer.h:71
struct entity_s * traceEntity
Definition: cl_renderer.h:201
float lightSustain
Definition: cl_renderer.h:127
vec4_t sunSpecularColor
Definition: cl_renderer.h:185
const char * name
Definition: cl_renderer.h:59
int R_FontDrawString(const char *fontId, align_t align, int x, int y, int absX, int maxWidth, int lineHeight, const char *c, int boxHeight, int scrollPos, int *curLine, longlines_t method)
Definition: r_font.cpp:687
float scrollS
Definition: cl_renderer.h:150
struct ptlDef_s ptlDef_t
int frame
Definition: cl_renderer.h:139
struct ptl_s ptl_t
ptlCmd_t * round
Definition: cl_renderer.h:86
void R_ModBeginLoading(const char *tiles, bool day, const char *pos, const char *mapName, const char *mapZone)
Specifies the model that will be used as the world.
float lightIntensity
Definition: cl_renderer.h:126
const image_t * image
Definition: cl_renderer.h:101
artType_s
particle art type
Definition: cl_renderer.h:91
bool bounce
Definition: cl_renderer.h:165
vec4_t sunVector
Definition: cl_renderer.h:186
void R_FontSetTruncationMarker(const char *marker)
Definition: r_font.cpp:112
vec3_t viewAngles
Definition: cl_renderer.h:173
bool inuse
Definition: cl_renderer.h:108
fade_t thinkFade
Definition: cl_renderer.h:144
model_t * model
Definition: cl_renderer.h:102
r_program_t * program
Definition: cl_renderer.h:111
int skin
Definition: cl_renderer.h:99
union ptlArt_s::@8 art
a light source
Definition: r_light.h:29
vec3_t offset
Definition: cl_renderer.h:123
style_t style
Definition: cl_renderer.h:117
int skin
Definition: cl_renderer.h:130
void R_Color(const vec4_t rgba)
Change the color to given value.
Definition: r_state.cpp:1011
struct corona_s corona_t
coronas are soft, alpha-blended, rounded polys
float fps
Definition: cl_renderer.h:140
vec3_t viewOrigin
Definition: cl_renderer.h:172
float * angles
Definition: cl_renderer.h:62
struct ptl_s * next
Definition: cl_renderer.h:133
int startTime
Definition: cl_renderer.h:138
float radius
Definition: cl_renderer.h:49
void R_FontTextSize(const char *fontId, const char *text, int maxWidth, longlines_t method, int *width, int *height, int *lines, bool *isTruncated)
Supply information about the size of the text when it is linewrapped and rendered, without actually rendering it. Any of the output parameters may be nullptr.
Definition: r_font.cpp:524
align_t
We need this here for checking the boundaries from script values.
Definition: scripts.h:90
struct renderer_threadstate_s renderer_threadstate_t
float * center
Definition: cl_renderer.h:64
GLsizei size
Definition: r_gl.h:152
rendererData_t refdef
Definition: r_main.cpp:45
float lastThink
Definition: cl_renderer.h:143
#define MAX_VAR
Definition: shared.h:36
float lastFrame
Definition: cl_renderer.h:141
float fieldOfViewY
Definition: cl_renderer.h:171
struct ptl_s * parent
Definition: cl_renderer.h:134
#define MAX_GL_LIGHTS
Definition: cl_renderer.h:55
model_t * model
Definition: cl_renderer.h:58
void R_SwitchModelMemPoolTag(void)
After all static models are loaded, switch the pool tag for these models to not free them everytime R...
Definition: r_model.cpp:299
blend_t blend
Definition: cl_renderer.h:116
threadstate_t
Definition: cl_renderer.h:209
bool stayalive
Definition: cl_renderer.h:160
bool autohide
Definition: cl_renderer.h:157
vec3_t scale
Definition: cl_renderer.h:119
ptlCmd_t * physics
Definition: cl_renderer.h:87
blend_t
Definition: scripts.h:114
vec2_t size
Definition: cl_renderer.h:118
struct ptlCmd_s ptlCmd_t
threadstate_t state
Definition: cl_renderer.h:227
void R_FontShutdown(void)
frees the SDL_ttf fonts
Definition: r_font.cpp:144
ptlCmd_t * run
Definition: cl_renderer.h:84
byte type
Definition: cl_renderer.h:76
void R_LoadImage(const char *name, byte **pic, int *width, int *height)
Generic image-data loading fucntion.
Definition: r_image.cpp:152
vec3_t lightColor
Definition: cl_renderer.h:125
fade_t
Definition: scripts.h:136
ptlCmd_t * think
Definition: cl_renderer.h:85
vec3_t v
Definition: cl_renderer.h:153
enum artType_s artType_t
particle art type
ptlDef_t * ctrl
Definition: cl_renderer.h:137
float life
Definition: cl_renderer.h:147
struct ptlArt_s ptlArt_t
vec3_t org
Definition: cl_renderer.h:48
vec3_t angles
Definition: cl_renderer.h:124
int shaderToShaderCount
Definition: cl_renderer.h:178
coronas are soft, alpha-blended, rounded polys
Definition: cl_renderer.h:47
float * scale
Definition: cl_renderer.h:63
vec3_t oldV
Definition: cl_renderer.h:154
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
int frame
Definition: cl_renderer.h:98
style_t
Definition: scripts.h:125
artType_t type
Definition: cl_renderer.h:104
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
float t
Definition: cl_renderer.h:145
char name[MAX_VAR]
Definition: cl_renderer.h:82
fade_t frameFade
Definition: cl_renderer.h:144
void R_FontRegister(const char *name, int size, const char *path, const char *style)
Definition: r_font.cpp:750
vec4_t ambientColor
Definition: cl_renderer.h:182
vec4_t modelAmbientColor
Definition: cl_renderer.h:183
vec3_t a
Definition: cl_renderer.h:152
vec3_t color
Definition: cl_renderer.h:50
Brush model header file.
ptlCmd_t * init
Definition: cl_renderer.h:83
bool physics
Definition: cl_renderer.h:156
ptlArt_t * pic
Definition: cl_renderer.h:113
float scrollT
Definition: cl_renderer.h:151
uint8_t byte
Definition: ufotypes.h:34
byte cmd
Definition: cl_renderer.h:75
int rounds
Definition: cl_renderer.h:148
#define MAX_CORONAS
Definition: cl_renderer.h:53
ptlArt_t * model
Definition: cl_renderer.h:114
mapTiles_t * mapTiles
Definition: cl_renderer.h:203
#define MAX_STATIC_LIGHTS
Definition: r_light.h:47
longlines_t
Definition: cl_renderer.h:217
bool stick
Definition: cl_renderer.h:164
bool hitSolid
Definition: cl_renderer.h:163
bool weather
Definition: cl_renderer.h:161
char name[MAX_VAR]
Definition: cl_renderer.h:97
void R_FontInit(void)
Definition: r_font.cpp:722
static const char * mapName
vec3_t origin
Definition: cl_renderer.h:122
int endFrame
Definition: cl_renderer.h:139
vec_t vec4_t[4]
Definition: ufotypes.h:40