mirror of
https://github.com/ioquake/ioq3.git
synced 2025-04-20 23:40:47 +00:00
Merge remote-tracking branch 'upstream/main' into vs2019
This commit is contained in:
commit
0b45535613
6 changed files with 24 additions and 6 deletions
|
@ -89,6 +89,9 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
|
|||
// current size of search window
|
||||
float size = 1.0 / float(linearSearchSteps);
|
||||
|
||||
// adjust position if offset above surface
|
||||
dp -= ds * r_parallaxMapOffset;
|
||||
|
||||
// current depth position
|
||||
float depth = 0.0;
|
||||
|
||||
|
@ -141,7 +144,7 @@ float RayIntersectDisplaceMap(vec2 dp, vec2 ds, sampler2D normalMap)
|
|||
}
|
||||
#endif
|
||||
|
||||
return bestDepth;
|
||||
return bestDepth - r_parallaxMapOffset;
|
||||
}
|
||||
|
||||
float LightRay(vec2 dp, vec2 ds, sampler2D normalMap)
|
||||
|
@ -201,7 +204,7 @@ vec3 CalcSpecular(vec3 specular, float NH, float EH, float roughness)
|
|||
float rr = roughness*roughness;
|
||||
float rrrr = rr*rr;
|
||||
float d = (NH * NH) * (rrrr - 1.0) + 1.0;
|
||||
float v = (EH * EH) * (roughness + 0.5);
|
||||
float v = (EH * EH) * (roughness + 0.5) + EPSILON;
|
||||
return specular * (rrrr / (4.0 * d * d * v));
|
||||
}
|
||||
|
||||
|
@ -261,7 +264,8 @@ void main()
|
|||
float NL, NH, NE, EH, attenuation;
|
||||
|
||||
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
|
||||
mat3 tangentToWorld = mat3(var_Tangent.xyz, var_Bitangent.xyz, var_Normal.xyz);
|
||||
vec3 surfNormal = (!gl_FrontFacing ? var_Normal : -var_Normal).xyz;
|
||||
mat3 tangentToWorld = mat3(var_Tangent.xyz, var_Bitangent.xyz, surfNormal);
|
||||
viewDir = vec3(var_Normal.w, var_Tangent.w, var_Bitangent.w);
|
||||
E = normalize(viewDir);
|
||||
#endif
|
||||
|
@ -332,7 +336,7 @@ void main()
|
|||
N.z = sqrt(clamp((0.25 - N.x * N.x) - N.y * N.y, 0.0, 1.0));
|
||||
N = tangentToWorld * N;
|
||||
#else
|
||||
N = var_Normal.xyz;
|
||||
N = surfNormal;
|
||||
#endif
|
||||
|
||||
N = normalize(N);
|
||||
|
@ -358,7 +362,7 @@ void main()
|
|||
|
||||
#if !defined(USE_LIGHT_VECTOR)
|
||||
ambientColor = lightColor;
|
||||
float surfNL = clamp(dot(var_Normal.xyz, L), 0.0, 1.0);
|
||||
float surfNL = clamp(dot(surfNormal, L), 0.0, 1.0);
|
||||
|
||||
// reserve 25% ambient to avoid black areas on normalmaps
|
||||
lightColor *= 0.75;
|
||||
|
|
|
@ -1125,6 +1125,8 @@ void GLSL_InitGPUShaders(void)
|
|||
|
||||
if (r_parallaxMapShadows->integer)
|
||||
Q_strcat(extradefines, 1024, "#define USE_PARALLAXMAP_SHADOWS\n");
|
||||
|
||||
Q_strcat(extradefines, 1024, va("#define r_parallaxMapOffset %f\n", r_parallaxMapOffset->value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ cvar_t *r_normalMapping;
|
|||
cvar_t *r_specularMapping;
|
||||
cvar_t *r_deluxeMapping;
|
||||
cvar_t *r_parallaxMapping;
|
||||
cvar_t *r_parallaxMapOffset;
|
||||
cvar_t *r_parallaxMapShadows;
|
||||
cvar_t *r_cubeMapping;
|
||||
cvar_t *r_cubemapSize;
|
||||
|
@ -1243,6 +1244,7 @@ void R_Register( void )
|
|||
r_specularMapping = ri.Cvar_Get( "r_specularMapping", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_deluxeMapping = ri.Cvar_Get( "r_deluxeMapping", "1", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_parallaxMapping = ri.Cvar_Get( "r_parallaxMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_parallaxMapOffset = ri.Cvar_Get( "r_parallaxMapOffset", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_parallaxMapShadows = ri.Cvar_Get( "r_parallaxMapShadows", "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 );
|
||||
|
|
|
@ -1778,6 +1778,7 @@ extern cvar_t *r_normalMapping;
|
|||
extern cvar_t *r_specularMapping;
|
||||
extern cvar_t *r_deluxeMapping;
|
||||
extern cvar_t *r_parallaxMapping;
|
||||
extern cvar_t *r_parallaxMapOffset;
|
||||
extern cvar_t *r_parallaxMapShadows;
|
||||
extern cvar_t *r_cubeMapping;
|
||||
extern cvar_t *r_cubemapSize;
|
||||
|
|
|
@ -33,6 +33,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include "../client/client.h"
|
||||
#include "../sys/sys_local.h"
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 17)
|
||||
#define KMOD_SCROLL KMOD_RESERVED
|
||||
#endif
|
||||
|
||||
static cvar_t *in_keyboardDebug = NULL;
|
||||
|
||||
static SDL_GameController *gamepad = NULL;
|
||||
|
@ -84,7 +88,7 @@ static void IN_PrintKey( const SDL_Keysym *keysym, keyNum_t key, qboolean down )
|
|||
if( keysym->mod & KMOD_NUM ) Com_Printf( " KMOD_NUM" );
|
||||
if( keysym->mod & KMOD_CAPS ) Com_Printf( " KMOD_CAPS" );
|
||||
if( keysym->mod & KMOD_MODE ) Com_Printf( " KMOD_MODE" );
|
||||
if( keysym->mod & KMOD_RESERVED ) Com_Printf( " KMOD_RESERVED" );
|
||||
if( keysym->mod & KMOD_SCROLL ) Com_Printf( " KMOD_SCROLL" );
|
||||
|
||||
Com_Printf( " Q:0x%02x(%s)\n", key, Key_KeynumToString( key ) );
|
||||
}
|
||||
|
|
|
@ -184,6 +184,11 @@ Cvars for advanced material usage:
|
|||
1 - Use parallax occlusion mapping.
|
||||
2 - Use relief mapping. (slower)
|
||||
|
||||
* `r_parallaxMapOffset` - Set the parallax height offset.
|
||||
0 - Values map to -255 - 0. (default)
|
||||
0.5 - Values map to -127 - 127.
|
||||
1.0 - Values map to 0 - 255.
|
||||
|
||||
* `r_parallaxMapShadows` - Enable self-shadowing on parallax map
|
||||
supported materials.
|
||||
0 - No. (default)
|
||||
|
|
Loading…
Reference in a new issue