mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
OpenGL2: Readd r_deluxeSpecular.
https://github.com/ioquake/ioq3/issues/369
This commit is contained in:
parent
60a3112e45
commit
c0c45d325d
4 changed files with 16 additions and 0 deletions
|
@ -309,6 +309,9 @@ void main()
|
||||||
|
|
||||||
NL = clamp(dot(N, L), 0.0, 1.0);
|
NL = clamp(dot(N, L), 0.0, 1.0);
|
||||||
NE = clamp(dot(N, E), 0.0, 1.0);
|
NE = clamp(dot(N, E), 0.0, 1.0);
|
||||||
|
H = normalize(L + E);
|
||||||
|
EH = clamp(dot(E, H), 0.0, 1.0);
|
||||||
|
NH = clamp(dot(N, H), 0.0, 1.0);
|
||||||
|
|
||||||
#if defined(USE_SPECULARMAP)
|
#if defined(USE_SPECULARMAP)
|
||||||
vec4 specular = texture2D(u_SpecularMap, texCoords);
|
vec4 specular = texture2D(u_SpecularMap, texCoords);
|
||||||
|
@ -351,6 +354,14 @@ void main()
|
||||||
|
|
||||||
reflectance = CalcDiffuse(diffuse.rgb, NH, EH, roughness);
|
reflectance = CalcDiffuse(diffuse.rgb, NH, EH, roughness);
|
||||||
|
|
||||||
|
#if defined(r_deluxeSpecular)
|
||||||
|
#if defined(USE_LIGHT_VECTOR)
|
||||||
|
reflectance += CalcSpecular(specular.rgb, NH, EH, roughness) * r_deluxeSpecular;
|
||||||
|
#else
|
||||||
|
reflectance += CalcSpecular(specular.rgb, NH, EH, pow(roughness, r_deluxeSpecular));
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
gl_FragColor.rgb = lightColor * reflectance * (attenuation * NL);
|
gl_FragColor.rgb = lightColor * reflectance * (attenuation * NL);
|
||||||
gl_FragColor.rgb += ambientColor * diffuse.rgb;
|
gl_FragColor.rgb += ambientColor * diffuse.rgb;
|
||||||
|
|
||||||
|
|
|
@ -1067,6 +1067,8 @@ void GLSL_InitGPUShaders(void)
|
||||||
|
|
||||||
if (r_cubeMapping->integer)
|
if (r_cubeMapping->integer)
|
||||||
Q_strcat(extradefines, 1024, "#define USE_CUBEMAP\n");
|
Q_strcat(extradefines, 1024, "#define USE_CUBEMAP\n");
|
||||||
|
else if (r_deluxeSpecular->value > 0.000001f)
|
||||||
|
Q_strcat(extradefines, 1024, va("#define r_deluxeSpecular %f\n", r_deluxeSpecular->value));
|
||||||
|
|
||||||
switch (r_glossType->integer)
|
switch (r_glossType->integer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,6 +133,7 @@ cvar_t *r_deluxeMapping;
|
||||||
cvar_t *r_parallaxMapping;
|
cvar_t *r_parallaxMapping;
|
||||||
cvar_t *r_cubeMapping;
|
cvar_t *r_cubeMapping;
|
||||||
cvar_t *r_cubemapSize;
|
cvar_t *r_cubemapSize;
|
||||||
|
cvar_t *r_deluxeSpecular;
|
||||||
cvar_t *r_pbr;
|
cvar_t *r_pbr;
|
||||||
cvar_t *r_baseNormalX;
|
cvar_t *r_baseNormalX;
|
||||||
cvar_t *r_baseNormalY;
|
cvar_t *r_baseNormalY;
|
||||||
|
@ -1229,6 +1230,7 @@ void R_Register( void )
|
||||||
r_parallaxMapping = ri.Cvar_Get( "r_parallaxMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
r_parallaxMapping = ri.Cvar_Get( "r_parallaxMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||||
r_cubeMapping = ri.Cvar_Get( "r_cubeMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
r_cubeMapping = ri.Cvar_Get( "r_cubeMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||||
r_cubemapSize = ri.Cvar_Get( "r_cubemapSize", "128", CVAR_ARCHIVE | CVAR_LATCH );
|
r_cubemapSize = ri.Cvar_Get( "r_cubemapSize", "128", CVAR_ARCHIVE | CVAR_LATCH );
|
||||||
|
r_deluxeSpecular = ri.Cvar_Get("r_deluxeSpecular", "0.3", CVAR_ARCHIVE | CVAR_LATCH);
|
||||||
r_pbr = ri.Cvar_Get("r_pbr", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
r_pbr = ri.Cvar_Get("r_pbr", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||||
r_baseNormalX = ri.Cvar_Get( "r_baseNormalX", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
r_baseNormalX = ri.Cvar_Get( "r_baseNormalX", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||||
r_baseNormalY = ri.Cvar_Get( "r_baseNormalY", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
r_baseNormalY = ri.Cvar_Get( "r_baseNormalY", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||||
|
|
|
@ -1718,6 +1718,7 @@ extern cvar_t *r_deluxeMapping;
|
||||||
extern cvar_t *r_parallaxMapping;
|
extern cvar_t *r_parallaxMapping;
|
||||||
extern cvar_t *r_cubeMapping;
|
extern cvar_t *r_cubeMapping;
|
||||||
extern cvar_t *r_cubemapSize;
|
extern cvar_t *r_cubemapSize;
|
||||||
|
extern cvar_t *r_deluxeSpecular;
|
||||||
extern cvar_t *r_pbr;
|
extern cvar_t *r_pbr;
|
||||||
extern cvar_t *r_baseNormalX;
|
extern cvar_t *r_baseNormalX;
|
||||||
extern cvar_t *r_baseNormalY;
|
extern cvar_t *r_baseNormalY;
|
||||||
|
|
Loading…
Reference in a new issue