diff --git a/wadsrc/static/shaders/scene/lightmode.glsl b/wadsrc/static/shaders/scene/lightmode.glsl index c5b5ad129..baf935463 100644 --- a/wadsrc/static/shaders/scene/lightmode.glsl +++ b/wadsrc/static/shaders/scene/lightmode.glsl @@ -6,14 +6,6 @@ #include "shaders/scene/material.glsl" #include "shaders/scene/fogball.glsl" -#ifndef SIMPLE3D -vec3 swLightContribution(DynLightInfo light, vec3 normal); -float distanceAttenuation(float dist, float radius, float strength, float linearity); -float spotLightAttenuation(vec3 lightpos, vec3 spotdir, float lightCosInnerAngle, float lightCosOuterAngle); -float traceSun(vec3 SunDir); -float shadowAttenuation(vec3 lightpos, int shadowIndex, float softShadowRadius, int flags); -#endif - vec3 PickGamePaletteColor(vec3 color) { ivec3 c = ivec3(clamp(color.rgb, vec3(0.0), vec3(1.0)) * 63.0 + 0.5); @@ -65,36 +57,7 @@ vec4 getLightColor(Material material) dynlight.rgb += texture(LightMap, vLightmap).rgb; } - vec3 normal = material.Normal; - - #ifndef SIMPLE3D - #ifndef UBERSHADER - #ifdef SHADE_VERTEX - dynlight.rgb += vLightColor; - #else - if (uLightIndex >= 0) - { - ivec4 lightRange = getLightRange(); - - if (lightRange.z > lightRange.x) - { - // modulated lights - for(int i=lightRange.x; i 0.0) // Skip shadow map test if possible - { - if((light.flags & (LIGHTINFO_SUN | LIGHTINFO_TRACE)) == (LIGHTINFO_SUN | LIGHTINFO_TRACE)) - { - attenuation *= traceSun(lightdir); - } - else if((light.flags & (LIGHTINFO_SHADOWMAPPED | LIGHTINFO_SUN)) == LIGHTINFO_SHADOWMAPPED) - { - attenuation *= shadowAttenuation(light.pos.xyz, light.shadowIndex, light.softShadowRadius, light.flags); - } - - return light.color.rgb * attenuation; - } - else - { - return vec3(0.0); - } - } -#endif diff --git a/wadsrc/static/shaders/scene/lightmodel_nolights.glsl b/wadsrc/static/shaders/scene/lightmodel_nolights.glsl index b71404423..537b316e6 100644 --- a/wadsrc/static/shaders/scene/lightmodel_nolights.glsl +++ b/wadsrc/static/shaders/scene/lightmodel_nolights.glsl @@ -3,3 +3,8 @@ vec3 ProcessMaterialLight(Material material, vec3 color) { return material.Base.rgb * clamp(color + desaturate(uDynLightColor).rgb, 0.0, 1.4); } + +vec3 ProcessSWLight(Material material) +{ + return vec3(0.0); +} diff --git a/wadsrc/static/shaders/scene/lightmodel_normal.glsl b/wadsrc/static/shaders/scene/lightmodel_normal.glsl index 1c7be4084..3e6666a7a 100644 --- a/wadsrc/static/shaders/scene/lightmodel_normal.glsl +++ b/wadsrc/static/shaders/scene/lightmodel_normal.glsl @@ -123,9 +123,50 @@ return frag; } + + vec3 ProcessSWLight(Material material) + { + vec3 normal = material.Normal; + vec3 dynlight = vec3(0.0); + + #ifndef UBERSHADER + #ifdef SHADE_VERTEX + dynlight.rgb += vLightColor; + #else + if (uLightIndex >= 0) + { + ivec4 lightRange = getLightRange(); + + if (lightRange.z > lightRange.x) + { + // modulated lights + for(int i=lightRange.x; i