2010-03-14 14:35:56 +00:00
# ifndef SHADER_H
# define SHADER_H
2009-11-04 21:16:50 +00:00
typedef void ( shader_gen_t ) ( char * name , shader_t * , const void * args ) ;
2012-11-27 03:23:19 +00:00
# define SHADER_TMU_MAX 16
2004-08-23 00:15:46 +00:00
# define SHADER_PASS_MAX 8
# define SHADER_MAX_TC_MODS 8
# define SHADER_DEFORM_MAX 8
# define SHADER_MAX_ANIMFRAMES 8
2004-10-19 16:10:14 +00:00
# define SHADER_ANIM_FRAMES_MAX 16
2006-03-11 03:12:10 +00:00
# define SHADER_PROGPARMS_MAX 16
2004-10-19 16:10:14 +00:00
typedef enum {
SHADER_BSP ,
SHADER_BSP_VERTEX ,
SHADER_BSP_FLARE ,
SHADER_MD3 ,
SHADER_2D
} shadertype_t ;
typedef enum {
MF_NONE = 1 < < 0 ,
MF_NORMALS = 1 < < 1 ,
MF_TRNORMALS = 1 < < 2 ,
MF_COLORS = 1 < < 3 ,
MF_STCOORDS = 1 < < 4 ,
MF_LMCOORDS = 1 < < 5 ,
MF_NOCULL = 1 < < 6 ,
MF_NONBATCHED = 1 < < 7
} meshfeatures_t ;
2004-08-23 00:15:46 +00:00
//colour manipulation
typedef struct
{
enum {
SHADER_FUNC_SIN ,
SHADER_FUNC_TRIANGLE ,
SHADER_FUNC_SQUARE ,
SHADER_FUNC_SAWTOOTH ,
SHADER_FUNC_INVERSESAWTOOTH ,
2004-10-19 16:10:14 +00:00
SHADER_FUNC_NOISE ,
SHADER_FUNC_CONSTANT
2004-08-23 00:15:46 +00:00
} type ; // SHADER_FUNC enum
float args [ 4 ] ; // offset, amplitude, phase_offset, rate
} shaderfunc_t ;
//tecture coordinate manipulation
typedef struct
{
enum {
SHADER_TCMOD_NONE , //bug
SHADER_TCMOD_SCALE , //some sorta tabled deformation
SHADER_TCMOD_SCROLL , //boring moving texcoords with time
SHADER_TCMOD_STRETCH , //constant factor
2004-10-19 16:10:14 +00:00
SHADER_TCMOD_ROTATE ,
SHADER_TCMOD_TRANSFORM ,
SHADER_TCMOD_TURB
2004-08-23 00:15:46 +00:00
} type ;
float args [ 6 ] ;
} tcmod_t ;
//vertex positioning manipulation.
typedef struct
{
enum {
DEFORMV_NONE , //bug
DEFORMV_MOVE ,
DEFORMV_WAVE ,
DEFORMV_NORMAL ,
DEFORMV_BULGE ,
DEFORMV_AUTOSPRITE ,
DEFORMV_AUTOSPRITE2 ,
DEFORMV_PROJECTION_SHADOW
} type ;
float args [ 4 ] ;
shaderfunc_t func ;
} deformv_t ;
2009-11-04 21:16:50 +00:00
enum
{
/*source and dest factors match each other for easier parsing
but they ' re not meant to ever be set on the shader itself
NONE is also invalid , and is used to signify disabled , it should never be set on only one
*/
SBITS_SRCBLEND_NONE = 0x00000000 ,
SBITS_SRCBLEND_ZERO = 0x00000001 ,
SBITS_SRCBLEND_ONE = 0x00000002 ,
SBITS_SRCBLEND_DST_COLOR = 0x00000003 ,
SBITS_SRCBLEND_ONE_MINUS_DST_COLOR = 0x00000004 ,
SBITS_SRCBLEND_SRC_ALPHA = 0x00000005 ,
SBITS_SRCBLEND_ONE_MINUS_SRC_ALPHA = 0x00000006 ,
SBITS_SRCBLEND_DST_ALPHA = 0x00000007 ,
SBITS_SRCBLEND_ONE_MINUS_DST_ALPHA = 0x00000008 ,
SBITS_SRCBLEND_SRC_COLOR_INVALID = 0x00000009 ,
SBITS_SRCBLEND_ONE_MINUS_SRC_COLOR_INVALID = 0x0000000a ,
SBITS_SRCBLEND_ALPHA_SATURATE = 0x0000000b ,
# define SBITS_SRCBLEND_BITS 0x0000000f
/*must match src factors, just shifted 4*/
SBITS_DSTBLEND_NONE = 0x00000000 ,
SBITS_DSTBLEND_ZERO = 0x00000010 ,
SBITS_DSTBLEND_ONE = 0x00000020 ,
SBITS_DSTBLEND_DST_COLOR_INVALID = 0x00000030 ,
SBITS_DSTBLEND_ONE_MINUS_DST_COLOR_INVALID = 0x00000040 ,
SBITS_DSTBLEND_SRC_ALPHA = 0x00000050 ,
SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA = 0x00000060 ,
SBITS_DSTBLEND_DST_ALPHA = 0x00000070 ,
SBITS_DSTBLEND_ONE_MINUS_DST_ALPHA = 0x00000080 ,
SBITS_DSTBLEND_SRC_COLOR = 0x00000090 ,
SBITS_DSTBLEND_ONE_MINUS_SRC_COLOR = 0x000000a0 ,
SBITS_DSTBLEND_ALPHA_SATURATE_INVALID = 0x000000b0 ,
# define SBITS_DSTBLEND_BITS 0x000000f0
# define SBITS_BLEND_BITS (SBITS_SRCBLEND_BITS|SBITS_DSTBLEND_BITS)
2012-09-30 05:52:03 +00:00
SBITS_MASK_RED = 0x00000100 ,
SBITS_MASK_GREEN = 0x00000200 ,
SBITS_MASK_BLUE = 0x00000400 ,
SBITS_MASK_ALPHA = 0x00000800 ,
# define SBITS_MASK_BITS 0x00000f00
2009-11-04 21:16:50 +00:00
SBITS_ATEST_NONE = 0x00000000 ,
2012-09-30 05:52:03 +00:00
SBITS_ATEST_GT0 = 0x00001000 ,
SBITS_ATEST_LT128 = 0x00002000 ,
SBITS_ATEST_GE128 = 0x00003000 ,
# define SBITS_ATEST_BITS 0x0000f000
SBITS_MISC_DEPTHWRITE = 0x00010000 ,
SBITS_MISC_NODEPTHTEST = 0x00020000 ,
SBITS_MISC_DEPTHEQUALONLY = 0x00040000 ,
SBITS_MISC_DEPTHCLOSERONLY = 0x00080000 ,
# define SBITS_MISC_BITS 0x000f0000
2012-04-09 19:12:12 +00:00
SBITS_TRUFORM = 0x00100000 ,
2009-11-04 21:16:50 +00:00
} ;
2004-08-23 00:15:46 +00:00
2004-10-19 16:10:14 +00:00
typedef struct shaderpass_s {
int numMergedPasses ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
# ifndef NOMEDIA
2006-03-06 01:41:09 +00:00
struct cin_s * cin ;
2009-11-04 21:16:50 +00:00
# endif
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
unsigned int shaderbits ;
2004-08-23 00:15:46 +00:00
2011-03-02 03:43:38 +00:00
enum {
PBM_MODULATE ,
PBM_OVERBRIGHT ,
PBM_DECAL ,
PBM_ADD ,
PBM_DOTPRODUCT ,
2011-04-30 17:21:10 +00:00
PBM_REPLACE ,
2012-05-10 01:00:41 +00:00
PBM_REPLACELIGHT ,
PBM_MODULATE_PREV_COLOUR
2011-03-02 03:43:38 +00:00
} blendmode ;
2009-07-05 18:45:53 +00:00
2004-08-23 00:15:46 +00:00
enum {
RGB_GEN_WAVE ,
RGB_GEN_ENTITY ,
RGB_GEN_ONE_MINUS_ENTITY ,
2011-10-27 16:16:29 +00:00
RGB_GEN_VERTEX_LIGHTING ,
RGB_GEN_VERTEX_EXACT ,
2004-08-23 00:15:46 +00:00
RGB_GEN_ONE_MINUS_VERTEX ,
RGB_GEN_IDENTITY_LIGHTING ,
RGB_GEN_IDENTITY ,
2004-10-19 16:10:14 +00:00
RGB_GEN_CONST ,
RGB_GEN_UNKNOWN ,
2005-02-06 02:47:36 +00:00
RGB_GEN_LIGHTING_DIFFUSE ,
RGB_GEN_TOPCOLOR ,
RGB_GEN_BOTTOMCOLOR
2004-08-23 00:15:46 +00:00
} rgbgen ;
2009-11-04 21:16:50 +00:00
shaderfunc_t rgbgen_func ;
2004-08-23 00:15:46 +00:00
enum {
ALPHA_GEN_ENTITY ,
ALPHA_GEN_WAVE ,
ALPHA_GEN_PORTAL ,
ALPHA_GEN_SPECULAR ,
2004-10-19 16:10:14 +00:00
ALPHA_GEN_IDENTITY ,
ALPHA_GEN_VERTEX ,
ALPHA_GEN_CONST
2004-08-23 00:15:46 +00:00
} alphagen ;
2009-11-04 21:16:50 +00:00
shaderfunc_t alphagen_func ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
enum {
TC_GEN_BASE , //basic specified texture coords
TC_GEN_LIGHTMAP , //use loaded lightmap coords
TC_GEN_ENVIRONMENT ,
TC_GEN_DOTPRODUCT ,
TC_GEN_VECTOR ,
2011-02-25 04:22:14 +00:00
//these are really for use only in glsl stuff or perhaps cubemaps, as they generate 3d coords.
2009-11-04 21:16:50 +00:00
TC_GEN_NORMAL ,
TC_GEN_SVECTOR ,
TC_GEN_TVECTOR ,
2011-02-25 04:22:14 +00:00
TC_GEN_SKYBOX ,
TC_GEN_WOBBLESKY ,
TC_GEN_REFLECT ,
2009-11-04 21:16:50 +00:00
} tcgen ;
2004-08-23 00:15:46 +00:00
int numtcmods ;
2004-10-19 16:10:14 +00:00
tcmod_t tcmods [ SHADER_MAX_TC_MODS ] ;
2004-08-23 00:15:46 +00:00
int anim_numframes ;
2009-11-04 21:16:50 +00:00
texid_t anim_frames [ SHADER_MAX_ANIMFRAMES ] ;
2004-10-19 16:10:14 +00:00
float anim_fps ;
2009-11-04 21:16:50 +00:00
// unsigned int texturetype;
2004-08-23 00:15:46 +00:00
enum {
2009-11-04 21:16:50 +00:00
T_GEN_SINGLEMAP , //single texture specified in the shader
T_GEN_ANIMMAP , //animating sequence of textures specified in the shader
T_GEN_LIGHTMAP , //world light samples
T_GEN_DELUXMAP , //world light directions
T_GEN_SHADOWMAP , //light's depth values.
2011-12-27 08:35:19 +00:00
T_GEN_LIGHTCUBEMAP , //light's projected cubemap
2009-11-04 21:16:50 +00:00
T_GEN_DIFFUSE , //texture's default diffuse texture
T_GEN_NORMALMAP , //texture's default normalmap
T_GEN_SPECULAR , //texture's default specular texture
T_GEN_UPPEROVERLAY , //texture's default personal colour
T_GEN_LOWEROVERLAY , //texture's default team colour
T_GEN_FULLBRIGHT , //texture's default fullbright overlay
T_GEN_CURRENTRENDER , //copy the current screen to a texture, and draw that
2011-09-03 03:49:43 +00:00
T_GEN_SOURCECOLOUR , //used for render-to-texture targets
T_GEN_SOURCEDEPTH , //used for render-to-texture targets
2012-05-09 15:30:53 +00:00
T_GEN_REFLECTION , //reflection image (mirror-as-fbo)
T_GEN_REFRACTION , //refraction image (portal-as-fbo)
2013-03-12 23:13:39 +00:00
T_GEN_REFRACTIONDEPTH , //refraction image (portal-as-fbo)
2012-05-14 01:41:08 +00:00
T_GEN_RIPPLEMAP , //ripplemap image (water surface distortions-as-fbo)
2012-05-09 15:30:53 +00:00
2011-10-27 16:16:29 +00:00
T_GEN_SOURCECUBE , //used for render-to-texture targets
2009-11-04 21:16:50 +00:00
T_GEN_VIDEOMAP , //use the media playback as an image source, updating each frame for which it is visible
2011-12-23 03:12:29 +00:00
T_GEN_CUBEMAP , //use a cubemap instead, otherwise like T_GEN_SINGLEMAP
T_GEN_3DMAP , //use a 3d texture instead, otherwise T_GEN_SINGLEMAP.
2009-11-04 21:16:50 +00:00
} texgen ;
enum {
2012-09-30 05:52:03 +00:00
SHADER_PASS_CLAMP = 1 < < 0 , //needed for d3d's sampler states, infects image flags
SHADER_PASS_NEAREST = 1 < < 1 , //needed for d3d's sampler states, infects image flags
SHADER_PASS_NOMIPMAP = 1 < < 2 , //infects image flags
2009-11-04 21:16:50 +00:00
SHADER_PASS_NOCOLORARRAY = 1 < < 3 ,
//FIXME: remove these
SHADER_PASS_VIDEOMAP = 1 < < 4 ,
SHADER_PASS_DETAIL = 1 < < 5 ,
SHADER_PASS_LIGHTMAP = 1 < < 6 ,
SHADER_PASS_DELUXMAP = 1 < < 7 ,
2006-03-11 03:12:10 +00:00
SHADER_PASS_ANIMMAP = 1 < < 8
2004-08-23 00:15:46 +00:00
} flags ;
} shaderpass_t ;
2005-04-16 16:21:27 +00:00
typedef struct
{
2009-11-04 21:16:50 +00:00
texid_t farbox_textures [ 6 ] ;
texid_t nearbox_textures [ 6 ] ;
2005-04-16 16:21:27 +00:00
} skydome_t ;
2010-08-28 17:14:38 +00:00
enum {
PERMUTATION_GENERIC = 0 ,
PERMUTATION_BUMPMAP = 1 ,
2012-11-29 13:37:48 +00:00
PERMUTATION_FULLBRIGHT = 2 ,
PERMUTATION_UPPERLOWER = 4 ,
PERMUTATION_DELUXE = 8 ,
PERMUTATION_SKELETAL = 16 ,
PERMUTATION_FOG = 32 ,
PERMUTATION_FRAMEBLEND = 64 ,
PERMUTATION_LIGHTSTYLES = 128 ,
PERMUTATIONS = 256
2010-08-28 17:14:38 +00:00
} ;
2012-04-24 07:59:11 +00:00
enum shaderattribs_e
{
VATTR_LEG_VERTEX ,
VATTR_VERTEX1 ,
VATTR_VERTEX2 ,
VATTR_COLOUR ,
VATTR_TEXCOORD ,
VATTR_LMCOORD ,
VATTR_NORMALS ,
VATTR_SNORMALS ,
VATTR_TNORMALS ,
VATTR_BONENUMS , /*skeletal only*/
VATTR_BONEWEIGHTS , /*skeletal only*/
2012-07-05 19:42:36 +00:00
VATTR_LMCOORD2 ,
VATTR_LMCOORD3 ,
VATTR_LMCOORD4 ,
2012-04-24 07:59:11 +00:00
VATTR_LEG_COLOUR ,
VATTR_LEG_ELEMENTS ,
VATTR_LEG_TMU0 ,
VATTR_LEG_FIRST = VATTR_LEG_COLOUR
} ;
2006-03-11 03:12:10 +00:00
typedef struct {
enum shaderprogparmtype_e {
2011-01-23 03:44:49 +00:00
SP_BAD , //never set (hopefully)
2008-12-23 02:55:20 +00:00
2011-01-23 03:44:49 +00:00
/*entity properties*/
2012-04-24 07:59:11 +00:00
SP_E_VBLEND ,
2011-12-26 15:19:13 +00:00
SP_E_LMSCALE ,
2011-09-03 03:49:43 +00:00
SP_E_ORIGIN ,
SP_E_COLOURS ,
SP_E_COLOURSIDENT ,
SP_E_GLOWMOD ,
SP_E_TOPCOLOURS ,
SP_E_BOTTOMCOLOURS ,
SP_E_TIME ,
2011-01-23 03:44:49 +00:00
SP_E_L_DIR , /*these light values are non-dynamic light as in classic quake*/
SP_E_L_MUL ,
SP_E_L_AMBIENT ,
2011-09-03 03:49:43 +00:00
SP_E_EYEPOS , /*viewer's eyepos, in model space*/
SP_V_EYEPOS , /*viewer's eyepos, in world space*/
2011-12-23 03:12:29 +00:00
SP_W_FOG ,
2011-09-03 03:49:43 +00:00
SP_M_ENTBONES ,
SP_M_VIEW ,
SP_M_MODEL ,
SP_M_MODELVIEW ,
SP_M_PROJECTION ,
SP_M_MODELVIEWPROJECTION ,
SP_M_INVVIEWPROJECTION ,
SP_M_INVMODELVIEWPROJECTION ,
2006-03-11 03:12:10 +00:00
2010-07-25 15:12:12 +00:00
SP_RENDERTEXTURESCALE , /*multiplier for currentrender->texcoord*/
2011-01-23 03:44:49 +00:00
SP_LIGHTRADIUS , /*these light values are realtime lighting*/
2009-07-18 20:46:42 +00:00
SP_LIGHTCOLOUR ,
2012-01-01 11:22:24 +00:00
SP_LIGHTCOLOURSCALE ,
2009-07-18 20:46:42 +00:00
SP_LIGHTPOSITION ,
2011-12-05 15:23:40 +00:00
SP_LIGHTSCREEN ,
2011-12-27 08:35:19 +00:00
SP_LIGHTPROJMATRIX ,
2012-08-04 01:35:52 +00:00
SP_LIGHTCUBEMATRIX ,
2013-03-12 23:13:39 +00:00
SP_LIGHTSHADOWMAPINFO ,
2009-07-18 20:46:42 +00:00
2006-03-11 03:12:10 +00:00
//things that are set immediatly
SP_FIRSTIMMEDIATE , //never set
2010-11-10 03:32:47 +00:00
SP_CONSTI ,
SP_CONSTF ,
2006-03-11 03:12:10 +00:00
SP_CVARI ,
SP_CVARF ,
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
SP_CVAR3F ,
2006-03-11 03:12:10 +00:00
SP_TEXTURE
} type ;
2010-08-28 17:14:38 +00:00
union
{
int ival ;
2010-11-10 03:32:47 +00:00
float fval ;
2010-08-28 17:14:38 +00:00
void * pval ;
} ;
2006-03-11 03:12:10 +00:00
} shaderprogparm_t ;
2011-01-23 03:44:49 +00:00
union programhandle_u
{
int glsl ;
2011-03-31 02:32:32 +00:00
# ifdef D3DQUAKE
struct
{
void * vert ;
void * frag ;
2011-09-03 03:49:43 +00:00
void * ctabf ;
void * ctabv ;
2012-09-30 05:52:03 +00:00
void * layout ;
2011-03-31 02:32:32 +00:00
} hlsl ;
# endif
2011-01-23 03:44:49 +00:00
} ;
2011-02-25 04:22:14 +00:00
typedef struct programshared_s
{
int refs ;
qboolean nofixedcompat ;
int numparams ;
shaderprogparm_t parm [ SHADER_PROGPARMS_MAX ] ;
2012-11-27 03:23:19 +00:00
struct {
union programhandle_u handle ;
unsigned int attrmask ;
unsigned int parm [ SHADER_PROGPARMS_MAX ] ;
} permu [ PERMUTATIONS ] ;
2011-02-25 04:22:14 +00:00
} program_t ;
2009-11-04 21:16:50 +00:00
typedef struct {
float factor ;
float unit ;
} polyoffset_t ;
struct shader_s
{
2012-07-05 19:42:36 +00:00
char name [ MAX_QPATH ] ;
2010-07-11 02:22:39 +00:00
int uses ;
2009-11-04 21:16:50 +00:00
int width ;
int height ;
int numpasses ;
texnums_t defaulttextures ;
2004-08-23 00:15:46 +00:00
struct shader_s * next ;
//end of shared fields.
byte_vec4_t fog_color ;
2004-10-19 16:10:14 +00:00
float fog_dist ;
2010-07-11 02:22:39 +00:00
float portaldist ;
2004-08-23 00:15:46 +00:00
int numdeforms ;
deformv_t deforms [ SHADER_DEFORM_MAX ] ;
2009-11-04 21:16:50 +00:00
polyoffset_t polyoffset ;
2004-08-23 00:15:46 +00:00
enum {
2004-10-19 16:10:14 +00:00
SHADER_SKY = 1 < < 0 ,
SHADER_NOMIPMAPS = 1 < < 1 ,
SHADER_NOPICMIP = 1 < < 2 ,
SHADER_CULL_FRONT = 1 < < 3 ,
SHADER_CULL_BACK = 1 < < 4 ,
SHADER_DEFORMV_BULGE = 1 < < 5 ,
SHADER_AUTOSPRITE = 1 < < 6 ,
SHADER_FLARE = 1 < < 7 ,
2011-05-20 04:10:46 +00:00
SHADER_NOIMAGE = 1 < < 8 ,
2004-10-19 16:10:14 +00:00
SHADER_ENTITY_MERGABLE = 1 < < 9 ,
SHADER_VIDEOMAP = 1 < < 10 ,
2012-11-27 03:23:19 +00:00
SHADER_DEPTHWRITE = 1 < < 11 , //some pass already wrote depth. not used by the renderer.
2004-11-13 17:31:04 +00:00
SHADER_AGEN_PORTAL = 1 < < 12 ,
2005-05-26 12:55:34 +00:00
SHADER_BLEND = 1 < < 13 , //blend or alphatest (not 100% opaque).
2009-11-04 21:16:50 +00:00
SHADER_NODRAW = 1 < < 14 , //parsed only to pee off developers when they forget it on no-pass shaders.
SHADER_NODLIGHT = 1 < < 15 , //from surfaceflags
2010-07-18 12:52:24 +00:00
SHADER_HASLIGHTMAP = 1 < < 16 ,
2011-01-23 03:44:49 +00:00
SHADER_HASTOPBOTTOM = 1 < < 17 ,
2012-05-09 15:30:53 +00:00
SHADER_STATICDATA = 1 < < 18 , //set if true: no deforms, no tcgen, rgbgen=identitylighting, alphagen=identity, tmu0=st + tmu1=lm(if available) for every pass, no norms
2012-05-11 01:57:00 +00:00
SHADER_HASREFLECT = 1 < < 19 , //says that we need to generate a reflection image first
SHADER_HASREFRACT = 1 < < 20 , //says that we need to generate a refraction image first
2013-03-12 23:13:39 +00:00
SHADER_HASREFRACTDEPTH = 1 < < 21 , //refraction generation needs to generate a depth texture too.
SHADER_HASNORMALMAP = 1 < < 22 , //says that we need to load a normalmap texture
SHADER_HASRIPPLEMAP = 1 < < 23 , //water surface disturbances for water splashes
SHADER_HASGLOSS = 1 < < 24 , //
2004-08-23 00:15:46 +00:00
} flags ;
2011-02-25 04:22:14 +00:00
program_t * prog ;
2006-03-11 03:12:10 +00:00
2004-10-19 16:10:14 +00:00
shaderpass_t passes [ SHADER_PASS_MAX ] ;
shadersort_t sort ;
2005-04-16 16:21:27 +00:00
skydome_t * skydome ;
2009-11-04 21:16:50 +00:00
shader_gen_t * generator ;
2011-12-05 15:23:40 +00:00
char * genargs ;
2005-04-16 16:21:27 +00:00
2004-10-19 16:10:14 +00:00
meshfeatures_t features ;
2010-07-11 02:22:39 +00:00
bucket_t bucket ;
2009-11-04 21:16:50 +00:00
} ;
2004-08-23 00:15:46 +00:00
2011-04-23 20:37:20 +00:00
# define MAX_SHADERS 2048 //fixme: this takes a lot of bss in the r_shaders list
2010-05-01 22:47:47 +00:00
extern shader_t * r_shaders ;
2009-11-04 21:16:50 +00:00
extern int be_maxpasses ;
2006-02-11 14:51:36 +00:00
2004-08-23 00:15:46 +00:00
2010-07-11 02:22:39 +00:00
void R_UnloadShader ( shader_t * shader ) ;
2005-10-07 02:13:15 +00:00
shader_t * R_RegisterPic ( char * name ) ;
2009-11-04 21:16:50 +00:00
shader_t * R_RegisterShader ( char * name , const char * shaderscript ) ;
shader_t * R_RegisterShader_Lightmap ( char * name ) ;
2004-10-26 23:06:29 +00:00
shader_t * R_RegisterShader_Vertex ( char * name ) ;
shader_t * R_RegisterShader_Flare ( char * name ) ;
2011-07-30 14:14:56 +00:00
shader_t * R_RegisterSkin ( char * shadername , char * modname ) ;
2009-11-04 21:16:50 +00:00
shader_t * R_RegisterCustom ( char * name , shader_gen_t * defaultgen , const void * args ) ;
void R_BuildDefaultTexnums ( texnums_t * tn , shader_t * shader ) ;
2005-03-20 02:57:11 +00:00
2010-07-11 02:22:39 +00:00
cin_t * R_ShaderGetCinematic ( shader_t * s ) ;
cin_t * R_ShaderFindCinematic ( char * name ) ;
2008-11-09 22:29:28 +00:00
2009-11-04 21:16:50 +00:00
void Shader_DefaultSkinShell ( char * shortname , shader_t * s , const void * args ) ;
2010-07-11 02:22:39 +00:00
void Shader_DefaultBSPLM ( char * shortname , shader_t * s , const void * args ) ;
void Shader_DefaultBSPQ1 ( char * shortname , shader_t * s , const void * args ) ;
void Shader_DefaultBSPQ2 ( char * shortname , shader_t * s , const void * args ) ;
void Shader_DefaultSkybox ( char * shortname , shader_t * s , const void * args ) ;
void Shader_DefaultCinematic ( char * shortname , shader_t * s , const void * args ) ;
2009-11-04 21:16:50 +00:00
void Shader_DefaultScript ( char * shortname , shader_t * s , const void * args ) ;
2004-10-26 23:06:29 +00:00
2009-11-04 21:16:50 +00:00
void Shader_DoReload ( void ) ;
2004-10-26 23:06:29 +00:00
void Shader_Shutdown ( void ) ;
qboolean Shader_Init ( void ) ;
2011-12-05 15:23:40 +00:00
void Shader_NeedReload ( qboolean rescanfs ) ;
2011-09-03 03:49:43 +00:00
void Shader_WriteOutGenerics_f ( void ) ;
2006-01-28 02:35:40 +00:00
mfog_t * CM_FogForOrigin ( vec3_t org ) ;
2009-11-04 21:16:50 +00:00
# define BEF_FORCEDEPTHWRITE 1
# define BEF_FORCEDEPTHTEST 2
# define BEF_FORCEADDITIVE 4 //blend dest = GL_ONE
# define BEF_FORCETRANSPARENT 8 //texenv replace -> modulate
# define BEF_FORCENODEPTH 16 //disables any and all depth.
2010-02-06 01:25:04 +00:00
# define BEF_PUSHDEPTH 32 //additional polygon offset
2011-04-23 20:37:20 +00:00
# define BEF_NODLIGHT 64 //don't use a dlight pass
# define BEF_NOSHADOWS 128 //don't appear in shadows
2011-04-30 17:21:10 +00:00
# define BEF_FORCECOLOURMOD 256 //q3 shaders default to 'rgbgen identity', and ignore ent colours. this forces ent colours to be considered
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
# define BEF_LINES 512 //draw line pairs instead of triangles.
2009-11-04 21:16:50 +00:00
2011-01-04 02:56:16 +00:00
# ifdef GLQUAKE
void GLBE_Init ( void ) ;
2012-07-05 19:42:36 +00:00
void GLBE_Shutdown ( void ) ;
2011-04-20 23:34:13 +00:00
void GLBE_SelectMode ( backendmode_t mode ) ;
void GLBE_DrawMesh_List ( shader_t * shader , int nummeshes , mesh_t * * mesh , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
void GLBE_DrawMesh_Single ( shader_t * shader , mesh_t * meshchain , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
2011-01-04 02:56:16 +00:00
void GLBE_SubmitBatch ( batch_t * batch ) ;
batch_t * GLBE_GetTempBatch ( void ) ;
void GLBE_GenBrushModelVBO ( model_t * mod ) ;
void GLBE_ClearVBO ( vbo_t * vbo ) ;
void GLBE_UploadAllLightmaps ( void ) ;
2012-07-07 05:17:43 +00:00
void GLBE_DrawWorld ( qboolean drawworld , qbyte * vis ) ;
2011-01-04 02:56:16 +00:00
qboolean GLBE_LightCullModel ( vec3_t org , model_t * model ) ;
void GLBE_SelectEntity ( entity_t * ent ) ;
2011-10-27 16:16:29 +00:00
void GLBE_SelectDLight ( dlight_t * dl , vec3_t colour ) ;
2012-05-14 01:41:08 +00:00
void GLBE_SubmitMeshes ( qboolean drawworld , int start , int stop ) ;
2013-03-12 23:13:39 +00:00
void GLBE_RenderToTexture ( texid_t sourcecol , texid_t sourcedepth , texid_t destcol , texid_t destdepth , qboolean usedepth ) ;
2011-01-04 02:56:16 +00:00
# endif
2012-09-30 05:52:03 +00:00
# ifdef D3D9QUAKE
void D3D9BE_Init ( void ) ;
void D3D9BE_Shutdown ( void ) ;
void D3D9BE_SelectMode ( backendmode_t mode ) ;
void D3D9BE_DrawMesh_List ( shader_t * shader , int nummeshes , mesh_t * * mesh , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
void D3D9BE_DrawMesh_Single ( shader_t * shader , mesh_t * meshchain , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
void D3D9BE_SubmitBatch ( batch_t * batch ) ;
batch_t * D3D9BE_GetTempBatch ( void ) ;
void D3D9BE_GenBrushModelVBO ( model_t * mod ) ;
void D3D9BE_ClearVBO ( vbo_t * vbo ) ;
void D3D9BE_UploadAllLightmaps ( void ) ;
void D3D9BE_DrawWorld ( qboolean drawworld , qbyte * vis ) ;
qboolean D3D9BE_LightCullModel ( vec3_t org , model_t * model ) ;
void D3D9BE_SelectEntity ( entity_t * ent ) ;
void D3D9BE_SelectDLight ( dlight_t * dl , vec3_t colour ) ;
2012-11-27 03:23:19 +00:00
qboolean D3D9Shader_CreateProgram ( program_t * prog , char * sname , int permu , char * * precompilerconstants , char * vert , char * frag ) ;
2012-09-30 05:52:03 +00:00
int D3D9Shader_FindUniform ( union programhandle_u * h , int type , char * name ) ;
void D3D9Shader_Init ( void ) ;
void D3D9BE_Reset ( qboolean before ) ;
# endif
# ifdef D3D11QUAKE
2012-07-05 19:42:36 +00:00
void D3D11BE_Init ( void ) ;
2012-09-30 05:52:03 +00:00
void D3D11BE_Shutdown ( void ) ;
2012-07-05 19:42:36 +00:00
void D3D11BE_SelectMode ( backendmode_t mode ) ;
void D3D11BE_DrawMesh_List ( shader_t * shader , int nummeshes , mesh_t * * mesh , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
void D3D11BE_DrawMesh_Single ( shader_t * shader , mesh_t * meshchain , vbo_t * vbo , texnums_t * texnums , unsigned int beflags ) ;
void D3D11BE_SubmitBatch ( batch_t * batch ) ;
batch_t * D3D11BE_GetTempBatch ( void ) ;
void D3D11BE_GenBrushModelVBO ( model_t * mod ) ;
void D3D11BE_ClearVBO ( vbo_t * vbo ) ;
void D3D11BE_UploadAllLightmaps ( void ) ;
2012-09-30 05:52:03 +00:00
void D3D11BE_DrawWorld ( qboolean drawworld , qbyte * vis ) ;
2012-07-05 19:42:36 +00:00
qboolean D3D11BE_LightCullModel ( vec3_t org , model_t * model ) ;
void D3D11BE_SelectEntity ( entity_t * ent ) ;
void D3D11BE_SelectDLight ( dlight_t * dl , vec3_t colour ) ;
2012-09-30 05:52:03 +00:00
qboolean D3D11Shader_CreateProgram ( program_t * prog , const char * name , int permu , char * * precompilerconstants , char * vert , char * frag ) ;
2012-07-05 19:42:36 +00:00
int D3D11Shader_FindUniform ( union programhandle_u * h , int type , char * name ) ;
void D3D11Shader_Init ( void ) ;
void D3D11BE_Reset ( qboolean before ) ;
2012-09-30 05:52:03 +00:00
void D3D11BE_SetupViewCBuffer ( void ) ;
void D3D11_UploadLightmap ( lightmapinfo_t * lm ) ;
2011-01-04 02:56:16 +00:00
# endif
2009-11-04 21:16:50 +00:00
2009-11-07 13:29:15 +00:00
//Asks the backend to invoke DrawMeshChain for each surface, and to upload lightmaps as required
2010-08-28 17:14:38 +00:00
void BE_DrawNonWorld ( void ) ;
2009-11-04 21:16:50 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
//Builds a hardware shader from the software representation
void BE_GenerateProgram ( shader_t * shader ) ;
2009-11-04 21:16:50 +00:00
# ifdef RTLIGHTS
2012-09-30 05:52:03 +00:00
//
void GLBE_PushOffsetShadow ( qboolean foobar ) ;
2009-11-07 13:29:15 +00:00
//sets up gl for depth-only FIXME
2013-03-12 23:13:39 +00:00
void GLBE_SetupForShadowMap ( texid_t shadowmaptex , int texwidth , int texheight , float shadowscale ) ;
2010-07-11 02:22:39 +00:00
//Called from shadowmapping code into backend
2012-01-01 11:22:24 +00:00
void GLBE_BaseEntTextures ( void ) ;
2012-09-30 05:52:03 +00:00
void D3D9BE_BaseEntTextures ( void ) ;
2011-12-23 03:12:29 +00:00
//prebuilds shadow volumes
void Sh_PreGenerateLights ( void ) ;
2009-11-07 13:29:15 +00:00
//Draws lights, called from the backend
2012-05-14 01:41:08 +00:00
void Sh_DrawLights ( qbyte * vis ) ;
2012-02-12 05:18:31 +00:00
void SH_FreeShadowMesh ( struct shadowmesh_s * sm ) ;
2012-09-30 05:52:03 +00:00
//frees all memory
2010-07-11 02:22:39 +00:00
void Sh_Shutdown ( void ) ;
2012-09-30 05:52:03 +00:00
//resize any textures to match new screen resize
void Sh_Reset ( void ) ;
2006-01-28 02:35:40 +00:00
# endif
2011-09-03 03:49:43 +00:00
struct shader_field_names_s
{
char * name ;
enum shaderprogparmtype_e ptype ;
2011-09-05 01:48:23 +00:00
} ;
extern struct shader_field_names_s shader_field_names [ ] ;
2010-03-14 14:35:56 +00:00
# endif