...
| Code Block |
|---|
void main()
{
gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
} |
Define / Default Values List
This is a list of defines. You can use them in if statements:
| Code Block |
|---|
#if NAME == VALUE
#endif |
To block out sections of code based on these. The main one to note here that isn't used in the games default shaders may be BUILD_REVISION which is 34, 35, 36 etc. and useful for making shaders compatible with older game versions.
Since these are clientside fields you can retrieve some of them via. script commands but not necessarily all of them.
The Version Added field only is filled in if the value wasn't available to begin with when shaders were first added.
| Define Name | Example | Version Added | Notes | ||
|---|---|---|---|---|---|
#version 300 es precision highp float; | If mobile this will be defined (open GL version etc.) | ||||
#version 330 core #define mediump #define lowp #define highp | If not mobile this will be defined (open GL version etc.) | ||||
#define MAX_NUM_LIGHTS | 3 | Same as the client setting for Maximum Number of Lights | |||
#define MAX_NUM_BONES | 64 | This can vary across some versions but now is standardised to 64. | |||
#define GAMMA_CORRECTION | 1 or 0 | Gamma Correction game setting on/off | |||
#define FRAGMENT_LIGHTING | 1 or 0 | Fragment Lighting game setting on/off | |||
#define SHADER_QUALITY_MODE | 0, 1 or 2 | Shader quality mode game setting (low, medium, high) | |||
#define KEYHOLING_ENABLED | 1 or 0 | Keyholing game setting on/off | |||
#define SHADER_DEBUG_MODE | 1 or 0 | Shader debug mode on/off | |||
#define BUILD_VERSION | 8193 | This is very unlikely to change for MP servers - since the server version must match the client version - but can perhaps matter for SP modules if they want to support older versions. You can still safely use this with the BUILD_REVISION to get a more accurate picture. | |||
#define BUILD_REVISION | 35 | This is the incremental patch number at the end of the patch version. Omits the last part, eg: 1.87.8193.35.5 won't show the 5, just be "35" | |||
#define NO_DISCARD | 1 or 0 | Discard enabled or not | |||
#define POSTPROCESSING_TYPES_ENABLED | Bitmask value | See inc_postpr.shd for the bitmask values
| |||
#define varying | out or in | out = is the for types GL_VERTEX_SHADER and in = not vertex shader | |||
#define attribute | in | ||||
#define texture2D | texture | ||||
#define textureCube | texture | ||||
#define gl_FragColor compat_glFragColor out vec4 compat_glFragColor; | Only added if a fragment shader |
SHD Format
Shaders are relatively standard text files, written in c-like code.
...