SHADERMODE_FAKELIGHT, ///< (fakelight) modulate texture by "fake" lighting (no lightmaps, no nothing)
SHADERMODE_LIGHTDIRECTIONMAP_MODELSPACE, ///< (lightmap) use directional pixel shading from texture containing modelspace light directions (q3bsp deluxemap)
SHADERMODE_LIGHTDIRECTIONMAP_TANGENTSPACE, ///< (lightmap) use directional pixel shading from texture containing tangentspace light directions (q1bsp deluxemap)
+ SHADERMODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP, // forced deluxemapping for lightmapped surfaces
+ SHADERMODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR, // forced deluxemapping for vertexlit surfaces
SHADERMODE_LIGHTDIRECTION, ///< (lightmap) use directional pixel shading from fixed light direction (q3bsp)
SHADERMODE_LIGHTSOURCE, ///< (lightsource) use directional pixel shading from light source (rtlight)
SHADERMODE_REFRACTION, ///< refract background (the material is rendered normally after this pass)
cvar_t r_framedatasize = {CVAR_SAVE, "r_framedatasize", "0.5", "size of renderer data cache used during one frame (for skeletal animation caching, light processing, etc)"};
extern cvar_t v_glslgamma;
+extern cvar_t v_glslgamma_2d;
extern qboolean v_flipped_state;
{"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_FAKELIGHT\n", " fakelight"},
{"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTDIRECTIONMAP_MODELSPACE\n", " lightdirectionmap_modelspace"},
{"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTDIRECTIONMAP_TANGENTSPACE\n", " lightdirectionmap_tangentspace"},
+ {"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP\n", " lightdirectionmap_forced_lightmap"},
+ {"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR\n", " lightdirectionmap_forced_vertexcolor"},
{"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTDIRECTION\n", " lightdirection"},
{"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTSOURCE\n", " lightsource"},
{"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_REFRACTION\n", " refraction"},
{"hlsl/default.hlsl", NULL, "hlsl/default.hlsl", "#define MODE_FAKELIGHT\n", " fakelight"},
{"hlsl/default.hlsl", NULL, "hlsl/default.hlsl", "#define MODE_LIGHTDIRECTIONMAP_MODELSPACE\n", " lightdirectionmap_modelspace"},
{"hlsl/default.hlsl", NULL, "hlsl/default.hlsl", "#define MODE_LIGHTDIRECTIONMAP_TANGENTSPACE\n", " lightdirectionmap_tangentspace"},
+ {"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP\n", " lightdirectionmap_forced_lightmap"},
+ {"glsl/default.glsl", NULL, "glsl/default.glsl", "#define MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR\n", " lightdirectionmap_forced_vertexcolor"},
{"hlsl/default.hlsl", NULL, "hlsl/default.hlsl", "#define MODE_LIGHTDIRECTION\n", " lightdirection"},
{"hlsl/default.hlsl", NULL, "hlsl/default.hlsl", "#define MODE_LIGHTSOURCE\n", " lightsource"},
{"hlsl/default.hlsl", NULL, "hlsl/default.hlsl", "#define MODE_REFRACTION\n", " refraction"},
permutation |= SHADERPERMUTATION_SPECULAR;
if (texturemode == GL_MODULATE)
permutation |= SHADERPERMUTATION_COLORMAPPING;
-// LordHavoc: VorteX broke the game by doing this, and did not cvar it properly, and did not add the proper checks (r_texture_sRGB_2d.integer would need to be checked), and it breaks with vid_sRGB where the gamma ramps are altered...
-// if (usegamma && r_texture_gammaramps && v_glslgamma.integer && !vid_gammatables_trivial)
-// permutation |= SHADERPERMUTATION_GAMMARAMPS;
+ if (usegamma && v_glslgamma.integer && v_glslgamma_2d.integer && !vid.sRGB2D && r_texture_gammaramps && !vid_gammatables_trivial)
+ permutation |= SHADERPERMUTATION_GAMMARAMPS;
else if (texturemode == GL_ADD)
permutation |= SHADERPERMUTATION_GLOW;
else if (texturemode == GL_DECAL)
if (specularscale > 0)
permutation |= SHADERPERMUTATION_SPECULAR | SHADERPERMUTATION_DIFFUSE;
}
- else if (r_glsl_deluxemapping.integer >= 2 && rsurface.uselightmaptexture)
+ else if (r_glsl_deluxemapping.integer >= 2)
{
// fake deluxemapping (uniform light direction in tangentspace)
- mode = SHADERMODE_LIGHTDIRECTIONMAP_TANGENTSPACE;
+ if (rsurface.uselightmaptexture)
+ mode = SHADERMODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP;
+ else
+ mode = SHADERMODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR;
permutation |= SHADERPERMUTATION_DIFFUSE;
if (specularscale > 0)
permutation |= SHADERPERMUTATION_SPECULAR | SHADERPERMUTATION_DIFFUSE;
{
shader.specularpowermod = atof(parameter[1]);
}
+ else if (!strcasecmp(parameter[0], "dprtlightambient") && numparameters >= 2)
+ {
+ shader.rtlightambient = atof(parameter[1]);
+ }
else if (!strcasecmp(parameter[0], "dpoffsetmapping") && numparameters >= 3)
{
if (!strcasecmp(parameter[1], "disable") || !strcasecmp(parameter[1], "none") || !strcasecmp(parameter[1], "off"))
texture->offsetscale = shader->offsetscale;
texture->specularscalemod = shader->specularscalemod;
texture->specularpowermod = shader->specularpowermod;
+ texture->rtlightambient = shader->rtlightambient;
if (shader->dpreflectcube[0])
texture->reflectcubetexture = R_GetCubemap(shader->dpreflectcube);
// gloss
float specularscalemod;
float specularpowermod;
+
+ // rtlightning ambient addition
+ float rtlightambient;
#define Q3SHADERINFO_COMPARE_END specularpowermod
}
q3shaderinfo_t;
// gloss
float specularscalemod;
float specularpowermod;
+
+ // diffuse and ambient
+ float rtlightambient;
}
texture_t;
qboolean negated;
float lightcolor[3];
VectorCopy(rsurface.rtlight->currentcolor, lightcolor);
- ambientscale = rsurface.rtlight->ambientscale;
- diffusescale = rsurface.rtlight->diffusescale;
+ ambientscale = rsurface.rtlight->ambientscale + rsurface.texture->rtlightambient;
+ diffusescale = rsurface.rtlight->diffusescale * max(0, 1.0 - rsurface.texture->rtlightambient);
specularscale = rsurface.rtlight->specularscale * rsurface.texture->specularscale;
if (!r_shadow_usenormalmap.integer)
{
"#if defined(USEFOGINSIDE) || defined(USEFOGOUTSIDE) || defined(USEFOGHEIGHTTEXTURE)\n"
"# define USEFOG\n"
"#endif\n"
-"#if defined(MODE_LIGHTMAP) || defined(MODE_LIGHTDIRECTIONMAP_MODELSPACE) || defined(MODE_LIGHTDIRECTIONMAP_TANGENTSPACE)\n"
+"#if defined(MODE_LIGHTMAP) || defined(MODE_LIGHTDIRECTIONMAP_MODELSPACE) || defined(MODE_LIGHTDIRECTIONMAP_TANGENTSPACE) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP)\n"
"# define USELIGHTMAP\n"
"#endif\n"
"#if defined(USESPECULAR) || defined(USEOFFSETMAPPING) || defined(USEREFLECTCUBE) || defined(MODE_FAKELIGHT) || defined(USEFOG)\n"
"#endif\n"
"void main(void)\n"
"{\n"
-"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND)\n"
+"#if defined(MODE_VERTEXCOLOR) || defined(USEVERTEXTEXTUREBLEND) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR)\n"
" VertexColor = Attrib_Color;\n"
"#endif\n"
" // copy the surface texcoord\n"
"\n"
"\n"
"#ifdef MODE_LIGHTDIRECTION\n"
-"#define SHADING\n"
-"#ifdef USEDIFFUSE\n"
-" myhalf3 lightnormal = myhalf3(normalize(LightVector));\n"
-"#endif\n"
-"#define lightcolor LightColor\n"
+" #define SHADING\n"
+" #ifdef USEDIFFUSE\n"
+" myhalf3 lightnormal = myhalf3(normalize(LightVector));\n"
+" #endif\n"
+" #define lightcolor LightColor\n"
"#endif // MODE_LIGHTDIRECTION\n"
"#ifdef MODE_LIGHTDIRECTIONMAP_MODELSPACE\n"
-"#define SHADING\n"
+" #define SHADING\n"
" // deluxemap lightmapping using light vectors in modelspace (q3map2 -light -deluxe)\n"
" myhalf3 lightnormal_modelspace = myhalf3(dp_texture2D(Texture_Deluxemap, TexCoordSurfaceLightmap.zw)) * 2.0 + myhalf3(-1.0, -1.0, -1.0);\n"
" myhalf3 lightcolor = myhalf3(dp_texture2D(Texture_Lightmap, TexCoordSurfaceLightmap.zw));\n"
" lightcolor *= 1.0 / max(0.25, lightnormal.z);\n"
"#endif // MODE_LIGHTDIRECTIONMAP_MODELSPACE\n"
"#ifdef MODE_LIGHTDIRECTIONMAP_TANGENTSPACE\n"
-"#define SHADING\n"
+" #define SHADING\n"
" // deluxemap lightmapping using light vectors in tangentspace (hmap2 -light)\n"
" myhalf3 lightnormal = myhalf3(dp_texture2D(Texture_Deluxemap, TexCoordSurfaceLightmap.zw)) * 2.0 + myhalf3(-1.0, -1.0, -1.0);\n"
" myhalf3 lightcolor = myhalf3(dp_texture2D(Texture_Lightmap, TexCoordSurfaceLightmap.zw));\n"
"#endif\n"
-"\n"
-"\n"
-"\n"
-"\n"
+"#if defined(MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR)\n"\r
+" #define SHADING\n"\r
+" // forced deluxemap on lightmapped/vertexlit surfaces\n"\r
+" myhalf3 lightnormal = myhalf3(0.0, 0.0, 1.0);\n"\r
+" #ifdef USELIGHTMAP\n"\r
+" myhalf3 lightcolor = myhalf3(dp_texture2D(Texture_Lightmap, TexCoordSurfaceLightmap.zw));\n"\r
+" #else\n"\r
+" myhalf3 lightcolor = myhalf3(VertexColor.rgb);\n"\r
+" #endif\n"\r
+"#endif\n"
"#ifdef MODE_FAKELIGHT\n"
-"#define SHADING\n"
-"myhalf3 lightnormal = myhalf3(normalize(EyeVectorFogDepth.xyz));\n"
-"myhalf3 lightcolor = myhalf3(1.0);\n"
+" #define SHADING\n"
+" myhalf3 lightnormal = myhalf3(normalize(EyeVectorFogDepth.xyz));\n"
+" myhalf3 lightcolor = myhalf3(1.0);\n"
"#endif // MODE_FAKELIGHT\n"
"\n"
"\n"
"#if defined(USEFOGINSIDE) || defined(USEFOGOUTSIDE) || defined(USEFOGHEIGHTTEXTURE)\n"
"# define USEFOG\n"
"#endif\n"
-"#if defined(MODE_LIGHTMAP) || defined(MODE_LIGHTDIRECTIONMAP_MODELSPACE) || defined(MODE_LIGHTDIRECTIONMAP_TANGENTSPACE)\n"
+"#if defined(MODE_LIGHTMAP) || defined(MODE_LIGHTDIRECTIONMAP_MODELSPACE) || defined(MODE_LIGHTDIRECTIONMAP_TANGENTSPACE) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP)\n"
"#define USELIGHTMAP\n"
"#endif\n"
"#if defined(USESPECULAR) || defined(USEOFFSETMAPPING) || defined(USEREFLECTCUBE) || defined(MODE_FAKELIGHT)\n"
"(\n"
"float4 gl_Vertex : POSITION,\n"
"uniform float4x4 ModelViewProjectionMatrix : register(c8),\n"
-"#if defined(USEVERTEXTEXTUREBLEND) || defined(MODE_VERTEXCOLOR)\n"
+"#if defined(USEVERTEXTEXTUREBLEND) || defined(MODE_VERTEXCOLOR) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR)\n"
"float4 gl_Color : COLOR0,\n"
"#endif\n"
"float4 gl_MultiTexCoord0 : TEXCOORD0,\n"
"\n"
"\n"
"#ifdef MODE_LIGHTDIRECTION\n"
-"#define SHADING\n"
-"#ifdef USEDIFFUSE\n"
-" half3 lightnormal = half3(normalize(LightVector));\n"
-"#endif\n"
-"#define lightcolor LightColor\n"
+" #define SHADING\n"
+" #ifdef USEDIFFUSE\n"
+" half3 lightnormal = half3(normalize(LightVector));\n"
+" #endif\n"
+" #define lightcolor LightColor\n"
"#endif // MODE_LIGHTDIRECTION\n"
"#ifdef MODE_LIGHTDIRECTIONMAP_MODELSPACE\n"
-"#define SHADING\n"
+" #define SHADING\n"
" // deluxemap lightmapping using light vectors in modelspace (q3map2 -light -deluxe)\n"
" half3 lightnormal_modelspace = half3(tex2D(Texture_Deluxemap, TexCoordLightmap).rgb) * 2.0 + half3(-1.0, -1.0, -1.0);\n"
" half3 lightcolor = half3(tex2D(Texture_Lightmap, TexCoordLightmap).rgb);\n"
" lightcolor *= 1.0 / max(0.25, lightnormal.z);\n"
"#endif // MODE_LIGHTDIRECTIONMAP_MODELSPACE\n"
"#ifdef MODE_LIGHTDIRECTIONMAP_TANGENTSPACE\n"
-"#define SHADING\n"
+" #define SHADING\n"
" // deluxemap lightmapping using light vectors in tangentspace (hmap2 -light)\n"
" half3 lightnormal = half3(tex2D(Texture_Deluxemap, TexCoordLightmap).rgb) * 2.0 + half3(-1.0, -1.0, -1.0);\n"
" half3 lightcolor = half3(tex2D(Texture_Lightmap, TexCoordLightmap).rgb);\n"
"#endif\n"
-"\n"
-"\n"
-"\n"
-"\n"
+"#if defined(MODE_LIGHTDIRECTIONMAP_FORCED_LIGHTMAP) || defined(MODE_LIGHTDIRECTIONMAP_FORCED_VERTEXCOLOR)\n"\r
+" #define SHADING\n"\r
+" // forced deluxemap on lightmapped/vertexlit surfaces\n"\r
+" half3 lightnormal = half3(0.0, 0.0, 1.0);\n"\r
+" #ifdef USELIGHTMAP\n"\r
+" half3 lightcolor = half3(tex2D(Texture_Lightmap, TexCoordLightmap).rgb);\n"\r
+" #else\n"\r
+" half3 lightcolor = half3(gl_FrontColor.rgb);\n"\r
+" #endif\n"\r
+"#endif\n"
"#ifdef MODE_FAKELIGHT\n"
-"#define SHADING\n"
-"half3 lightnormal = half3(normalize(EyeVector));\n"
-"half3 lightcolor = half3(1.0,1.0,1.0);\n"
+" #define SHADING\n"
+" half3 lightnormal = half3(normalize(EyeVector));\n"
+" half3 lightcolor = half3(1.0,1.0,1.0);\n"
"#endif // MODE_FAKELIGHT\n"
"\n"
"\n"
if(!strcmp (sfx->name, name))
return sfx;
+ // check for # in the beginning, try lookup by soundindex
+ if (name[0] == '#' && name[1])
+ {
+ int soundindex = atoi(name + 1);
+ if (soundindex > 0 && soundindex < MAX_SOUNDS)
+ if (cl.sound_precache[soundindex]->name[0])
+ return cl.sound_precache[soundindex];
+ }
+
// Add a sfx_t struct for this sound
sfx = (sfx_t *)Mem_Alloc (snd_mempool, sizeof (*sfx));
memset (sfx, 0, sizeof(*sfx));
cvar_t v_color_white_b = {CVAR_SAVE, "v_color_white_b", "1", "desired color of white"};
cvar_t v_hwgamma = {CVAR_SAVE, "v_hwgamma", "0", "enables use of hardware gamma correction ramps if available (note: does not work very well on Windows2000 and above), values are 0 = off, 1 = attempt to use hardware gamma, 2 = use hardware gamma whether it works or not"};
cvar_t v_glslgamma = {CVAR_SAVE, "v_glslgamma", "1", "enables use of GLSL to apply gamma correction ramps if available (note: overrides v_hwgamma)"};
+cvar_t v_glslgamma_2d = {CVAR_SAVE, "v_glslgamma_2d", "0", "applies GLSL gamma to 2d pictures (HUD, fonts)"};
+
cvar_t v_psycho = {0, "v_psycho", "0", "easter egg"};
// brand of graphics chip
Cvar_RegisterVariable(&v_hwgamma);
Cvar_RegisterVariable(&v_glslgamma);
+ Cvar_RegisterVariable(&v_glslgamma_2d);
Cvar_RegisterVariable(&v_psycho);