2008-07-23 22:00:00 +02:00
|
|
|
|
//=======================================================================
|
|
|
|
|
// Copyright XashXT Group 2007 <20>
|
|
|
|
|
// r_local.h - render internal types
|
|
|
|
|
//=======================================================================
|
|
|
|
|
|
|
|
|
|
#ifndef R_LOCAL_H
|
|
|
|
|
#define R_LOCAL_H
|
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
#include <windows.h>
|
2008-10-27 22:00:00 +01:00
|
|
|
|
#include "launch_api.h"
|
2008-08-25 22:00:00 +02:00
|
|
|
|
#include "ref_dllapi.h"
|
|
|
|
|
#include "r_opengl.h"
|
|
|
|
|
|
|
|
|
|
extern stdlib_api_t com; // engine toolbox
|
|
|
|
|
extern render_imp_t ri;
|
|
|
|
|
extern byte *r_temppool;
|
|
|
|
|
#define Host_Error com.error
|
|
|
|
|
|
2008-07-23 22:00:00 +02:00
|
|
|
|
// limits
|
2008-08-29 22:00:00 +02:00
|
|
|
|
#define MAX_TEXTURE_UNITS 8
|
|
|
|
|
#define MAX_LIGHTMAPS 128
|
2008-10-19 22:00:00 +02:00
|
|
|
|
#define MAX_PROGRAMS 512
|
2008-08-29 22:00:00 +02:00
|
|
|
|
#define MAX_ENTITIES 1024
|
2008-07-23 22:00:00 +02:00
|
|
|
|
#define MAX_VERTEX_BUFFERS 2048
|
2008-08-29 22:00:00 +02:00
|
|
|
|
#define MAX_POLYS 4096
|
|
|
|
|
#define MAX_POLY_VERTS 16384
|
2008-09-03 22:00:00 +02:00
|
|
|
|
#define MAX_CLIPFLAGS 15 // all sides of bbox are valid
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
=======================================================================
|
|
|
|
|
|
|
|
|
|
TEXTURE MANAGER
|
|
|
|
|
|
|
|
|
|
=======================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
2008-11-03 22:00:00 +01:00
|
|
|
|
#define MAX_TEXTURES 8192
|
|
|
|
|
#define TEXTURES_HASH_SIZE 2048
|
2008-10-19 22:00:00 +02:00
|
|
|
|
|
2008-11-03 22:00:00 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
TF_STATIC = BIT(0),
|
|
|
|
|
TF_NOPICMIP = BIT(1),
|
|
|
|
|
TF_UNCOMPRESSED = BIT(2),
|
|
|
|
|
TF_INTENSITY = BIT(3),
|
|
|
|
|
TF_ALPHA = BIT(4),
|
|
|
|
|
TF_NORMALMAP = BIT(5),
|
|
|
|
|
TF_GEN_MIPS = BIT(6),
|
|
|
|
|
TF_CUBEMAP = BIT(7),
|
|
|
|
|
} texFlags_t;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
|
2008-11-03 22:00:00 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
TF_DEFAULT = 0,
|
|
|
|
|
TF_NEAREST,
|
|
|
|
|
TF_LINEAR
|
|
|
|
|
} texFilter_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
TW_REPEAT = 0,
|
|
|
|
|
TW_CLAMP,
|
|
|
|
|
TW_CLAMP_TO_ZERO,
|
|
|
|
|
TW_CLAMP_TO_ZERO_ALPHA
|
|
|
|
|
} texWrap_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef struct texture_s
|
|
|
|
|
{
|
|
|
|
|
string name; // game path, including extension
|
2008-11-03 22:00:00 +01:00
|
|
|
|
int srcWidth; // source dims, used for mipmap loading
|
|
|
|
|
int srcHeight;
|
|
|
|
|
int numLayers; // framecount
|
|
|
|
|
|
|
|
|
|
int width; // upload width\height
|
2008-08-25 22:00:00 +02:00
|
|
|
|
int height;
|
|
|
|
|
|
2008-11-03 22:00:00 +01:00
|
|
|
|
texFlags_t flags;
|
|
|
|
|
texFilter_t filter;
|
|
|
|
|
texWrap_t wrap;
|
|
|
|
|
pixformat_t type; // PFDesc[type].glType
|
|
|
|
|
size_t size; // upload size for debug targets
|
|
|
|
|
|
|
|
|
|
GLint format; // PFDesc[type].glType
|
|
|
|
|
GLuint target; // glTarget
|
2008-08-25 22:00:00 +02:00
|
|
|
|
GLint texnum; // gl texture binding
|
2008-11-03 22:00:00 +01:00
|
|
|
|
GLint samples; // gl samples
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-11-03 22:00:00 +01:00
|
|
|
|
int touchFrame; // 0 = free
|
|
|
|
|
struct texture_s *nextHash;
|
|
|
|
|
} texture_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
extern texture_t *r_defaultTexture;
|
|
|
|
|
extern texture_t *r_whiteTexture;
|
|
|
|
|
extern texture_t *r_blackTexture;
|
|
|
|
|
extern texture_t *r_rawTexture;
|
|
|
|
|
extern texture_t *r_dlightTexture;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
extern texture_t *r_lightmapTextures[MAX_LIGHTMAPS];
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern texture_t *r_normalizeTexture;
|
|
|
|
|
extern texture_t *r_radarMap;
|
|
|
|
|
extern texture_t *r_aroundMap;
|
|
|
|
|
extern byte *r_framebuffer;
|
|
|
|
|
|
2008-11-03 22:00:00 +01:00
|
|
|
|
void R_SetTextureParameters( void );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_TextureList_f( void );
|
2008-11-06 22:00:00 +01:00
|
|
|
|
texture_t *R_CreateImage( const char *name, byte *buf, int w, int h, texFlags_t texFlags, texFilter_t filter, texWrap_t wrap );
|
2008-11-03 22:00:00 +01:00
|
|
|
|
texture_t *R_LoadTexture( const char *name, rgbdata_t *pic, int samples, texFlags_t flags, texFilter_t filter, texWrap_t wrap );
|
|
|
|
|
texture_t *R_FindTexture( const char *name, const byte *buf, size_t size, texFlags_t flags, texFilter_t filter, texWrap_t wrap );
|
2008-11-08 22:00:00 +01:00
|
|
|
|
texture_t *R_FindCubeMapTexture( const char *name, const byte *buf, size_t size, texFlags_t flags, texFilter_t filter, texWrap_t wrap );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_InitTextures( void );
|
|
|
|
|
void R_ShutdownTextures( void );
|
|
|
|
|
void R_ImageFreeUnused( void );
|
|
|
|
|
|
|
|
|
|
/*
|
2008-10-19 22:00:00 +02:00
|
|
|
|
=======================================================================
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
PROGRAM MANAGER
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
=======================================================================
|
2008-08-25 22:00:00 +02:00
|
|
|
|
*/
|
2008-10-19 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef struct program_s
|
|
|
|
|
{
|
|
|
|
|
string name;
|
|
|
|
|
|
|
|
|
|
uint target;
|
|
|
|
|
uint progNum;
|
|
|
|
|
|
|
|
|
|
struct program_s *nextHash;
|
|
|
|
|
} program_t;
|
|
|
|
|
|
|
|
|
|
extern program_t *r_defaultVertexProgram;
|
|
|
|
|
extern program_t *r_defaultFragmentProgram;
|
|
|
|
|
|
|
|
|
|
void R_ProgramList_f( void );
|
|
|
|
|
program_t *R_FindProgram( const char *name, uint target );
|
|
|
|
|
void R_InitPrograms( void );
|
|
|
|
|
void R_ShutdownPrograms( void );
|
2008-07-23 22:00:00 +02:00
|
|
|
|
|
2008-11-04 22:00:00 +01:00
|
|
|
|
#include "r_shader.h"
|
2008-10-19 22:00:00 +02:00
|
|
|
|
|
2008-10-20 22:00:00 +02:00
|
|
|
|
extern ref_shader_t *r_shaders[MAX_SHADERS];
|
2008-10-19 22:00:00 +02:00
|
|
|
|
extern int r_numShaders;
|
|
|
|
|
|
2008-11-05 22:00:00 +01:00
|
|
|
|
void R_EvaluateRegisters( ref_shader_t *shader, float time, const float *entityParms, const float *globalParms );
|
2008-10-20 22:00:00 +02:00
|
|
|
|
shader_t R_FindShader( const char *name, shaderType_t shaderType, uint surfaceParm );
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void R_SetInternalMap( texture_t *mipTex ); // internal textures (skins, spriteframes, etc)
|
|
|
|
|
void R_ShaderList_f( void );
|
|
|
|
|
void R_InitShaders( void );
|
2008-11-05 22:00:00 +01:00
|
|
|
|
void R_ShutdownShaders( void );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
=======================================================================
|
|
|
|
|
|
|
|
|
|
BRUSH MODELS
|
|
|
|
|
|
|
|
|
|
=======================================================================
|
|
|
|
|
*/
|
2008-09-09 22:00:00 +02:00
|
|
|
|
#define SURF_PLANEBACK 1 // fast surface culling
|
|
|
|
|
#define CONTENTS_NODE -1
|
2008-11-05 22:00:00 +01:00
|
|
|
|
#define SKY_SIZE 16
|
2008-10-19 22:00:00 +02:00
|
|
|
|
#define SKY_INDICES (SKY_SIZE * SKY_SIZE * 6)
|
|
|
|
|
#define SKY_VERTICES ((SKY_SIZE+1) * (SKY_SIZE+1))
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
#define SURF_WATERCAUSTICS 2
|
|
|
|
|
#define SURF_SLIMECAUSTICS 4
|
|
|
|
|
#define SURF_LAVACAUSTICS 8
|
|
|
|
|
|
|
|
|
|
typedef struct dlight_s
|
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t origin;
|
|
|
|
|
vec3_t color;
|
|
|
|
|
float intensity;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
} dlight_t;
|
|
|
|
|
|
|
|
|
|
typedef struct lightstyle_s
|
|
|
|
|
{
|
|
|
|
|
float rgb[3]; // 0.0 - 2.0
|
|
|
|
|
float white; // highest of rgb
|
|
|
|
|
} lightstyle_t;
|
|
|
|
|
|
|
|
|
|
typedef struct particle_s
|
|
|
|
|
{
|
2008-10-20 22:00:00 +02:00
|
|
|
|
ref_shader_t *shader;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
vec3_t origin;
|
|
|
|
|
vec3_t old_origin;
|
|
|
|
|
float radius;
|
|
|
|
|
float length;
|
|
|
|
|
float rotation;
|
2008-08-28 22:00:00 +02:00
|
|
|
|
vec4_t modulate;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
} particle_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t xyz;
|
|
|
|
|
vec2_t st;
|
|
|
|
|
vec2_t lightmap;
|
|
|
|
|
vec4_t color;
|
|
|
|
|
} surfPolyVert_t;
|
2008-10-12 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct surfPoly_s
|
2008-08-25 22:00:00 +02:00
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
struct surfPoly_s *next;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numIndices;
|
|
|
|
|
int numVertices;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
uint *indices;
|
|
|
|
|
surfPolyVert_t *vertices;
|
|
|
|
|
} surfPoly_t;
|
2008-10-12 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t xyz;
|
|
|
|
|
vec2_t st;
|
|
|
|
|
vec4_t modulate;
|
|
|
|
|
} polyVert_t;
|
2008-08-29 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2008-10-20 22:00:00 +02:00
|
|
|
|
ref_shader_t *shader;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numVerts;
|
|
|
|
|
polyVert_t *verts;
|
2008-08-29 22:00:00 +02:00
|
|
|
|
} poly_t;
|
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int flags;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int firstIndex; // Look up in model->edges[]. Negative
|
|
|
|
|
int numIndexes; // numbers are backwards edges
|
2008-09-07 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int firstVertex;
|
|
|
|
|
int numVertexes;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
cplane_t *plane;
|
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t mins;
|
|
|
|
|
vec3_t maxs;
|
|
|
|
|
|
|
|
|
|
surfPoly_t *poly; // multiple if subdivided
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t tangent;
|
|
|
|
|
vec3_t binormal;
|
|
|
|
|
vec3_t normal;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-11-08 22:00:00 +01:00
|
|
|
|
ref_shader_t *texInfo;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
int visFrame;
|
|
|
|
|
int fragmentFrame;
|
|
|
|
|
|
|
|
|
|
// lighting info
|
|
|
|
|
int dlightFrame;
|
|
|
|
|
int dlightBits;
|
|
|
|
|
|
|
|
|
|
int lmWidth;
|
|
|
|
|
int lmHeight;
|
|
|
|
|
int lmS;
|
|
|
|
|
int lmT;
|
|
|
|
|
int lmNum;
|
|
|
|
|
float lmVecs[2][3]; // lightmap vecs
|
|
|
|
|
byte *lmSamples;
|
|
|
|
|
int numStyles;
|
|
|
|
|
byte styles[MAX_LIGHTSTYLES];
|
|
|
|
|
float cachedLight[MAX_LIGHTSTYLES]; // values currently used in lightmap
|
|
|
|
|
} surface_t;
|
|
|
|
|
|
|
|
|
|
typedef struct node_s
|
2008-10-12 22:00:00 +02:00
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
// common with leaf and node
|
|
|
|
|
int contents; // -1, to differentiate from leafs
|
2008-09-09 22:00:00 +02:00
|
|
|
|
int visFrame; // Node needs to be traversed if current
|
|
|
|
|
vec3_t mins, maxs; // for bounding box culling
|
2008-10-19 22:00:00 +02:00
|
|
|
|
struct node_s *parent;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// node specific
|
2008-10-19 22:00:00 +02:00
|
|
|
|
cplane_t *plane;
|
|
|
|
|
struct node_s *children[2];
|
|
|
|
|
|
|
|
|
|
// common with leaf
|
|
|
|
|
// leaf specific
|
|
|
|
|
int cluster;
|
|
|
|
|
int area;
|
|
|
|
|
surface_t **firstMarkSurface;
|
|
|
|
|
int numMarkSurfaces;
|
|
|
|
|
} node_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
2008-09-10 22:00:00 +02:00
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numClusters;
|
|
|
|
|
int bitOfs[8][2];
|
|
|
|
|
} vis_t;
|
2008-09-10 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t point;
|
|
|
|
|
vec3_t normal;
|
|
|
|
|
float st[2];
|
|
|
|
|
float lm[2];
|
|
|
|
|
vec4_t color;
|
|
|
|
|
} vertex_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
2008-08-25 22:00:00 +02:00
|
|
|
|
{
|
|
|
|
|
vec3_t mins;
|
|
|
|
|
vec3_t maxs;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t origin; // for sounds or lights
|
2008-08-25 22:00:00 +02:00
|
|
|
|
float radius;
|
|
|
|
|
int firstFace;
|
|
|
|
|
int numFaces;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
} submodel_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
2008-08-25 22:00:00 +02:00
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t xyz;
|
|
|
|
|
vec2_t st;
|
2008-11-04 22:00:00 +01:00
|
|
|
|
vec3_t normal;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec2_t sphere;
|
|
|
|
|
} skySideVert_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
2008-08-25 22:00:00 +02:00
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numIndices;
|
|
|
|
|
int numVertices;
|
|
|
|
|
uint indices[SKY_INDICES];
|
|
|
|
|
skySideVert_t vertices[SKY_VERTICES];
|
|
|
|
|
} skySide_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
2008-08-25 22:00:00 +02:00
|
|
|
|
{
|
2008-10-20 22:00:00 +02:00
|
|
|
|
ref_shader_t *shader;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
float rotate;
|
|
|
|
|
vec3_t axis;
|
|
|
|
|
float mins[2][6];
|
|
|
|
|
float maxs[2][6];
|
2008-11-04 22:00:00 +01:00
|
|
|
|
struct ref_buffer_s *vbo[6];
|
2008-10-19 22:00:00 +02:00
|
|
|
|
skySide_t skySides[6];
|
|
|
|
|
} sky_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
vec3_t lightDir;
|
|
|
|
|
} lightGrid_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
==============================================================================
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
SPRITE MODELS
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
==============================================================================
|
|
|
|
|
*/
|
|
|
|
|
typedef struct mspriteframe_s
|
|
|
|
|
{
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
float up, down, left, right;
|
|
|
|
|
float radius;
|
2008-10-20 22:00:00 +02:00
|
|
|
|
shader_t shader;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
texture_t *texture;
|
|
|
|
|
} mspriteframe_t;
|
2008-10-12 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int numframes;
|
|
|
|
|
float *intervals;
|
|
|
|
|
mspriteframe_t *frames[1];
|
|
|
|
|
} mspritegroup_t;
|
2008-10-12 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
frametype_t type;
|
|
|
|
|
mspriteframe_t *frameptr;
|
|
|
|
|
} mspriteframedesc_t;
|
2008-10-12 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int type;
|
|
|
|
|
int rendermode;
|
|
|
|
|
int numframes;
|
|
|
|
|
mspriteframedesc_t frames[1];
|
|
|
|
|
} msprite_t;
|
2008-09-03 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
|
|
STUDIO MODELS
|
|
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
|
*/
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
uint index[3];
|
|
|
|
|
} mstudiotriangle_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int index[3];
|
|
|
|
|
} mstudioneighbor_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
short point[3];
|
|
|
|
|
byte tangent[2];
|
|
|
|
|
byte binormal[2];
|
|
|
|
|
byte normal[2];
|
|
|
|
|
} mstudiopoint_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
vec2_t st;
|
|
|
|
|
} mstudiost_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
mstudiotriangle_t *triangles;
|
|
|
|
|
mstudioneighbor_t *neighbors;
|
|
|
|
|
mstudiopoint_t *points;
|
|
|
|
|
mstudiost_t *st;
|
2008-10-20 22:00:00 +02:00
|
|
|
|
ref_shader_t *shaders;
|
2008-09-03 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
int numTriangles;
|
|
|
|
|
int numVertices;
|
|
|
|
|
int numShaders;
|
|
|
|
|
} mstudiosurface_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct rmodel_s
|
2008-08-25 22:00:00 +02:00
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
string name;
|
|
|
|
|
int registration_sequence;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
modtype_t type;
|
|
|
|
|
byte *mempool;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
// simple lighting for sprites and models
|
|
|
|
|
vec3_t lightcolor;
|
|
|
|
|
int flags;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
// volume occupied by the model
|
|
|
|
|
vec3_t mins;
|
|
|
|
|
vec3_t maxs;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
float radius;
|
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
// brush model
|
|
|
|
|
int numModelSurfaces;
|
|
|
|
|
int firstModelSurface;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numSubmodels;
|
|
|
|
|
submodel_t *submodels;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numVertexes;
|
|
|
|
|
vertex_t *vertexes;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numIndexes;
|
|
|
|
|
int *indexes;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numShaders;
|
2008-11-08 22:00:00 +01:00
|
|
|
|
ref_shader_t **shaders;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numSurfaces;
|
|
|
|
|
surface_t *surfaces;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numMarkSurfaces;
|
|
|
|
|
surface_t **markSurfaces;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numPlanes;
|
|
|
|
|
cplane_t *planes;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numNodes;
|
|
|
|
|
node_t *nodes; // also included leafs
|
|
|
|
|
|
|
|
|
|
int numClusters; // used for create novis lump
|
|
|
|
|
vis_t *vis; // may be passed in by CM_LoadMap to save space
|
|
|
|
|
byte *novis; // clusterBytes of 0xff
|
|
|
|
|
|
|
|
|
|
sky_t *sky;
|
2008-11-06 22:00:00 +01:00
|
|
|
|
texture_t *lightMaps[MAX_LIGHTMAPS];
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int numLightmaps;
|
|
|
|
|
|
|
|
|
|
vec3_t gridMins;
|
|
|
|
|
vec3_t gridSize;
|
|
|
|
|
int gridBounds[4];
|
|
|
|
|
int gridPoints;
|
|
|
|
|
lightGrid_t *lightGrid;
|
|
|
|
|
|
|
|
|
|
// studio model
|
2008-10-20 22:00:00 +02:00
|
|
|
|
dstudiohdr_t *phdr;
|
|
|
|
|
dstudiohdr_t *thdr;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
mstudiosurface_t *studiofaces;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void *extradata; // model buffer
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
} rmodel_t;
|
2008-07-23 22:00:00 +02:00
|
|
|
|
|
2008-08-05 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
byte open; // 0 = mouth closed, 255 = mouth agape
|
|
|
|
|
byte sndcount; // counter for running average
|
|
|
|
|
int sndavg; // running average
|
|
|
|
|
} mouth_t;
|
|
|
|
|
|
2008-08-02 22:00:00 +02:00
|
|
|
|
typedef struct latchedvars_s
|
|
|
|
|
{
|
|
|
|
|
float animtime;
|
|
|
|
|
float sequencetime;
|
|
|
|
|
vec3_t origin;
|
|
|
|
|
vec3_t angles;
|
|
|
|
|
|
2008-08-05 22:00:00 +02:00
|
|
|
|
vec3_t gaitorigin;
|
2008-08-02 22:00:00 +02:00
|
|
|
|
int sequence;
|
|
|
|
|
float frame;
|
|
|
|
|
|
2008-08-09 22:00:00 +02:00
|
|
|
|
float blending[MAXSTUDIOBLENDS];
|
2008-08-02 22:00:00 +02:00
|
|
|
|
byte seqblending[MAXSTUDIOBLENDS];
|
2008-08-09 22:00:00 +02:00
|
|
|
|
float controller[MAXSTUDIOCONTROLLERS];
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
} latchedvars_t;
|
|
|
|
|
|
|
|
|
|
// client entity
|
|
|
|
|
typedef struct ref_entity_s
|
|
|
|
|
{
|
2008-08-05 22:00:00 +02:00
|
|
|
|
edtype_t ent_type; // entity type
|
|
|
|
|
int index; // entity index
|
2008-08-03 22:00:00 +02:00
|
|
|
|
rmodel_t *model; // opaque type outside refresh
|
|
|
|
|
rmodel_t *weaponmodel; // opaque type outside refresh
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
latchedvars_t prev; // previous frame values for lerping
|
|
|
|
|
|
|
|
|
|
vec3_t angles;
|
2008-08-05 22:00:00 +02:00
|
|
|
|
vec3_t origin; // position
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
2008-08-05 22:00:00 +02:00
|
|
|
|
float framerate; // custom framerate
|
|
|
|
|
float animtime; // lerping animtime
|
2008-08-02 22:00:00 +02:00
|
|
|
|
float frame; // also used as RF_BEAM's diameter
|
|
|
|
|
|
|
|
|
|
int body;
|
|
|
|
|
int skin;
|
|
|
|
|
|
2008-08-09 22:00:00 +02:00
|
|
|
|
float blending[MAXSTUDIOBLENDS];
|
2008-08-05 22:00:00 +02:00
|
|
|
|
vec3_t attachment[MAXSTUDIOATTACHMENTS];
|
2008-08-09 22:00:00 +02:00
|
|
|
|
float controller[MAXSTUDIOCONTROLLERS];
|
2008-08-05 22:00:00 +02:00
|
|
|
|
mouth_t mouth; // for synchronizing mouth movements.
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
2008-08-05 22:00:00 +02:00
|
|
|
|
int movetype; // entity moving type
|
2008-08-02 22:00:00 +02:00
|
|
|
|
int sequence;
|
|
|
|
|
float scale;
|
|
|
|
|
|
|
|
|
|
// misc
|
|
|
|
|
float backlerp; // 0.0 = current, 1.0 = old
|
2008-08-05 22:00:00 +02:00
|
|
|
|
vec3_t rendercolor; // hl1 rendercolor
|
|
|
|
|
float renderamt; // hl1 alphavalues
|
|
|
|
|
int renderfx; // server will be translate hl1 values into flags
|
|
|
|
|
int colormap; // q1 and hl1 model colormap (can applied for sprites)
|
|
|
|
|
int effects; // q1 effect flags, EF_ROTATE, EF_DIMLIGHT etc
|
|
|
|
|
|
|
|
|
|
// these values will be calculated locally, not from entity_state
|
|
|
|
|
vec3_t realangles;
|
|
|
|
|
int m_fSequenceLoops;
|
|
|
|
|
int m_fSequenceFinished;
|
|
|
|
|
int renderframe; // using for gait cycle
|
|
|
|
|
int gaitsequence; // client->sequence + yaw
|
|
|
|
|
float gaitframe; // client->frame + yaw
|
|
|
|
|
float gaityaw; // local value
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// shader information
|
2008-10-20 22:00:00 +02:00
|
|
|
|
ref_shader_t *shader;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
float shaderTime; // subtracted from refdef time to control effect start times
|
|
|
|
|
float radius; // bbox approximate radius
|
2008-10-19 22:00:00 +02:00
|
|
|
|
vec3_t axis[3]; // Rotation vectors
|
2008-08-25 22:00:00 +02:00
|
|
|
|
float rotation; // what the hell ???
|
2008-08-02 22:00:00 +02:00
|
|
|
|
} ref_entity_t;
|
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
const char *R_GetStringFromTable( int index );
|
2008-10-19 22:00:00 +02:00
|
|
|
|
node_t *R_PointInLeaf( const vec3_t p );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
byte *R_ClusterPVS( int cluster );
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_ModelList_f( void );
|
|
|
|
|
void R_StudioInit( void );
|
|
|
|
|
void R_StudioShutdown( void );
|
|
|
|
|
bool R_StudioComputeBBox( vec3_t bbox[8] ); // for drawing bounds
|
2008-09-03 22:00:00 +02:00
|
|
|
|
void R_StudioSetupModel( int body, int bodypart );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_InitModels( void );
|
|
|
|
|
void R_ShutdownModels( void );
|
|
|
|
|
rmodel_t *Mod_ForName( const char *name, bool crash );
|
|
|
|
|
void Mod_Free( rmodel_t *mod );
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
#define RENDERPASS_SOLID 1
|
|
|
|
|
#define RENDERPASS_ALPHA 2
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
=======================================================================
|
|
|
|
|
|
|
|
|
|
DOOM1 STYLE AUTOMAP
|
|
|
|
|
|
|
|
|
|
=======================================================================
|
|
|
|
|
*/
|
|
|
|
|
#define MAX_RADAR_ENTS 1024
|
|
|
|
|
|
|
|
|
|
typedef struct radar_ent_s
|
2008-08-02 22:00:00 +02:00
|
|
|
|
{
|
2008-08-25 22:00:00 +02:00
|
|
|
|
vec4_t color;
|
|
|
|
|
vec3_t origin;
|
|
|
|
|
vec3_t angles;
|
|
|
|
|
} radar_ent_t;
|
|
|
|
|
|
|
|
|
|
extern int numRadarEnts;
|
|
|
|
|
extern radar_ent_t RadarEnts[MAX_RADAR_ENTS];
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void GL_InitBackend( void );
|
|
|
|
|
bool GL_Support( int r_ext );
|
|
|
|
|
void GL_InitExtensions( void );
|
|
|
|
|
void GL_ShutdownBackend( void );
|
|
|
|
|
void GL_SetExtension( int r_ext, int enable );
|
|
|
|
|
void GL_SelectTexture( uint tmu );
|
|
|
|
|
void GL_BindTexture( texture_t *texture );
|
|
|
|
|
void GL_TexEnv( GLint texEnv );
|
|
|
|
|
void GL_Enable( GLenum cap );
|
|
|
|
|
void GL_Disable( GLenum cap );
|
|
|
|
|
void GL_CullFace( GLenum mode );
|
|
|
|
|
void GL_PolygonOffset( GLfloat factor, GLfloat units );
|
|
|
|
|
void GL_AlphaFunc( GLenum func, GLclampf ref );
|
|
|
|
|
void GL_BlendFunc( GLenum src, GLenum dst );
|
|
|
|
|
void GL_DepthFunc( GLenum func );
|
|
|
|
|
void GL_DepthMask( GLboolean mask );
|
|
|
|
|
void GL_SetColor( const void *data );
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void GL_LoadMatrix( matrix4x4 source );
|
2008-08-30 22:00:00 +02:00
|
|
|
|
void GL_SaveMatrix( GLenum target, matrix4x4 dest );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void GL_SetDefaultState( void );
|
2008-08-29 22:00:00 +02:00
|
|
|
|
void GL_BuildGammaTable( void );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void GL_UpdateGammaRamp( void );
|
|
|
|
|
void GL_Setup3D( void );
|
|
|
|
|
void GL_Setup2D( void );
|
|
|
|
|
|
2008-09-03 22:00:00 +02:00
|
|
|
|
// simple gl interface
|
|
|
|
|
void GL_Begin( GLuint drawMode );
|
|
|
|
|
void GL_End( void );
|
|
|
|
|
void GL_Vertex2f( GLfloat x, GLfloat y );
|
|
|
|
|
void GL_Vertex3f( GLfloat x, GLfloat y, GLfloat z );
|
|
|
|
|
void GL_Vertex3fv( const GLfloat *v );
|
|
|
|
|
void GL_Normal3f( GLfloat x, GLfloat y, GLfloat z );
|
|
|
|
|
void GL_Normal3fv( const GLfloat *v );
|
|
|
|
|
void GL_TexCoord2f( GLfloat s, GLfloat t );
|
|
|
|
|
void GL_TexCoord4f( GLfloat s, GLfloat t, GLfloat ls, GLfloat lt );
|
|
|
|
|
void GL_TexCoord4fv( const GLfloat *v );
|
|
|
|
|
void GL_Color3f( GLfloat r, GLfloat g, GLfloat b );
|
|
|
|
|
void GL_Color3fv( const GLfloat *v );
|
|
|
|
|
void GL_Color4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a );
|
|
|
|
|
void GL_Color4fv( const GLfloat *v );
|
|
|
|
|
void GL_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
|
|
|
|
|
void GL_Color4ubv( const GLubyte *v );
|
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_CheckForErrors( void );
|
|
|
|
|
void R_EndFrame( void );
|
|
|
|
|
bool R_Init_OpenGL( void );
|
|
|
|
|
void R_Free_OpenGL( void );
|
|
|
|
|
void R_CheckForErrors( void );
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
=======================================================================
|
|
|
|
|
|
|
|
|
|
BACKEND
|
|
|
|
|
|
|
|
|
|
=======================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
2008-09-03 22:00:00 +02:00
|
|
|
|
#define MAX_INDICES 16384 * 3
|
|
|
|
|
#define MAX_VERTICES 8192
|
2008-08-25 22:00:00 +02:00
|
|
|
|
#define MAX_MESHES 32768
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
MESH_SKY,
|
|
|
|
|
MESH_SURFACE,
|
|
|
|
|
MESH_STUDIO,
|
2008-08-25 22:00:00 +02:00
|
|
|
|
MESH_SPRITE,
|
|
|
|
|
MESH_BEAM,
|
|
|
|
|
MESH_PARTICLE,
|
|
|
|
|
MESH_POLY
|
|
|
|
|
} meshType_t;
|
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
2008-08-25 22:00:00 +02:00
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
uint sortKey;
|
|
|
|
|
meshType_t meshType;
|
|
|
|
|
void *mesh;
|
|
|
|
|
} mesh_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
extern int m_iInfoKey;
|
|
|
|
|
extern float m_fShaderTime;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
extern rmodel_t *m_pLoadModel;
|
|
|
|
|
extern mesh_t *m_pRenderMesh;
|
|
|
|
|
extern rmodel_t *m_pRenderModel;
|
2008-10-20 22:00:00 +02:00
|
|
|
|
extern ref_shader_t *m_pCurrentShader;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
extern ref_entity_t *m_pCurrentEntity;
|
|
|
|
|
extern int m_iStudioModelCount;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern int registration_sequence;
|
|
|
|
|
|
2008-08-30 22:00:00 +02:00
|
|
|
|
void RB_DebugGraphics( void );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void RB_CheckMeshOverflow( int numIndices, int numVertices );
|
|
|
|
|
void RB_RenderMesh( void );
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void RB_RenderMeshes( mesh_t *meshes, int numMeshes );
|
2008-10-20 22:00:00 +02:00
|
|
|
|
void RB_DrawStretchPic( float x, float y, float w, float h, float sl, float tl, float sh, float th, ref_shader_t *shader );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
void RB_InitBackend( void );
|
|
|
|
|
void RB_ShutdownBackend( void );
|
|
|
|
|
|
2008-11-04 22:00:00 +01:00
|
|
|
|
#include "r_backend.h"
|
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int numShaders;
|
|
|
|
|
int numStages;
|
|
|
|
|
int numMeshes;
|
|
|
|
|
int numLeafs;
|
|
|
|
|
int numVertices;
|
|
|
|
|
int numIndices;
|
|
|
|
|
int totalIndices;
|
|
|
|
|
|
|
|
|
|
int numEntities;
|
|
|
|
|
int numDLights;
|
|
|
|
|
int numParticles;
|
|
|
|
|
int numPolys;
|
|
|
|
|
} refstats_t;
|
|
|
|
|
|
|
|
|
|
extern rmodel_t *r_worldModel;
|
|
|
|
|
extern ref_entity_t *r_worldEntity;
|
|
|
|
|
|
|
|
|
|
extern vec3_t r_worldMins, r_worldMaxs;
|
|
|
|
|
|
|
|
|
|
extern int r_frameCount;
|
|
|
|
|
extern int r_visFrameCount;
|
2008-09-09 22:00:00 +02:00
|
|
|
|
extern int r_viewCluster;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
extern int r_areabitsChanged;
|
|
|
|
|
extern vec3_t r_origin; // same as r_refdef.vieworg
|
|
|
|
|
extern vec3_t r_forward;
|
|
|
|
|
extern vec3_t r_right;
|
|
|
|
|
extern vec3_t r_up;
|
|
|
|
|
|
|
|
|
|
extern matrix4x4 r_worldMatrix;
|
|
|
|
|
extern matrix4x4 r_entityMatrix;
|
|
|
|
|
|
|
|
|
|
extern gl_matrix gl_projectionMatrix;
|
|
|
|
|
extern gl_matrix gl_entityMatrix;
|
|
|
|
|
extern gl_matrix gl_textureMatrix;
|
|
|
|
|
|
|
|
|
|
extern cplane_t r_frustum[4];
|
|
|
|
|
extern vec3_t axisDefault[3];
|
|
|
|
|
extern float r_frameTime;
|
|
|
|
|
|
|
|
|
|
extern mesh_t r_solidMeshes[MAX_MESHES];
|
|
|
|
|
extern int r_numSolidMeshes;
|
|
|
|
|
extern mesh_t r_transMeshes[MAX_MESHES];
|
|
|
|
|
extern int r_numTransMeshes;
|
2008-08-29 22:00:00 +02:00
|
|
|
|
extern ref_entity_t r_entities[MAX_ENTITIES];
|
|
|
|
|
extern int r_numEntities;
|
|
|
|
|
extern dlight_t r_dlights[MAX_DLIGHTS];
|
|
|
|
|
extern int r_numDLights;
|
|
|
|
|
extern particle_t r_particles[MAX_PARTICLES];
|
|
|
|
|
extern int r_numParticles;
|
|
|
|
|
extern poly_t r_polys[MAX_POLYS];
|
|
|
|
|
extern int r_numPolys;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
extern polyVert_t r_polyVerts[MAX_POLY_VERTS];
|
|
|
|
|
extern int r_numPolyVerts;
|
|
|
|
|
extern ref_entity_t *r_nullModels[MAX_ENTITIES];
|
|
|
|
|
extern int r_numNullModels;
|
2008-08-29 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
extern lightstyle_t r_lightStyles[MAX_LIGHTSTYLES];
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern refdef_t r_refdef;
|
|
|
|
|
extern refstats_t r_stats;
|
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void R_DrawStudioModel( void );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_AddStudioModelToList( ref_entity_t *entity );
|
|
|
|
|
void R_StudioLoadModel( rmodel_t *mod, const void *buffer );
|
|
|
|
|
|
2008-08-29 22:00:00 +02:00
|
|
|
|
void R_DrawSpriteModel( void );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_AddSpriteModelToList( ref_entity_t *entity );
|
|
|
|
|
void R_SpriteLoadModel( rmodel_t *mod, const void *buffer );
|
|
|
|
|
mspriteframe_t *R_GetSpriteFrame( ref_entity_t *ent );
|
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void R_LightDir( const vec3_t origin, vec3_t lightDir );
|
|
|
|
|
void R_LightForPoint( const vec3_t point, vec3_t ambientLight );
|
|
|
|
|
void R_LightingAmbient( void );
|
|
|
|
|
void R_LightingDiffuse( void );
|
|
|
|
|
void R_BeginBuildingLightmaps( void );
|
|
|
|
|
void R_EndBuildingLightmaps( void );
|
|
|
|
|
void R_BuildSurfaceLightmap( surface_t *surf );
|
|
|
|
|
void R_UpdateSurfaceLightmap( surface_t *surf );
|
|
|
|
|
bool R_CullBox( const vec3_t mins, const vec3_t maxs, int clipFlags );
|
|
|
|
|
bool R_CullSphere( const vec3_t origin, float radius, int clipFlags );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_RotateForEntity( ref_entity_t *entity );
|
2008-10-20 22:00:00 +02:00
|
|
|
|
void R_AddMeshToList( meshType_t meshType, void *mesh, ref_shader_t *shader, ref_entity_t *entity, int infoKey );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_DrawSprite( void );
|
|
|
|
|
void R_DrawBeam( void );
|
|
|
|
|
void R_DrawParticle( void );
|
|
|
|
|
void R_DrawPoly( void );
|
|
|
|
|
void R_RenderView( const refdef_t *fd );
|
|
|
|
|
void R_AddShadowToList( ref_entity_t *entity );
|
|
|
|
|
void R_RenderShadows( void );
|
|
|
|
|
void R_BloomBlend ( const refdef_t *fd );
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void R_DrawSky( void );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_ClearSky( void );
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void R_ClipSkySurface( surface_t *surf );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_AddSkyToList( void );
|
|
|
|
|
|
|
|
|
|
void R_DrawSurface( void );
|
|
|
|
|
void R_AddBrushModelToList( ref_entity_t *entity );
|
|
|
|
|
void R_AddWorldToList( void );
|
|
|
|
|
|
|
|
|
|
void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees );
|
|
|
|
|
void R_DXTReadColor( word data, color32* out );
|
|
|
|
|
void R_DXTReadColors( const byte* data, color32* out );
|
|
|
|
|
void R_GetBitsFromMask( uint Mask, uint *ShiftLeft, uint *ShiftRight );
|
|
|
|
|
|
|
|
|
|
// exported funcs
|
|
|
|
|
void R_BeginRegistration( const char *map );
|
|
|
|
|
rmodel_t *R_RegisterModel( const char *name );
|
2008-11-08 22:00:00 +01:00
|
|
|
|
bool Mod_RegisterShader( const char *unused, int index );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_SetupSky( const char *name, float rotate, const vec3_t axis );
|
|
|
|
|
void R_EndRegistration( void );
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void R_ShaderRegisterImages( rmodel_t *mod ); // prolonge registration
|
2008-10-20 22:00:00 +02:00
|
|
|
|
ref_shader_t *R_RegisterShader( const char *name );
|
|
|
|
|
ref_shader_t *R_RegisterShaderSkin( const char *name );
|
|
|
|
|
ref_shader_t *R_RegisterShaderNoMip( const char *name );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
bool VID_ScreenShot( const char *filename, bool levelshot );
|
2008-11-08 22:00:00 +01:00
|
|
|
|
bool VID_CubemapShot( const char *base, uint size, bool skyshot );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
void R_DrawFill( float x, float y, float w, float h );
|
|
|
|
|
void R_DrawStretchRaw( int x, int y, int w, int h, int width, int height, const byte *raw, bool dirty );
|
|
|
|
|
void R_DrawStretchPic( float x, float y, float w, float h, float sl, float tl, float sh, float th, const char *name );
|
2008-08-27 22:00:00 +02:00
|
|
|
|
void R_GetPicSize( int *w, int *h, const char *pic );
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-08-28 22:00:00 +02:00
|
|
|
|
// r_utils.c (test)
|
2008-10-19 22:00:00 +02:00
|
|
|
|
void AxisClear( vec3_t axis[3] );
|
|
|
|
|
void AnglesToAxis ( const vec3_t angles );
|
|
|
|
|
void AxisCopy( const vec3_t in[3], vec3_t out[3] );
|
|
|
|
|
void AnglesToAxisPrivate (const vec3_t angles, vec3_t axis[3]);
|
|
|
|
|
bool AxisCompare( const vec3_t axis1[3], const vec3_t axis2[3] );
|
|
|
|
|
void VectorRotate ( const vec3_t v, const vec3_t matrix[3], vec3_t out );
|
|
|
|
|
void MatrixGL_MultiplyFast (const gl_matrix m1, const gl_matrix m2, gl_matrix out);
|
2008-08-28 22:00:00 +02:00
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
// cvars
|
|
|
|
|
extern cvar_t *r_check_errors;
|
|
|
|
|
extern cvar_t *r_himodels;
|
|
|
|
|
extern cvar_t *r_norefresh;
|
|
|
|
|
extern cvar_t *r_novis;
|
|
|
|
|
extern cvar_t *r_nocull;
|
|
|
|
|
extern cvar_t *r_nobind;
|
|
|
|
|
extern cvar_t *r_drawworld;
|
|
|
|
|
extern cvar_t *r_drawentities;
|
|
|
|
|
extern cvar_t *r_drawparticles;
|
|
|
|
|
extern cvar_t *r_drawpolys;
|
|
|
|
|
extern cvar_t *r_fullbright;
|
|
|
|
|
extern cvar_t *r_lightmap;
|
|
|
|
|
extern cvar_t *r_lockpvs;
|
|
|
|
|
extern cvar_t *r_frontbuffer;
|
|
|
|
|
extern cvar_t *r_showcluster;
|
|
|
|
|
extern cvar_t *r_showtris;
|
|
|
|
|
extern cvar_t *r_shownormals;
|
2008-11-08 22:00:00 +01:00
|
|
|
|
extern cvar_t *r_showtextures;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern cvar_t *r_showtangentspace;
|
|
|
|
|
extern cvar_t *r_showmodelbounds;
|
|
|
|
|
extern cvar_t *r_showshadowvolumes;
|
|
|
|
|
extern cvar_t *r_offsetfactor;
|
|
|
|
|
extern cvar_t *r_offsetunits;
|
2008-11-04 22:00:00 +01:00
|
|
|
|
extern cvar_t *r_vertexbuffers;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern cvar_t *r_debugsort;
|
|
|
|
|
extern cvar_t *r_speeds;
|
2008-11-06 22:00:00 +01:00
|
|
|
|
extern cvar_t *r_showlightmaps;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern cvar_t *r_singleshader;
|
|
|
|
|
extern cvar_t *r_skipbackend;
|
|
|
|
|
extern cvar_t *r_skipfrontend;
|
|
|
|
|
extern cvar_t *r_swapInterval;
|
|
|
|
|
extern cvar_t *r_mode;
|
|
|
|
|
extern cvar_t *r_testmode;
|
|
|
|
|
extern cvar_t *r_fullscreen;
|
|
|
|
|
extern cvar_t *r_minimap;
|
|
|
|
|
extern cvar_t *r_minimap_size;
|
|
|
|
|
extern cvar_t *r_minimap_zoom;
|
|
|
|
|
extern cvar_t *r_minimap_style;
|
|
|
|
|
extern cvar_t *r_pause;
|
|
|
|
|
extern cvar_t *r_width;
|
|
|
|
|
extern cvar_t *r_height;
|
|
|
|
|
extern cvar_t *r_refreshrate;
|
|
|
|
|
extern cvar_t *r_bitdepth;
|
|
|
|
|
extern cvar_t *r_overbrightbits;
|
|
|
|
|
extern cvar_t *r_shadows;
|
|
|
|
|
extern cvar_t *r_caustics;
|
|
|
|
|
extern cvar_t *r_dynamiclights;
|
|
|
|
|
extern cvar_t *r_modulate;
|
|
|
|
|
extern cvar_t *r_ambientscale;
|
|
|
|
|
extern cvar_t *r_directedscale;
|
|
|
|
|
extern cvar_t *r_intensity;
|
|
|
|
|
extern cvar_t *r_texturebits;
|
|
|
|
|
extern cvar_t *r_texturefilter;
|
|
|
|
|
extern cvar_t *r_texturefilteranisotropy;
|
2008-11-03 22:00:00 +01:00
|
|
|
|
extern cvar_t *r_texturelodbias;
|
|
|
|
|
extern cvar_t *r_max_normal_texsize;
|
|
|
|
|
extern cvar_t *r_max_texsize;
|
|
|
|
|
extern cvar_t *r_round_down;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern cvar_t *r_detailtextures;
|
2008-11-03 22:00:00 +01:00
|
|
|
|
extern cvar_t *r_compress_normal_textures;
|
|
|
|
|
extern cvar_t *r_compress_textures;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
extern cvar_t *r_lefthand;
|
|
|
|
|
extern cvar_t *r_bloom;
|
|
|
|
|
extern cvar_t *r_bloom_alpha;
|
|
|
|
|
extern cvar_t *r_bloom_diamond_size;
|
|
|
|
|
extern cvar_t *r_bloom_intensity;
|
|
|
|
|
extern cvar_t *r_bloom_darken;
|
|
|
|
|
extern cvar_t *r_bloom_sample_size;
|
|
|
|
|
extern cvar_t *r_bloom_fast_sample;
|
|
|
|
|
extern cvar_t *r_motionblur_intens;
|
|
|
|
|
extern cvar_t *r_motionblur;
|
|
|
|
|
extern cvar_t *r_mirroralpha;
|
|
|
|
|
extern cvar_t *r_interpolate;
|
|
|
|
|
extern cvar_t *r_physbdebug;
|
|
|
|
|
extern cvar_t *r_pause_bw;
|
|
|
|
|
extern cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
|
|
|
|
|
|
|
|
|
|
extern cvar_t *gl_finish;
|
|
|
|
|
extern cvar_t *gl_clear;
|
|
|
|
|
extern cvar_t *vid_gamma;
|
|
|
|
|
|
2008-07-23 22:00:00 +02:00
|
|
|
|
#endif//R_LOCAL_H
|