From 81e7d77b4489f80c6dc5aaf30b46565b5674d2d5 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Thu, 12 Jan 2023 14:03:19 +0100 Subject: [PATCH] Fix diffuse-only material shaders not applying. --- src/common/textures/hw_material.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/textures/hw_material.cpp b/src/common/textures/hw_material.cpp index c6b38e5a6..2517c098e 100644 --- a/src/common/textures/hw_material.cpp +++ b/src/common/textures/hw_material.cpp @@ -133,12 +133,15 @@ FMaterial::FMaterial(FGameTexture * tx, int scaleflags) if (index >= FIRST_USER_SHADER) { const UserShaderDesc& usershader = usershaders[index - FIRST_USER_SHADER]; - if (tx->Layers && usershader.shaderType == mShaderIndex) // Only apply user shader if it matches the expected material + if (usershader.shaderType == mShaderIndex) // Only apply user shader if it matches the expected material { - for (auto& texture : tx->Layers->CustomShaderTextures) + if (tx->Layers) { - if (texture == nullptr) continue; - mTextureLayers.Push({ texture.get(), 0 }); // scalability should be user-definable. + for (auto& texture : tx->Layers->CustomShaderTextures) + { + if (texture == nullptr) continue; + mTextureLayers.Push({ texture.get(), 0 }); // scalability should be user-definable. + } } mShaderIndex = index; }