mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-24 15:02:27 +00:00
Add specular strength shader parameter
This commit is contained in:
parent
923756b407
commit
9880c43c86
@ -359,6 +359,7 @@ namespace MWRender
|
|||||||
stateset->setAttribute(m);
|
stateset->setAttribute(m);
|
||||||
stateset->addUniform(new osg::Uniform("colorMode", 0));
|
stateset->addUniform(new osg::Uniform("colorMode", 0));
|
||||||
stateset->addUniform(new osg::Uniform("emissiveMult", 1.f));
|
stateset->addUniform(new osg::Uniform("emissiveMult", 1.f));
|
||||||
|
stateset->addUniform(new osg::Uniform("specStrength", 1.f));
|
||||||
node.setStateSet(stateset);
|
node.setStateSet(stateset);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -500,6 +500,7 @@ namespace MWRender
|
|||||||
defaultMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
defaultMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
||||||
sceneRoot->getOrCreateStateSet()->setAttribute(defaultMat);
|
sceneRoot->getOrCreateStateSet()->setAttribute(defaultMat);
|
||||||
sceneRoot->getOrCreateStateSet()->addUniform(new osg::Uniform("emissiveMult", 1.f));
|
sceneRoot->getOrCreateStateSet()->addUniform(new osg::Uniform("emissiveMult", 1.f));
|
||||||
|
sceneRoot->getOrCreateStateSet()->addUniform(new osg::Uniform("specStrength", 1.f));
|
||||||
|
|
||||||
mFog.reset(new FogManager());
|
mFog.reset(new FogManager());
|
||||||
|
|
||||||
|
@ -1932,6 +1932,7 @@ namespace NifOsg
|
|||||||
|
|
||||||
int lightmode = 1;
|
int lightmode = 1;
|
||||||
float emissiveMult = 1.f;
|
float emissiveMult = 1.f;
|
||||||
|
float specStrength = 1.f;
|
||||||
|
|
||||||
for (const Nif::Property* property : properties)
|
for (const Nif::Property* property : properties)
|
||||||
{
|
{
|
||||||
@ -2081,6 +2082,8 @@ namespace NifOsg
|
|||||||
stateset->setAttributeAndModes(mat, osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(mat, osg::StateAttribute::ON);
|
||||||
if (emissiveMult != 1.f)
|
if (emissiveMult != 1.f)
|
||||||
stateset->addUniform(new osg::Uniform("emissiveMult", emissiveMult));
|
stateset->addUniform(new osg::Uniform("emissiveMult", emissiveMult));
|
||||||
|
if (specStrength != 1.f)
|
||||||
|
stateset->addUniform(new osg::Uniform("specStrength", specStrength));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -524,6 +524,7 @@ namespace Resource
|
|||||||
result.getNode()->accept(colladaAlphaTrickVisitor);
|
result.getNode()->accept(colladaAlphaTrickVisitor);
|
||||||
|
|
||||||
result.getNode()->getOrCreateStateSet()->addUniform(new osg::Uniform("emissiveMult", 1.f));
|
result.getNode()->getOrCreateStateSet()->addUniform(new osg::Uniform("emissiveMult", 1.f));
|
||||||
|
result.getNode()->getOrCreateStateSet()->addUniform(new osg::Uniform("specStrength", 1.f));
|
||||||
result.getNode()->getOrCreateStateSet()->addUniform(new osg::Uniform("envMapColor", osg::Vec4f(1,1,1,1)));
|
result.getNode()->getOrCreateStateSet()->addUniform(new osg::Uniform("envMapColor", osg::Vec4f(1,1,1,1)));
|
||||||
result.getNode()->getOrCreateStateSet()->addUniform(new osg::Uniform("useFalloff", false));
|
result.getNode()->getOrCreateStateSet()->addUniform(new osg::Uniform("useFalloff", false));
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ varying vec3 passNormal;
|
|||||||
#include "alpha.glsl"
|
#include "alpha.glsl"
|
||||||
|
|
||||||
uniform float emissiveMult;
|
uniform float emissiveMult;
|
||||||
|
uniform float specStrength;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
@ -80,7 +81,7 @@ void main()
|
|||||||
gl_FragData[0].xyz *= lighting;
|
gl_FragData[0].xyz *= lighting;
|
||||||
|
|
||||||
float shininess = gl_FrontMaterial.shininess;
|
float shininess = gl_FrontMaterial.shininess;
|
||||||
vec3 matSpec = getSpecularColor().xyz;
|
vec3 matSpec = getSpecularColor().xyz * specStrength;
|
||||||
#if @normalMap
|
#if @normalMap
|
||||||
matSpec *= normalTex.a;
|
matSpec *= normalTex.a;
|
||||||
#endif
|
#endif
|
||||||
|
@ -71,6 +71,7 @@ centroid varying vec3 shadowDiffuseLighting;
|
|||||||
#else
|
#else
|
||||||
uniform float emissiveMult;
|
uniform float emissiveMult;
|
||||||
#endif
|
#endif
|
||||||
|
uniform float specStrength;
|
||||||
varying vec3 passViewPos;
|
varying vec3 passViewPos;
|
||||||
varying vec3 passNormal;
|
varying vec3 passNormal;
|
||||||
|
|
||||||
@ -204,6 +205,7 @@ void main()
|
|||||||
vec3 matSpec = getSpecularColor().xyz;
|
vec3 matSpec = getSpecularColor().xyz;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
matSpec *= specStrength;
|
||||||
if (matSpec != vec3(0.0))
|
if (matSpec != vec3(0.0))
|
||||||
{
|
{
|
||||||
#if (!@normalMap && !@parallax && !@forcePPL)
|
#if (!@normalMap && !@parallax && !@forcePPL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user