cl_renderer.h

Go to the documentation of this file.
00001 
00005 /*
00006 All original material Copyright (C) 2002-2010 UFO: Alien Invasion.
00007 
00008 This program is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either version 2
00011 of the License, or (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016 
00017 See the GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00023 */
00024 
00025 #ifndef CLIENT_REF_H
00026 #define CLIENT_REF_H
00027 
00028 #include "renderer/r_image.h"
00029 #include "renderer/r_model.h"
00030 #include "renderer/r_program.h"
00031 
00032 #include <SDL.h>
00033 
00034 /* e.g. used for sequences and particle editor */
00035 #define RDF_NOWORLDMODEL    1
00036 #define RDF_IRGOGGLES       2   
00039 #define RF_TRANSLUCENT      0x00000001
00040 #define RF_BOX              0x00000002  
00041 #define RF_PATH             0x01000000  
00042 #define RF_ARROW            0x02000000  
00045 #define RF_SHADOW           0x00000004  
00046 #define RF_BLOOD            0x00000008  
00047 #define RF_SELECTED         0x00000010  
00048 #define RF_MEMBER           0x00000020  
00049 #define RF_ALLIED           0x00000040  
00050 #define RF_ACTOR            0x00000080  
00051 #define RF_PULSE            0x00000100  
00052 #define RF_IRGOGGLES        0x00000200  
00054 #define EARTH_RADIUS 8192.0f
00055 #define MOON_RADIUS 1024.0f
00056 #define SUN_RADIUS 1024.0f
00057 
00058 #define WEATHER_NONE    0
00059 #define WEATHER_FOG     1
00060 
00061 #define VID_NORM_WIDTH      1024
00062 #define VID_NORM_HEIGHT     768
00063 
00064 #define MAX_PTL_ART     1024
00065 #define MAX_PTLS        2048
00066 
00068 typedef struct corona_s {
00069     vec3_t org;
00070     float radius;
00071     vec3_t color;
00072 } corona_t;
00073 
00074 #define MAX_CORONAS         128
00075 
00076 #define MAX_GL_LIGHTS 8
00077 
00078 typedef struct {
00079     vec3_t origin;
00080     vec4_t color;
00081     vec4_t ambient;
00082     float radius;
00083 } light_t;
00084 
00086 typedef struct sustain_s {
00087     light_t light;
00088     float time;
00089     float sustain;
00090 } sustain_t;
00091 
00092 typedef struct {
00093     model_t *model;         
00094     const char *name;       
00096     float *origin;          
00097     float *angles;          
00098     float *scale;           
00099     float *center;          
00101     int frame, oldframe;    
00102     float backlerp;         
00104     int skin;               
00105     int mesh;               
00106     float *color;
00107 } modelInfo_t;
00108 
00109 typedef struct ptlCmd_s {
00110     byte cmd;   
00111     byte type;  
00112     int ref;    
00114 } ptlCmd_t;
00115 
00116 typedef struct ptlDef_s {
00117     char name[MAX_VAR]; 
00118     ptlCmd_t *init; 
00119     ptlCmd_t *run;  
00120     ptlCmd_t *think;    
00121     ptlCmd_t *round;    
00122     ptlCmd_t *physics;  
00123 } ptlDef_t;
00124 
00126 typedef enum artType_s {
00127     ART_PIC,
00128     ART_MODEL
00129 } artType_t;
00130 
00131 typedef struct ptlArt_s {
00132     char name[MAX_VAR]; 
00133     int frame;
00134     int skin;       
00135     union {
00136         const image_t *image;
00137         model_t *model;
00138     } art;
00139     artType_t type; 
00140 } ptlArt_t;
00141 
00142 typedef struct ptl_s {
00143     qboolean inuse;         
00144     qboolean invis;         
00146     r_program_t *program;   
00148     ptlArt_t *pic;          
00149     ptlArt_t *model;        
00151     blend_t blend;              
00152     style_t style;              
00153     vec2_t size;
00154     vec3_t scale;
00155     vec4_t color;
00156     vec3_t s;           
00157     vec3_t origin;      
00158     vec3_t offset;
00159     vec3_t angles;
00160     vec3_t lightColor;
00161     float lightIntensity;
00162     float lightSustain;
00163     int levelFlags;
00164 
00165     int skin;       
00167     struct ptl_s* children; 
00168     struct ptl_s* next;     
00169     struct ptl_s* parent;   
00171     /* private */
00172     ptlDef_t *ctrl;     
00173     int startTime;
00174     int frame, endFrame;
00175     float fps;  
00176     float lastFrame;    
00177     float tps; 
00178     float lastThink;
00179     fade_t thinkFade, frameFade;
00180     float t;    
00181     float dt;   
00182     float life; 
00183     int rounds; 
00184     int roundsCnt;
00185     float scrollS;
00186     float scrollT;
00187     vec3_t a;   
00188     vec3_t v;   
00189     vec3_t omega;   
00190     qboolean physics;   
00191     qboolean autohide;  
00194     qboolean stayalive; 
00195     qboolean weather;   
00197 } ptl_t;
00198 
00199 typedef struct {
00200     qboolean ready; 
00202     float fieldOfViewX, fieldOfViewY;
00203     vec3_t viewOrigin;
00204     vec3_t viewAngles;
00205     float time;                 
00206     int rendererFlags;              
00207     int worldlevel;
00208     int brushCount, aliasCount;
00209 
00210     int weather;                
00211     vec4_t fogColor;
00212 
00213     int numEntities;
00214     int numLights;
00215     int numCoronas;
00216     corona_t coronas[MAX_CORONAS];
00217 
00218     trace_t trace;              
00219     struct entity_s *traceEntity;
00220 
00221     mapTiles_t *mapTiles;
00222 
00223     const char *mapZone;        
00224 } rendererData_t;
00225 
00226 extern rendererData_t refdef;
00227 
00228 /* threading state */
00229 typedef enum {
00230     THREAD_DEAD,
00231     THREAD_IDLE,
00232     THREAD_CLIENT,
00233     THREAD_BSP,
00234     THREAD_RENDERER
00235 } threadstate_t;
00236 
00237 typedef enum {
00238     LONGLINES_WRAP,
00239     LONGLINES_CHOP,
00240     LONGLINES_PRETTYCHOP,
00241 
00242     LONGLINES_LAST
00243 } longlines_t;
00244 
00245 typedef struct renderer_threadstate_s {
00246     SDL_Thread *thread;
00247     threadstate_t state;
00248 } renderer_threadstate_t;
00249 
00250 extern renderer_threadstate_t r_threadstate;
00251 
00252 struct model_s *R_RegisterModelShort(const char *name);
00253 const image_t *R_RegisterImage(const char *name);
00254 
00255 void R_Color(const vec4_t rgba);
00256 
00257 void R_ModBeginLoading(const char *tiles, qboolean day, const char *pos, const char *mapName);
00258 void R_SwitchModelMemPoolTag(void);
00259 
00260 void R_LoadImage(const char *name, byte **pic, int *width, int *height);
00261 
00262 void R_FontShutdown(void);
00263 void R_FontInit(void);
00264 void R_FontRegister(const char *name, int size, const char *path, const char *style);
00265 void R_FontSetTruncationMarker(const char *marker);
00266 
00267 void R_FontTextSize(const char *fontId, const char *text, int maxWidth, longlines_t method, int *width, int *height, int *lines, qboolean *isTruncated);
00268 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);
00269 
00270 #endif /* CLIENT_REF_H */

Generated by  doxygen 1.6.2