1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-17 15:46:43 +00:00

Don't forget parallax when reapplying shader visitor

Fixes https://gitlab.com/OpenMW/openmw/-/issues/8341

I don't think this should go into 0.49 because there may be implications beyond what I've thought of and I'd rather we had a full dev cycle to notice any regressions.

The fix is a little janky, but makes use of some dead code we've had since the introduction of normal-height maps nearly a decade ago, so it's a safe bet that it was never intended to be dead code.
The main effect of the jankiness is that we'll add some pointless @defines for normalHeightMap that none of our shaders use and which will always be zero.
This commit is contained in:
AnyOldName3 2025-04-20 00:12:53 +01:00
parent c1c8769742
commit 115fc08904

View file

@ -287,7 +287,7 @@ namespace Shader
addedState->setName("addedState");
}
const char* defaultTextures[] = { "diffuseMap", "normalMap", "emissiveMap", "darkMap", "detailMap", "envMap",
const char* defaultTextures[] = { "diffuseMap", "normalMap", "normalHeightMap", "emissiveMap", "darkMap", "detailMap", "envMap",
"specularMap", "decalMap", "bumpMap", "glossMap" };
bool isTextureNameRecognized(std::string_view name)
{
@ -440,7 +440,7 @@ namespace Shader
writableStateSet = getWritableStateSet(node);
writableStateSet->setTextureAttributeAndModes(unit, normalMapTex, osg::StateAttribute::ON);
writableStateSet->setTextureAttributeAndModes(
unit, new SceneUtil::TextureType("normalMap"), osg::StateAttribute::ON);
unit, new SceneUtil::TextureType(normalHeight ? "normalHeightMap" : "normalMap"), osg::StateAttribute::ON);
mRequirements.back().mTextures[unit] = "normalMap";
mRequirements.back().mTexStageRequiringTangents = unit;
mRequirements.back().mShaderRequired = true;