remove object shader path

pull/3204/head
glassmancody.info 3 years ago
parent 9cbbd2fff5
commit 07e32c0fa6

@ -1273,4 +1273,3 @@ namespace MWWorld
} }
} }

@ -518,7 +518,11 @@ namespace Shader
bool simpleLighting = false; bool simpleLighting = false;
node.getUserValue("simpleLighting", simpleLighting); 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)) if (writableStateSet->getMode(GL_ALPHA_TEST) != osg::StateAttribute::INHERIT && !previousAddedState->hasMode(GL_ALPHA_TEST))
removedState->setMode(GL_ALPHA_TEST, writableStateSet->getMode(GL_ALPHA_TEST)); removedState->setMode(GL_ALPHA_TEST, writableStateSet->getMode(GL_ALPHA_TEST));

@ -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 getSpecular(vec3 viewNormal, vec3 viewDirection, float shininess, vec3 matSpec)
{ {
vec3 lightDir = normalize(lcalcPosition(0)); vec3 lightDir = normalize(lcalcPosition(0));

@ -63,7 +63,7 @@ uniform bool simpleWater;
varying float euclideanDepth; varying float euclideanDepth;
varying float linearDepth; varying float linearDepth;
#define PER_PIXEL_LIGHTING ((@normalMap || @forcePPL) && !@simpleLighting) #define PER_PIXEL_LIGHTING (@normalMap || @forcePPL)
#if !PER_PIXEL_LIGHTING #if !PER_PIXEL_LIGHTING
centroid varying vec3 passLighting; centroid varying vec3 passLighting;
@ -170,9 +170,6 @@ void main()
#endif #endif
float shadowing = unshadowedLightRatio(linearDepth); float shadowing = unshadowedLightRatio(linearDepth);
#if @simpleLighting
gl_FragData[0].xyz *= passLighting;
#else
vec3 lighting; vec3 lighting;
#if !PER_PIXEL_LIGHTING #if !PER_PIXEL_LIGHTING
lighting = passLighting + shadowDiffuseLighting * shadowing; lighting = passLighting + shadowDiffuseLighting * shadowing;
@ -183,8 +180,8 @@ void main()
lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission; lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
clampLightingResult(lighting); clampLightingResult(lighting);
#endif #endif
gl_FragData[0].xyz *= lighting; gl_FragData[0].xyz *= lighting;
#endif
#if @envMap && !@preLightEnv #if @envMap && !@preLightEnv
gl_FragData[0].xyz += texture2D(envMap, envTexCoordGen).xyz * envMapColor.xyz * envLuma; gl_FragData[0].xyz += texture2D(envMap, envTexCoordGen).xyz * envMapColor.xyz * envLuma;
@ -210,7 +207,6 @@ void main()
#endif #endif
gl_FragData[0].xyz += getSpecular(normalize(viewNormal), normalize(passViewPos.xyz), shininess, matSpec) * shadowing; gl_FragData[0].xyz += getSpecular(normalize(viewNormal), normalize(passViewPos.xyz), shininess, matSpec) * shadowing;
} }
#if @radialFog #if @radialFog
float depth; float depth;
// For the less detailed mesh of simple water we need to recalculate depth on per-pixel basis // For the less detailed mesh of simple water we need to recalculate depth on per-pixel basis

@ -50,7 +50,7 @@ varying vec2 specularMapUV;
varying float euclideanDepth; varying float euclideanDepth;
varying float linearDepth; varying float linearDepth;
#define PER_PIXEL_LIGHTING ((@normalMap || @forcePPL) && !@simpleLighting) #define PER_PIXEL_LIGHTING (@normalMap || @forcePPL)
#if !PER_PIXEL_LIGHTING #if !PER_PIXEL_LIGHTING
centroid varying vec3 passLighting; centroid varying vec3 passLighting;
@ -126,11 +126,7 @@ void main(void)
#if !PER_PIXEL_LIGHTING #if !PER_PIXEL_LIGHTING
vec3 diffuseLight, ambientLight; vec3 diffuseLight, ambientLight;
#if @simpleLighting doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
doSimpleLighting(passViewPos, viewNormal, diffuseLight, ambientLight);
#else
doLighting(passViewPos, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
#endif
vec3 emission = getEmissionColor().xyz * emissiveMult; vec3 emission = getEmissionColor().xyz * emissiveMult;
passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission; passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
clampLightingResult(passLighting); clampLightingResult(passLighting);

@ -31,7 +31,7 @@ void paintClouds(inout vec4 color)
color.xyz = clamp(color.xyz * gl_FrontMaterial.emission.xyz, 0.0, 1.0); color.xyz = clamp(color.xyz * gl_FrontMaterial.emission.xyz, 0.0, 1.0);
// ease transition between clear color and atmosphere/clouds // 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) void paintMoon(inout vec4 color)

Loading…
Cancel
Save