From 34e2e77f9e1fbc9028835949bac0f8555391de38 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 15 Jan 2023 08:54:54 +0100 Subject: [PATCH] - tab cleanup in shader code. --- wadsrc/static/shaders/glsl/burn.fp | 2 +- wadsrc/static/shaders/glsl/fogboundary.fp | 2 +- wadsrc/static/shaders/glsl/fuzz_smooth.fp | 2 +- wadsrc/static/shaders/glsl/fuzz_standard.fp | 2 +- wadsrc/static/shaders/glsl/fuzz_swirly.fp | 2 +- wadsrc/static/shaders/glsl/main.fp | 56 +++++++++---------- wadsrc/static/shaders/glsl/main.vp | 6 +- wadsrc/static/shaders/glsl/material_normal.fp | 4 +- wadsrc/static/shaders/glsl/material_pbr.fp | 2 +- .../static/shaders/glsl/material_specular.fp | 2 +- 10 files changed, 40 insertions(+), 40 deletions(-) diff --git a/wadsrc/static/shaders/glsl/burn.fp b/wadsrc/static/shaders/glsl/burn.fp index 486789f54c1..ff9c1d699d6 100644 --- a/wadsrc/static/shaders/glsl/burn.fp +++ b/wadsrc/static/shaders/glsl/burn.fp @@ -9,6 +9,6 @@ void main() vec4 t1 = texture(tex, vTexCoord.xy); vec4 t2 = texture(texture2, vec2(vTexCoord.x, 1.0-vTexCoord.y)); - + FragColor = frag * vec4(t1.r, t1.g, t1.b, t2.a); } diff --git a/wadsrc/static/shaders/glsl/fogboundary.fp b/wadsrc/static/shaders/glsl/fogboundary.fp index 9494a9ca9fe..3bfa059c08b 100644 --- a/wadsrc/static/shaders/glsl/fogboundary.fp +++ b/wadsrc/static/shaders/glsl/fogboundary.fp @@ -15,7 +15,7 @@ void main() { float fogdist; float fogfactor; - + // // calculate fog factor // diff --git a/wadsrc/static/shaders/glsl/fuzz_smooth.fp b/wadsrc/static/shaders/glsl/fuzz_smooth.fp index 3c642c399a7..b2af9a2e5bc 100644 --- a/wadsrc/static/shaders/glsl/fuzz_smooth.fp +++ b/wadsrc/static/shaders/glsl/fuzz_smooth.fp @@ -13,6 +13,6 @@ vec4 ProcessTexel() basicColor.a = basicColor.a * test; basicColor.r = basicColor.g = basicColor.b = 0.0; - + return basicColor; } diff --git a/wadsrc/static/shaders/glsl/fuzz_standard.fp b/wadsrc/static/shaders/glsl/fuzz_standard.fp index 3eb3b67e6b4..fd166760a2c 100644 --- a/wadsrc/static/shaders/glsl/fuzz_standard.fp +++ b/wadsrc/static/shaders/glsl/fuzz_standard.fp @@ -17,6 +17,6 @@ vec4 ProcessTexel() basicColor.a = basicColor.a * test; basicColor.r = basicColor.g = basicColor.b = 0.0; - + return basicColor; } diff --git a/wadsrc/static/shaders/glsl/fuzz_swirly.fp b/wadsrc/static/shaders/glsl/fuzz_swirly.fp index 266858999e7..0bb584cd581 100644 --- a/wadsrc/static/shaders/glsl/fuzz_swirly.fp +++ b/wadsrc/static/shaders/glsl/fuzz_swirly.fp @@ -13,6 +13,6 @@ vec4 ProcessTexel() basicColor.a = basicColor.a * test; basicColor.r = basicColor.g = basicColor.b = 0.0; - + return basicColor; } diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index a1ec2bfd1ba..32891e564ee 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -99,27 +99,27 @@ const int Tex_Blend_Alpha = 1; const int Tex_Blend_Screen = 2; const int Tex_Blend_Overlay = 3; const int Tex_Blend_Hardlight = 4; - + vec4 ApplyTextureManipulation(vec4 texel, int blendflags) { // Step 1: desaturate according to the material's desaturation factor. texel = dodesaturate(texel, uTextureModulateColor.a); - + // Step 2: Invert if requested if ((blendflags & 8) != 0) { texel.rgb = vec3(1.0 - texel.r, 1.0 - texel.g, 1.0 - texel.b); } - + // Step 3: Apply additive color texel.rgb += uTextureAddColor.rgb; - + // Step 4: Colorization, including gradient if set. texel.rgb *= uTextureModulateColor.rgb; - + // Before applying the blend the value needs to be clamped to [0..1] range. texel.rgb = clamp(texel.rgb, 0.0, 1.0); - + // Step 5: Apply a blend. This may just be a translucent overlay or one of the blend modes present in current Build engines. if ((blendflags & 7) != 0) { @@ -164,7 +164,7 @@ const int Tex_Blend_Hardlight = 4; vec4 getTexel(vec2 st) { vec4 texel = texture(tex, st); - + // // Apply texture modes // @@ -173,33 +173,33 @@ vec4 getTexel(vec2 st) case 1: // TM_STENCIL texel.rgb = vec3(1.0,1.0,1.0); break; - + case 2: // TM_OPAQUE texel.a = 1.0; break; - + case 3: // TM_INVERSE texel = vec4(1.0-texel.r, 1.0-texel.b, 1.0-texel.g, texel.a); break; - + case 4: // TM_ALPHATEXTURE { float gray = grayscale(texel); texel = vec4(1.0, 1.0, 1.0, gray*texel.a); break; } - + case 5: // TM_CLAMPY if (st.t < 0.0 || st.t > 1.0) { texel.a = 0.0; } break; - + case 6: // TM_OPAQUEINVERSE texel = vec4(1.0-texel.r, 1.0-texel.b, 1.0-texel.g, 1.0); break; - + case 7: //TM_FOGLAYER return texel; @@ -212,7 +212,7 @@ vec4 getTexel(vec2 st) texel.a = 0.0; } } - + // Apply the texture modification colors. int blendflags = int(uTextureAddColor.a); // this alpha is unused otherwise if (blendflags != 0) @@ -319,7 +319,7 @@ float R_DoomLightingEquation(float light) { z = pixelpos.w; } - + if ((uPalLightLevels >> 16) == 5) // gl_lightmode 5: Build software lighting emulation. { // This is a lot more primitive than Doom's lighting... @@ -509,7 +509,7 @@ float sampleShadowmapPCF(vec3 planePoint, float v) float sum = 0.0; float step_count = uShadowmapFilter; - + texelPos -= step_count + 0.5; for (float x = -step_count; x <= step_count; x++) { @@ -653,13 +653,13 @@ void SetMaterialProps(inout Material material, vec2 texCoord) #ifndef NO_LAYERS if ((uTextureMode & TEXF_Brightmap) != 0) material.Bright = desaturate(texture(brighttexture, texCoord.st)); - + if ((uTextureMode & TEXF_Detailmap) != 0) { vec4 Detail = texture(detailtexture, texCoord.st * uDetailParms.xy) * uDetailParms.z; material.Base.rgb *= Detail.rgb; } - + if ((uTextureMode & TEXF_Glowmap) != 0) material.Glow = desaturate(texture(glowtexture, texCoord.st)); #endif @@ -682,7 +682,7 @@ void SetMaterialProps(inout Material material, vec2 texCoord) vec4 getLightColor(Material material, float fogdist, float fogfactor) { vec4 color = vColor; - + if (uLightLevel >= 0.0) { float newlightlevel = 1.0 - R_DoomLightingEquation(uLightLevel); @@ -695,13 +695,13 @@ vec4 getLightColor(Material material, float fogdist, float fogfactor) { color.rgb *= uLightFactor - (fogdist / uLightDist) * (uLightFactor - 1.0); } - + // // apply light diminishing through fog equation // color.rgb = mix(vec3(0.0, 0.0, 0.0), color.rgb, fogfactor); } - + // // handle glowing walls // @@ -727,7 +727,7 @@ vec4 getLightColor(Material material, float fogdist, float fogfactor) // color.rgb = min(color.rgb + material.Bright.rgb, 1.0); #endif - + // // apply other light manipulation by custom shaders, default is a NOP. // @@ -768,7 +768,7 @@ vec3 AmbientOcclusionColor() { float fogdist; float fogfactor; - + // // calculate fog factor // @@ -781,7 +781,7 @@ vec3 AmbientOcclusionColor() fogdist = max(16.0, distance(pixelpos.xyz, uCameraPos.xyz)); } fogfactor = exp2 (uFogDensity * fogdist); - + return mix(uFogColor.rgb, vec3(0.0), fogfactor); } @@ -799,7 +799,7 @@ void main() #ifndef LEGACY_USER_SHADER Material material; - + material.Base = vec4(0.0); material.Bright = vec4(0.0); material.Glow = vec4(0.0); @@ -815,7 +815,7 @@ void main() Material material = ProcessMaterial(); #endif vec4 frag = material.Base; - + #ifndef NO_ALPHATEST if (frag.a <= uAlphaThreshold) discard; #endif @@ -824,7 +824,7 @@ void main() { float fogdist = 0.0; float fogfactor = 0.0; - + // // calculate fog factor // @@ -840,7 +840,7 @@ void main() } fogfactor = exp2 (uFogDensity * fogdist); } - + if ((uTextureMode & 0xffff) != 7) { frag = getLightColor(material, fogdist, fogfactor); diff --git a/wadsrc/static/shaders/glsl/main.vp b/wadsrc/static/shaders/glsl/main.vp index dd0558c594d..49da024ac6a 100644 --- a/wadsrc/static/shaders/glsl/main.vp +++ b/wadsrc/static/shaders/glsl/main.vp @@ -78,7 +78,7 @@ void main() glowdist.y = worldcoord.y - bottomatpoint; glowdist.z = clamp(glowdist.x / (topatpoint - bottomatpoint), 0.0, 1.0); } - + if (uObjectColor2.a != 0) { float topatpoint = (uGradientTopPlane.w + uGradientTopPlane.x * worldcoord.x + uGradientTopPlane.y * worldcoord.z) * uGradientTopPlane.z; @@ -97,7 +97,7 @@ void main() vWorldNormal = NormalModelMatrix * vec4(normalize(bones.Normal), 1.0); vEyeNormal = NormalViewMatrix * vec4(normalize(vWorldNormal.xyz), 1.0); #endif - + #ifdef SPHEREMAP vec3 u = normalize(eyeCoordPos.xyz); vec4 n = normalize(NormalViewMatrix * vec4(parmTexCoord.x, 0.0, parmTexCoord.y, 0.0)); @@ -108,7 +108,7 @@ void main() #else vTexCoord = TextureMatrix * vec4(parmTexCoord, 0.0, 1.0); #endif - + gl_Position = ProjectionMatrix * eyeCoordPos; #ifdef VULKAN_COORDINATE_SYSTEM diff --git a/wadsrc/static/shaders/glsl/material_normal.fp b/wadsrc/static/shaders/glsl/material_normal.fp index 01d422645b1..b9d25852c04 100644 --- a/wadsrc/static/shaders/glsl/material_normal.fp +++ b/wadsrc/static/shaders/glsl/material_normal.fp @@ -13,7 +13,7 @@ vec3 lightContribution(int i, vec3 normal) vec3 lightdir = normalize(lightpos.xyz - pixelpos.xyz); float dotprod = dot(normal, lightdir); if (dotprod < -0.0001) return vec3(0.0); // light hits from the backside. This can happen with full sector light lists and must be rejected for all cases. Note that this can cause precision issues. - + float attenuation = clamp((lightpos.w - lightdistance) / lightpos.w, 0.0, 1.0); if (lightspot1.w == 1.0) @@ -81,7 +81,7 @@ vec3 ProcessMaterialLight(Material material, vec3 color) if (lightRange.w > lightRange.z) { vec4 addlight = vec4(0.0,0.0,0.0,0.0); - + // additive lights for(int i=lightRange.z; i