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>
|
|
|
|
|
#include "basetypes.h"
|
|
|
|
|
#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
|
|
|
|
|
#define MAX_SHADERS 1024
|
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_TEXTURES 4096
|
|
|
|
|
#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-10-19 22:00:00 +02:00
|
|
|
|
// user flags set
|
|
|
|
|
#define TF_SKYBOX 0x0001 // need skybox texture
|
|
|
|
|
#define TF_IMAGE2D 0x0002 // menu or hud image (kill mipmaps)
|
|
|
|
|
#define TF_CLAMP 0x0004 // clamp texture to edge
|
|
|
|
|
#define TF_CUBEMAP 0x0008 // need cubemap texture
|
|
|
|
|
#define TF_NORMALMAP 0x0010 // need normalmap
|
|
|
|
|
#define TF_HEIGHTMAP 0x0020 // need heightmap
|
|
|
|
|
#define TF_LUMA 0x0040 // need luminance
|
|
|
|
|
#define TF_COMPRESS 0x0080 // compress image
|
|
|
|
|
#define TF_STATIC 0x0100 // never freed by R_ImageFreeUnused()
|
|
|
|
|
|
|
|
|
|
// manager flags (don't try set this flags manually, engine will be reset it)
|
|
|
|
|
#define TF_MIPMAPS 0x1000 // image contained miplevels (base or generated by engine)
|
|
|
|
|
#define TF_GEN_MIPMAPS 0x2000 // generate mipmaps
|
|
|
|
|
#define TF_SKYSIDE 0x4000
|
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef struct texture_s
|
|
|
|
|
{
|
|
|
|
|
string name; // game path, including extension
|
|
|
|
|
int width; // source dims, used for mipmap loading
|
|
|
|
|
int height;
|
|
|
|
|
|
|
|
|
|
int type; // PFDesc[type]
|
|
|
|
|
uint flags; // texture flags
|
|
|
|
|
float bumpScale;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
GLuint target;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
GLint texnum; // gl texture binding
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int registration_sequence; // 0 = free
|
2008-08-25 22:00:00 +02:00
|
|
|
|
} texture_t;
|
|
|
|
|
|
|
|
|
|
extern const char *r_cubeMapSuffix[6];
|
|
|
|
|
extern const char *r_skyBoxSuffix[6];
|
|
|
|
|
extern vec3_t r_cubeMapAngles[6];
|
|
|
|
|
extern vec3_t r_skyBoxAngles[6];
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
void R_TextureFilter( void );
|
|
|
|
|
void R_TextureList_f( void );
|
|
|
|
|
texture_t *R_LoadTexture( const char *name, rgbdata_t *pic, uint flags, float bumpScale );
|
|
|
|
|
texture_t *R_FindTexture( const char *name, const byte *buffer, size_t size, uint flags, float bumpScale );
|
|
|
|
|
texture_t *R_FindCubeMapTexture( const char *name, uint flags, float bumpScale );
|
|
|
|
|
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-10-12 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
|
|
|
|
SHADERS
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
=======================================================================
|
2008-10-12 22:00:00 +02:00
|
|
|
|
*/
|
2008-10-19 22:00:00 +02:00
|
|
|
|
#define SHADER_MAX_EXPRESSIONS 16
|
|
|
|
|
#define SHADER_MAX_STAGES 8
|
|
|
|
|
#define SHADER_MAX_DEFORMVERTEXES 8
|
|
|
|
|
#define SHADER_MAX_TEXTURES 16
|
|
|
|
|
#define SHADER_MAX_TCMOD 8
|
|
|
|
|
|
|
|
|
|
// Shader types used for shader loading
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
SHADER_SKY, // sky box shader
|
|
|
|
|
SHADER_FONT, // speical case for displayed fonts
|
|
|
|
|
SHADER_NOMIP, // 2d images
|
|
|
|
|
SHADER_TEXTURE, // bsp polygon
|
|
|
|
|
SHADER_STUDIO, // studio skins
|
|
|
|
|
SHADER_SPRITE, // sprite frames
|
|
|
|
|
SHADER_GENERIC // generic shader
|
|
|
|
|
} shaderType_t;
|
|
|
|
|
|
|
|
|
|
// shader flags
|
|
|
|
|
#define SHADER_EXTERNAL 0x00000001
|
|
|
|
|
#define SHADER_DEFAULTED 0x00000002
|
|
|
|
|
#define SHADER_HASLIGHTMAP 0x00000004
|
|
|
|
|
#define SHADER_SURFACEPARM 0x00000008
|
|
|
|
|
#define SHADER_NOMIPMAPS 0x00000010
|
|
|
|
|
#define SHADER_NOPICMIP 0x00000020
|
|
|
|
|
#define SHADER_NOCOMPRESS 0x00000040
|
|
|
|
|
#define SHADER_NOSHADOWS 0x00000080
|
|
|
|
|
#define SHADER_NOFRAGMENTS 0x00000100
|
|
|
|
|
#define SHADER_ENTITYMERGABLE 0x00000200
|
|
|
|
|
#define SHADER_POLYGONOFFSET 0x00000400
|
|
|
|
|
#define SHADER_CULL 0x00000800
|
|
|
|
|
#define SHADER_SORT 0x00001000
|
|
|
|
|
#define SHADER_TESSSIZE 0x00002000
|
|
|
|
|
#define SHADER_SKYPARMS 0x00004000
|
|
|
|
|
#define SHADER_DEFORMVERTEXES 0x00008000
|
|
|
|
|
|
|
|
|
|
// shader stage flags
|
|
|
|
|
#define SHADERSTAGE_NEXTBUNDLE 0x00000001
|
|
|
|
|
#define SHADERSTAGE_VERTEXPROGRAM 0x00000002
|
|
|
|
|
#define SHADERSTAGE_FRAGMENTPROGRAM 0x00000004
|
|
|
|
|
#define SHADERSTAGE_ALPHAFUNC 0x00000008
|
|
|
|
|
#define SHADERSTAGE_BLENDFUNC 0x00000010
|
|
|
|
|
#define SHADERSTAGE_DEPTHFUNC 0x00000020
|
|
|
|
|
#define SHADERSTAGE_DEPTHWRITE 0x00000040
|
|
|
|
|
#define SHADERSTAGE_DETAIL 0x00000080
|
|
|
|
|
#define SHADERSTAGE_RGBGEN 0x00000100
|
|
|
|
|
#define SHADERSTAGE_ALPHAGEN 0x00000200
|
|
|
|
|
|
|
|
|
|
// stage bundle flags
|
|
|
|
|
#define STAGEBUNDLE_NOMIPMAPS 0x00000001
|
|
|
|
|
#define STAGEBUNDLE_NOPICMIP 0x00000002
|
|
|
|
|
#define STAGEBUNDLE_NOCOMPRESS 0x00000004
|
|
|
|
|
#define STAGEBUNDLE_CLAMPTEXCOORDS 0x00000008
|
|
|
|
|
#define STAGEBUNDLE_ANIMFREQUENCY 0x00000010
|
|
|
|
|
#define STAGEBUNDLE_MAP 0x00000020
|
|
|
|
|
#define STAGEBUNDLE_BUMPMAP 0x00000040
|
|
|
|
|
#define STAGEBUNDLE_CUBEMAP 0x00000080
|
|
|
|
|
#define STAGEBUNDLE_VIDEOMAP 0x00000100
|
|
|
|
|
#define STAGEBUNDLE_TEXENVCOMBINE 0x00000200
|
|
|
|
|
#define STAGEBUNDLE_TCGEN 0x00000400
|
|
|
|
|
#define STAGEBUNDLE_TCMOD 0x00000800
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
WAVEFORM_SIN,
|
|
|
|
|
WAVEFORM_TRIANGLE,
|
|
|
|
|
WAVEFORM_SQUARE,
|
|
|
|
|
WAVEFORM_SAWTOOTH,
|
|
|
|
|
WAVEFORM_INVERSESAWTOOTH,
|
|
|
|
|
WAVEFORM_NOISE
|
|
|
|
|
} waveForm_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
SORT_SKY = 1,
|
|
|
|
|
SORT_OPAQUE,
|
|
|
|
|
SORT_DECAL,
|
|
|
|
|
SORT_SEETHROUGH,
|
|
|
|
|
SORT_BANNER,
|
|
|
|
|
SORT_UNDERWATER,
|
|
|
|
|
SORT_WATER,
|
|
|
|
|
SORT_INNERBLEND,
|
|
|
|
|
SORT_BLEND,
|
|
|
|
|
SORT_BLEND2,
|
|
|
|
|
SORT_BLEND3,
|
|
|
|
|
SORT_BLEND4,
|
|
|
|
|
SORT_OUTERBLEND,
|
|
|
|
|
SORT_ADDITIVE,
|
|
|
|
|
SORT_NEAREST
|
|
|
|
|
} sort_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-12 22:00:00 +02:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
DEFORMVERTEXES_WAVE,
|
|
|
|
|
DEFORMVERTEXES_MOVE,
|
|
|
|
|
DEFORMVERTEXES_NORMAL,
|
|
|
|
|
} deformVertsType_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
TCGEN_BASE,
|
|
|
|
|
TCGEN_LIGHTMAP,
|
|
|
|
|
TCGEN_ENVIRONMENT,
|
|
|
|
|
TCGEN_VECTOR,
|
|
|
|
|
TCGEN_WARP,
|
|
|
|
|
TCGEN_LIGHTVECTOR,
|
|
|
|
|
TCGEN_HALFANGLE,
|
|
|
|
|
TCGEN_REFLECTION,
|
|
|
|
|
TCGEN_NORMAL
|
|
|
|
|
} tcGenType_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
TCMOD_TRANSLATE,
|
|
|
|
|
TCMOD_SCALE,
|
|
|
|
|
TCMOD_SCROLL,
|
|
|
|
|
TCMOD_ROTATE,
|
|
|
|
|
TCMOD_STRETCH,
|
|
|
|
|
TCMOD_TURB,
|
|
|
|
|
TCMOD_TRANSFORM
|
|
|
|
|
} tcModType_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
RGBGEN_IDENTITY,
|
|
|
|
|
RGBGEN_IDENTITYLIGHTING,
|
|
|
|
|
RGBGEN_WAVE,
|
|
|
|
|
RGBGEN_COLORWAVE,
|
|
|
|
|
RGBGEN_VERTEX,
|
|
|
|
|
RGBGEN_ONEMINUSVERTEX,
|
|
|
|
|
RGBGEN_ENTITY,
|
|
|
|
|
RGBGEN_ONEMINUSENTITY,
|
|
|
|
|
RGBGEN_LIGHTINGAMBIENT,
|
|
|
|
|
RGBGEN_LIGHTINGDIFFUSE,
|
|
|
|
|
RGBGEN_CONST
|
|
|
|
|
} rgbGenType_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
ALPHAGEN_IDENTITY,
|
|
|
|
|
ALPHAGEN_WAVE,
|
|
|
|
|
ALPHAGEN_ALPHAWAVE,
|
|
|
|
|
ALPHAGEN_VERTEX,
|
|
|
|
|
ALPHAGEN_ONEMINUSVERTEX,
|
|
|
|
|
ALPHAGEN_ENTITY,
|
|
|
|
|
ALPHAGEN_ONEMINUSENTITY,
|
|
|
|
|
ALPHAGEN_DOT,
|
|
|
|
|
ALPHAGEN_ONEMINUSDOT,
|
|
|
|
|
ALPHAGEN_FADE,
|
|
|
|
|
ALPHAGEN_ONEMINUSFADE,
|
|
|
|
|
ALPHAGEN_LIGHTINGSPECULAR,
|
|
|
|
|
ALPHAGEN_CONST
|
|
|
|
|
} alphaGenType_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
TEX_GENERIC,
|
|
|
|
|
TEX_LIGHTMAP,
|
|
|
|
|
TEX_CINEMATIC
|
|
|
|
|
} texType_t;
|
2008-10-12 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2008-10-19 22:00:00 +02:00
|
|
|
|
waveForm_t type;
|
|
|
|
|
float params[4];
|
|
|
|
|
} waveFunc_t;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GLenum mode;
|
|
|
|
|
} cull_t;
|
2008-10-12 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
texture_t *farBox[6];
|
|
|
|
|
float cloudHeight;
|
|
|
|
|
texture_t *nearBox[6];
|
|
|
|
|
} skyParms_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
deformVertsType_t type;
|
|
|
|
|
waveFunc_t func;
|
|
|
|
|
float params[3];
|
|
|
|
|
} deformVerts_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GLint rgbCombine;
|
|
|
|
|
GLint rgbSource[3];
|
|
|
|
|
GLint rgbOperand[3];
|
|
|
|
|
GLint rgbScale;
|
|
|
|
|
|
|
|
|
|
GLint alphaCombine;
|
|
|
|
|
GLint alphaSource[3];
|
|
|
|
|
GLint alphaOperand[3];
|
|
|
|
|
GLint alphaScale;
|
|
|
|
|
|
|
|
|
|
GLfloat constColor[4];
|
|
|
|
|
} texEnvCombine_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
tcGenType_t type;
|
|
|
|
|
float params[6];
|
|
|
|
|
} tcGen_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
tcModType_t type;
|
|
|
|
|
waveFunc_t func;
|
|
|
|
|
float params[6];
|
|
|
|
|
} tcMod_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GLenum func;
|
|
|
|
|
GLclampf ref;
|
|
|
|
|
} alphaFunc_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GLenum src;
|
|
|
|
|
GLenum dst;
|
|
|
|
|
} blendFunc_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
GLenum func;
|
|
|
|
|
} depthFunc_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
rgbGenType_t type;
|
|
|
|
|
waveFunc_t func;
|
|
|
|
|
float params[3];
|
|
|
|
|
} rgbGen_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
alphaGenType_t type;
|
|
|
|
|
waveFunc_t func;
|
|
|
|
|
float params[3];
|
|
|
|
|
} alphaGen_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
texType_t texType;
|
|
|
|
|
uint flags;
|
|
|
|
|
|
|
|
|
|
texture_t *textures[SHADER_MAX_TEXTURES];
|
|
|
|
|
uint numTextures;
|
|
|
|
|
|
|
|
|
|
float animFrequency;
|
|
|
|
|
video_t cinematicHandle;
|
|
|
|
|
|
|
|
|
|
GLint texEnv;
|
|
|
|
|
texEnvCombine_t texEnvCombine;
|
|
|
|
|
|
|
|
|
|
tcGen_t tcGen;
|
|
|
|
|
tcMod_t tcMod[SHADER_MAX_TCMOD];
|
|
|
|
|
uint tcModNum;
|
|
|
|
|
} stageBundle_t;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
bool ignore;
|
|
|
|
|
uint flags;
|
|
|
|
|
|
|
|
|
|
stageBundle_t *bundles[MAX_TEXTURE_UNITS];
|
|
|
|
|
uint numBundles;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
program_t *vertexProgram;
|
|
|
|
|
program_t *fragmentProgram;
|
|
|
|
|
|
|
|
|
|
alphaFunc_t alphaFunc;
|
|
|
|
|
blendFunc_t blendFunc;
|
|
|
|
|
depthFunc_t depthFunc;
|
|
|
|
|
|
|
|
|
|
rgbGen_t rgbGen;
|
|
|
|
|
alphaGen_t alphaGen;
|
|
|
|
|
} shaderStage_t;
|
|
|
|
|
|
2008-10-20 22:00:00 +02:00
|
|
|
|
typedef struct ref_shader_s
|
2008-10-19 22:00:00 +02:00
|
|
|
|
{
|
|
|
|
|
string name;
|
|
|
|
|
int shaderNum;
|
|
|
|
|
shaderType_t shaderType;
|
|
|
|
|
uint surfaceParm;
|
|
|
|
|
uint contentFlags;
|
|
|
|
|
uint flags;
|
|
|
|
|
|
|
|
|
|
cull_t cull;
|
|
|
|
|
sort_t sort;
|
|
|
|
|
uint tessSize;
|
|
|
|
|
skyParms_t skyParms;
|
|
|
|
|
deformVerts_t deformVertexes[SHADER_MAX_DEFORMVERTEXES];
|
|
|
|
|
uint deformVertexesNum;
|
|
|
|
|
shaderStage_t *stages[SHADER_MAX_STAGES];
|
|
|
|
|
uint numStages;
|
2008-10-20 22:00:00 +02:00
|
|
|
|
struct ref_shader_s *nextHash;
|
|
|
|
|
} ref_shader_t;
|
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-10-20 22:00:00 +02:00
|
|
|
|
extern ref_shader_t *r_defaultShader;
|
|
|
|
|
extern ref_shader_t *r_lightmapShader;
|
|
|
|
|
extern ref_shader_t *r_waterCausticsShader;
|
|
|
|
|
extern ref_shader_t *r_slimeCausticsShader;
|
|
|
|
|
extern ref_shader_t *r_lavaCausticsShader;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
|
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 );
|
|
|
|
|
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-10-19 22:00:00 +02:00
|
|
|
|
#define SKY_SIZE 8
|
|
|
|
|
#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-10-19 22:00:00 +02:00
|
|
|
|
typedef struct mipTex_s
|
|
|
|
|
{
|
|
|
|
|
string name; // original miptex name
|
2008-10-20 22:00:00 +02:00
|
|
|
|
ref_shader_t *shader; // texture shader
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int contents;
|
|
|
|
|
int flags;
|
|
|
|
|
} mipTex_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-10-19 22:00:00 +02:00
|
|
|
|
mipTex_t *texInfo;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
vec3_t normal;
|
|
|
|
|
vec2_t st;
|
|
|
|
|
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];
|
|
|
|
|
uint vbo[6];
|
|
|
|
|
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;
|
|
|
|
|
mipTex_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;
|
|
|
|
|
byte *lightMaps;
|
|
|
|
|
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-07-23 22:00:00 +02:00
|
|
|
|
/*
|
|
|
|
|
=======================================================================
|
|
|
|
|
|
|
|
|
|
GL STATE MANAGER
|
|
|
|
|
|
|
|
|
|
=======================================================================
|
|
|
|
|
*/
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
R_OPENGL_110 = 0, // base
|
|
|
|
|
R_SGIS_MIPMAPS_EXT,
|
|
|
|
|
R_WGL_SWAPCONTROL,
|
|
|
|
|
R_COMBINE_EXT,
|
2008-08-27 22:00:00 +02:00
|
|
|
|
R_DRAW_RANGEELEMENTS_EXT,
|
2008-08-25 22:00:00 +02:00
|
|
|
|
R_ARB_MULTITEXTURE,
|
|
|
|
|
R_LOCKARRAYS_EXT,
|
|
|
|
|
R_TEXTURE_3D_EXT,
|
|
|
|
|
R_TEXTURECUBEMAP_EXT,
|
|
|
|
|
R_DOT3_ARB_EXT,
|
|
|
|
|
R_CLAMPTOEDGE_EXT,
|
|
|
|
|
R_ANISOTROPY_EXT,
|
|
|
|
|
R_BLEND_MINMAX_EXT,
|
|
|
|
|
R_STENCILTWOSIDE_EXT,
|
|
|
|
|
R_BLEND_SUBTRACT_EXT,
|
|
|
|
|
R_SHADER_OBJECTS_EXT,
|
|
|
|
|
R_SHADER_GLSL100_EXT,
|
|
|
|
|
R_VERTEX_SHADER_EXT, // glsl vertex program
|
|
|
|
|
R_FRAGMENT_SHADER_EXT, // glsl fragment program
|
2008-10-19 22:00:00 +02:00
|
|
|
|
R_VERTEX_PROGRAM_EXT, // cg vertex program
|
|
|
|
|
R_FRAGMENT_PROGRAM_EXT, // cg fragment program
|
2008-08-25 22:00:00 +02:00
|
|
|
|
R_EXT_POINTPARAMETERS,
|
|
|
|
|
R_SEPARATESTENCIL_EXT,
|
|
|
|
|
R_ARB_TEXTURE_NPOT_EXT,
|
|
|
|
|
R_ARB_VERTEX_BUFFER_OBJECT_EXT,
|
|
|
|
|
R_CUSTOM_VERTEX_ARRAY_EXT,
|
|
|
|
|
R_TEXTURE_COMPRESSION_EXT,
|
|
|
|
|
R_TEXTURE_ENV_ADD_EXT,
|
|
|
|
|
R_EXTCOUNT
|
|
|
|
|
} r_opengl_extensions;
|
|
|
|
|
|
2008-07-23 22:00:00 +02:00
|
|
|
|
typedef struct glstate_s
|
|
|
|
|
{
|
|
|
|
|
bool orthogonal;
|
|
|
|
|
word gammaRamp[768]; // current gamma ramp
|
|
|
|
|
word stateRamp[768]; // original gamma ramp
|
|
|
|
|
uint screenTexture;
|
|
|
|
|
|
2008-08-25 22:00:00 +02:00
|
|
|
|
vec4_t draw_color; // current color
|
2008-07-23 22:00:00 +02:00
|
|
|
|
uint activeTMU;
|
2008-08-28 22:00:00 +02:00
|
|
|
|
int texNum[MAX_TEXTURE_UNITS];
|
|
|
|
|
int texEnv[MAX_TEXTURE_UNITS];
|
2008-07-23 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// render current state
|
|
|
|
|
bool cullFace;
|
|
|
|
|
bool polygonOffsetFill;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
bool vertexProgram;
|
|
|
|
|
bool fragmentProgram;
|
2008-07-23 22:00:00 +02:00
|
|
|
|
bool alpha_test;
|
|
|
|
|
bool depth_test;
|
|
|
|
|
bool blend;
|
|
|
|
|
|
|
|
|
|
// OpenGL current state
|
|
|
|
|
GLenum cullMode;
|
|
|
|
|
GLfloat offsetFactor;
|
|
|
|
|
GLfloat offsetUnits;
|
|
|
|
|
GLenum alphaFunc;
|
|
|
|
|
GLclampf alphaRef;
|
|
|
|
|
GLenum blendSrc;
|
|
|
|
|
GLenum blendDst;
|
|
|
|
|
GLenum depthFunc;
|
|
|
|
|
GLboolean depthMask;
|
2008-07-26 22:00:00 +02:00
|
|
|
|
GLfloat polygonoffset[2];
|
2008-07-23 22:00:00 +02:00
|
|
|
|
} glstate_t;
|
|
|
|
|
|
|
|
|
|
// contains constant values that are always
|
|
|
|
|
// setting by R_Init and using as read-only
|
|
|
|
|
typedef struct glconfig_s
|
|
|
|
|
{
|
2008-08-02 22:00:00 +02:00
|
|
|
|
const char *renderer_string;
|
|
|
|
|
const char *vendor_string;
|
|
|
|
|
const char *version_string;
|
2008-07-23 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// list of supported extensions
|
2008-08-02 22:00:00 +02:00
|
|
|
|
const char *extensions_string;
|
|
|
|
|
byte extension[R_EXTCOUNT];
|
2008-08-25 22:00:00 +02:00
|
|
|
|
uint max_entities;
|
2008-08-02 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
int textureunits;
|
2008-10-19 22:00:00 +02:00
|
|
|
|
int texturecoords;
|
|
|
|
|
int imageunits;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
GLint max_2d_texture_size;
|
|
|
|
|
GLint max_2d_rectangle_size;
|
|
|
|
|
GLint max_3d_texture_size;
|
|
|
|
|
GLint max_cubemap_texture_size;
|
|
|
|
|
GLint max_anisotropy;
|
2008-08-02 22:00:00 +02:00
|
|
|
|
GLint texRectangle;
|
2008-08-25 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
bool deviceSupportsGamma;
|
2008-08-02 22:00:00 +02:00
|
|
|
|
bool fullscreen;
|
|
|
|
|
int prev_mode;
|
2008-07-23 22:00:00 +02:00
|
|
|
|
} glconfig_t;
|
|
|
|
|
|
2008-10-19 22:00:00 +02:00
|
|
|
|
extern glconfig_t gl_config;
|
|
|
|
|
extern glstate_t gl_state;
|
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
|
|
|
|
|
|
|
|
|
|
=======================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define VBO_OFFSET(i) ((char *)NULL + (i))
|
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 struct
|
|
|
|
|
{
|
|
|
|
|
uint indexBuffer;
|
|
|
|
|
uint vertexBuffer;
|
|
|
|
|
uint normalBuffer;
|
|
|
|
|
uint colorBuffer;
|
|
|
|
|
uint texCoordBuffer[MAX_TEXTURE_UNITS];
|
|
|
|
|
} vbo_t;
|
|
|
|
|
|
|
|
|
|
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 vbo_t rb_vbo;
|
|
|
|
|
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-10-19 22:00:00 +02:00
|
|
|
|
extern uint indexArray[MAX_INDICES * 4];
|
|
|
|
|
extern vec3_t vertexArray[MAX_VERTICES * 2];
|
|
|
|
|
extern vec3_t tangentArray[MAX_VERTICES];
|
|
|
|
|
extern vec3_t binormalArray[MAX_VERTICES];
|
|
|
|
|
extern vec3_t normalArray[MAX_VERTICES];
|
|
|
|
|
extern vec4_t colorArray[MAX_VERTICES];
|
|
|
|
|
extern vec3_t texCoordArray[MAX_TEXTURE_UNITS][MAX_VERTICES];
|
|
|
|
|
extern vec4_t inColorArray[MAX_VERTICES];
|
|
|
|
|
extern vec4_t inTexCoordArray[MAX_VERTICES];
|
|
|
|
|
extern int numIndex;
|
|
|
|
|
extern int numVertex;
|
|
|
|
|
|
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_VBOInfo_f( void );
|
|
|
|
|
uint RB_AllocStaticBuffer( uint target, int size );
|
|
|
|
|
uint RB_AllocStreamBuffer( uint target, int size );
|
|
|
|
|
void RB_InitBackend( void );
|
|
|
|
|
void RB_ShutdownBackend( void );
|
|
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
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 );
|
|
|
|
|
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;
|
|
|
|
|
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;
|
|
|
|
|
extern cvar_t *r_debugsort;
|
|
|
|
|
extern cvar_t *r_speeds;
|
|
|
|
|
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;
|
|
|
|
|
extern cvar_t *r_detailtextures;
|
|
|
|
|
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
|