mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-13 06:15:36 -04:00
Merge branch 'idempotent-parallax' into 'master'
Don't forget parallax when reapplying shader visitor Closes #8341 See merge request OpenMW/openmw!4634
This commit is contained in:
commit
f6bff53398
@ -287,11 +287,17 @@ namespace Shader
|
|||||||
addedState->setName("addedState");
|
addedState->setName("addedState");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This list is used both for detecting known texture types (including added normal maps etc.) and setting the
|
||||||
|
// shader defines. Normal maps and normal height maps both get sent to the shader as a normal map, so the latter
|
||||||
|
// must be detected separately.
|
||||||
const char* defaultTextures[] = { "diffuseMap", "normalMap", "emissiveMap", "darkMap", "detailMap", "envMap",
|
const char* defaultTextures[] = { "diffuseMap", "normalMap", "emissiveMap", "darkMap", "detailMap", "envMap",
|
||||||
"specularMap", "decalMap", "bumpMap", "glossMap" };
|
"specularMap", "decalMap", "bumpMap", "glossMap" };
|
||||||
bool isTextureNameRecognized(std::string_view name)
|
bool isTextureNameRecognized(std::string_view name)
|
||||||
{
|
{
|
||||||
return std::find(std::begin(defaultTextures), std::end(defaultTextures), name) != std::end(defaultTextures);
|
if (std::find(std::begin(defaultTextures), std::end(defaultTextures), name) != std::end(defaultTextures))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return name == "normalHeightMap";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderVisitor::applyStateSet(osg::ref_ptr<osg::StateSet> stateset, osg::Node& node)
|
void ShaderVisitor::applyStateSet(osg::ref_ptr<osg::StateSet> stateset, osg::Node& node)
|
||||||
@ -439,8 +445,9 @@ namespace Shader
|
|||||||
if (!writableStateSet)
|
if (!writableStateSet)
|
||||||
writableStateSet = getWritableStateSet(node);
|
writableStateSet = getWritableStateSet(node);
|
||||||
writableStateSet->setTextureAttributeAndModes(unit, normalMapTex, osg::StateAttribute::ON);
|
writableStateSet->setTextureAttributeAndModes(unit, normalMapTex, osg::StateAttribute::ON);
|
||||||
writableStateSet->setTextureAttributeAndModes(
|
writableStateSet->setTextureAttributeAndModes(unit,
|
||||||
unit, new SceneUtil::TextureType("normalMap"), osg::StateAttribute::ON);
|
new SceneUtil::TextureType(normalHeight ? "normalHeightMap" : "normalMap"),
|
||||||
|
osg::StateAttribute::ON);
|
||||||
mRequirements.back().mTextures[unit] = "normalMap";
|
mRequirements.back().mTextures[unit] = "normalMap";
|
||||||
mRequirements.back().mTexStageRequiringTangents = unit;
|
mRequirements.back().mTexStageRequiringTangents = unit;
|
||||||
mRequirements.back().mShaderRequired = true;
|
mRequirements.back().mShaderRequired = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user