From 07e32c0fa6be9fa7129c1002b77deb469803d248 Mon Sep 17 00:00:00 2001 From: "glassmancody.info" Date: Mon, 25 Oct 2021 10:23:16 -0700 Subject: [PATCH] remove object shader path --- apps/openmw/mwworld/weather.cpp | 1 - components/shader/shadervisitor.cpp | 6 +++++- files/shaders/lighting.glsl | 10 ---------- files/shaders/objects_fragment.glsl | 8 ++------ files/shaders/objects_vertex.glsl | 8 ++------ files/shaders/sky_fragment.glsl | 2 +- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 9055b95ee1..965c690238 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -1273,4 +1273,3 @@ namespace MWWorld } } - diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index dcd4874e90..9877ab1863 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -518,7 +518,11 @@ namespace Shader bool simpleLighting = false; node.getUserValue("simpleLighting", simpleLighting); - defineMap["simpleLighting"] = simpleLighting ? "1" : "0"; + if (simpleLighting) + { + defineMap["forcePPL"] = "1"; + defineMap["endLight"] = "0"; + } if (writableStateSet->getMode(GL_ALPHA_TEST) != osg::StateAttribute::INHERIT && !previousAddedState->hasMode(GL_ALPHA_TEST)) removedState->setMode(GL_ALPHA_TEST, writableStateSet->getMode(GL_ALPHA_TEST)); diff --git a/files/shaders/lighting.glsl b/files/shaders/lighting.glsl index dc9c297a2f..177017f822 100644 --- a/files/shaders/lighting.glsl +++ b/files/shaders/lighting.glsl @@ -87,16 +87,6 @@ void doLighting(vec3 viewPos, vec3 viewNormal, out vec3 diffuseLight, out vec3 a } } -// Simplest lighting which only takes into account sun and ambient. Currently used for our weather particle systems. -void doSimpleLighting(vec3 viewPos, vec3 viewNormal, out vec3 diffuseLight, out vec3 ambientLight) -{ - vec3 ambientOut, diffuseOut; - - perLightSun(diffuseOut, viewPos, viewNormal); - ambientLight = gl_LightModel.ambient.xyz; - diffuseLight = diffuseOut; -} - vec3 getSpecular(vec3 viewNormal, vec3 viewDirection, float shininess, vec3 matSpec) { vec3 lightDir = normalize(lcalcPosition(0)); diff --git a/files/shaders/objects_fragment.glsl b/files/shaders/objects_fragment.glsl index 26107abb10..6f6cede4e4 100644 --- a/files/shaders/objects_fragment.glsl +++ b/files/shaders/objects_fragment.glsl @@ -63,7 +63,7 @@ uniform bool simpleWater; varying float euclideanDepth; varying float linearDepth; -#define PER_PIXEL_LIGHTING ((@normalMap || @forcePPL) && !@simpleLighting) +#define PER_PIXEL_LIGHTING (@normalMap || @forcePPL) #if !PER_PIXEL_LIGHTING centroid varying vec3 passLighting; @@ -170,9 +170,6 @@ void main() #endif float shadowing = unshadowedLightRatio(linearDepth); -#if @simpleLighting - gl_FragData[0].xyz *= passLighting; -#else vec3 lighting; #if !PER_PIXEL_LIGHTING lighting = passLighting + shadowDiffuseLighting * shadowing; @@ -183,8 +180,8 @@ void main() lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission; clampLightingResult(lighting); #endif + gl_FragData[0].xyz *= lighting; -#endif #if @envMap && !@preLightEnv gl_FragData[0].xyz += texture2D(envMap, envTexCoordGen).xyz * envMapColor.xyz * envLuma; @@ -210,7 +207,6 @@ void main() #endif gl_FragData[0].xyz += getSpecular(normalize(viewNormal), normalize(passViewPos.xyz), shininess, matSpec) * shadowing; } - #if @radialFog float depth; // For the less detailed mesh of simple water we need to recalculate depth on per-pixel basis diff --git a/files/shaders/objects_vertex.glsl b/files/shaders/objects_vertex.glsl index 5f208ffc25..969fe5903e 100644 --- a/files/shaders/objects_vertex.glsl +++ b/files/shaders/objects_vertex.glsl @@ -50,7 +50,7 @@ varying vec2 specularMapUV; varying float euclideanDepth; varying float linearDepth; -#define PER_PIXEL_LIGHTING ((@normalMap || @forcePPL) && !@simpleLighting) +#define PER_PIXEL_LIGHTING (@normalMap || @forcePPL) #if !PER_PIXEL_LIGHTING centroid varying vec3 passLighting; @@ -126,11 +126,7 @@ void main(void) #if !PER_PIXEL_LIGHTING vec3 diffuseLight, ambientLight; -#if @simpleLighting - doSimpleLighting(passViewPos, viewNormal, diffuseLight, ambientLight); -#else - doLighting(passViewPos, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting); -#endif + doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting); vec3 emission = getEmissionColor().xyz * emissiveMult; passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission; clampLightingResult(passLighting); diff --git a/files/shaders/sky_fragment.glsl b/files/shaders/sky_fragment.glsl index 1ef62ab2cf..cfa3650c02 100644 --- a/files/shaders/sky_fragment.glsl +++ b/files/shaders/sky_fragment.glsl @@ -31,7 +31,7 @@ void paintClouds(inout vec4 color) color.xyz = clamp(color.xyz * gl_FrontMaterial.emission.xyz, 0.0, 1.0); // ease transition between clear color and atmosphere/clouds - color = mix(vec4(gl_Fog.color.xyz, color.a), color, passColor.a * passColor.a); + color = mix(vec4(gl_Fog.color.xyz, color.a), color, passColor.a); } void paintMoon(inout vec4 color)