Merge branch 'shaders_formatting' into 'master'

Improve shaders formatting

See merge request OpenMW/openmw!2950
7344-support-launching-the-example-suite
psi29a 2 years ago
commit 88969d5725

@ -27,5 +27,4 @@ void main()
vec3 colorOut = useNormalAsColor? gl_Normal.xyz : color; vec3 colorOut = useNormalAsColor? gl_Normal.xyz : color;
passColor = vec4(colorOut, 1.); passColor = vec4(colorOut, 1.);
} }
} }

@ -27,7 +27,6 @@ void main()
texture2D(imageIn, uv + vec2(0.0, -oneAndHalfOffset)).r texture2D(imageIn, uv + vec2(0.0, -oneAndHalfOffset)).r
); );
vec4 color = texture2D(imageIn, uv); vec4 color = texture2D(imageIn, uv);
gl_FragColor = applySprings(color, n, n2); gl_FragColor = applySprings(color, n, n2);

@ -35,7 +35,6 @@ float unshadowedLightRatio(float distance)
{ {
shadowing = min(shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r, shadowing); shadowing = min(shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r, shadowing);
doneShadows = all(lessThan(shadowXYZ, vec3(0.95, 0.95, 1.0))) && all(greaterThan(shadowXYZ, vec3(0.05, 0.05, 0.0))); doneShadows = all(lessThan(shadowXYZ, vec3(0.95, 0.95, 1.0))) && all(greaterThan(shadowXYZ, vec3(0.05, 0.05, 0.0)));
#if @perspectiveShadowMaps #if @perspectiveShadowMaps
doneShadows = doneShadows && all(lessThan(shadowRegionXYZ, vec3(1.0, 1.0, 1.0))) && all(greaterThan(shadowRegionXYZ.xy, vec2(-1.0, -1.0))); doneShadows = doneShadows && all(lessThan(shadowRegionXYZ, vec3(1.0, 1.0, 1.0))) && all(greaterThan(shadowRegionXYZ.xy, vec2(-1.0, -1.0)));

@ -79,7 +79,8 @@ void main()
paintSun(color); paintSun(color);
else if (pass == PASS_SUNGLARE) else if (pass == PASS_SUNGLARE)
paintSunglare(color); paintSunglare(color);
else if (pass == PASS_SUNFLASH_QUERY) { else if (pass == PASS_SUNFLASH_QUERY)
{
processSunflashQuery(); processSunflashQuery();
return; return;
} }

@ -35,7 +35,8 @@ float calcSoftParticleFade(
const float nearMult = 300.0; const float nearMult = 300.0;
float viewBias = 1.0; float viewBias = 1.0;
if (fade) { if (fade)
{
float VdotN = dot(viewDir, viewNormal); float VdotN = dot(viewDir, viewNormal);
viewBias = abs(VdotN) * quickstep(euclidianDepth / nearMult) * (1.0 - pow(1.0 + VdotN, 1.3)); viewBias = abs(VdotN) * quickstep(euclidianDepth / nearMult) * (1.0 - pow(1.0 + VdotN, 1.3));
} }

@ -1,19 +1,21 @@
#ifndef LIB_WATER_FRESNEL #ifndef LIB_WATER_FRESNEL
#define LIB_WATER_FRESNEL #define LIB_WATER_FRESNEL
float fresnel_dielectric(vec3 Incoming, vec3 Normal, float eta) float fresnel_dielectric(vec3 incoming, vec3 normal, float eta)
{ {
float c = abs(dot(Incoming, Normal)); float c = abs(dot(incoming, normal));
float g = eta * eta - 1.0 + c * c; float g = eta * eta - 1.0 + c * c;
float result; float result;
if (g > 0.0) { if (g > 0.0)
{
g = sqrt(g); g = sqrt(g);
float A =(g - c)/(g + c); float A =(g - c)/(g + c);
float B =(c *(g + c)- 1.0)/(c *(g - c)+ 1.0); float B =(c *(g + c)- 1.0)/(c *(g - c)+ 1.0);
result = 0.5 * A * A *(1.0 + B * B); result = 0.5 * A * A *(1.0 + B * B);
} }
else { else
{
result = 1.0; /* TIR (no refracted component) */ result = 1.0; /* TIR (no refracted component) */
} }

Loading…
Cancel
Save