- made some changes so that material definitions can properly check automatic layers when determining their material type.

Most importantly this means that any texture with a custom material definition needs to load its automatic layers before applying the definition.
This commit is contained in:
Christoph Oelckers 2020-06-03 21:15:32 +02:00
commit 720853cff8
5 changed files with 12 additions and 8 deletions

View file

@ -12,7 +12,7 @@ struct FStartupInfo
int Type;
int LoadLights = -1;
int LoadBrightmaps = -1;
int modern = -1;
int modern = 0;
enum
{
DefaultStartup,

View file

@ -149,6 +149,7 @@ void FGameTexture::AddAutoMaterials()
{ "materials/ao/", &FGameTexture::AmbientOcclusion }
};
if (flags & GTexf_AutoMaterialsAdded) return; // do this only once
bool fullname = !!(flags & GTexf_FullNameTexture);
FString searchname = GetName();
@ -177,6 +178,7 @@ void FGameTexture::AddAutoMaterials()
}
}
}
flags |= GTexf_AutoMaterialsAdded;
}
//===========================================================================

View file

@ -57,12 +57,14 @@ enum EGameTexFlags
GTexf_RenderFullbright = 32, // always draw fullbright
GTexf_DisableFullbrightSprites = 64, // This texture will not be displayed as fullbright sprite
GTexf_BrightmapChecked = 128, // Check for a colormap-based brightmap was already done.
GTexf_AutoMaterialsAdded = 256, // AddAutoMaterials has been called on this texture.
};
// Refactoring helper to allow piece by piece adjustment of the API
class FGameTexture
{
friend class FMaterial;
friend class GLDefsParser; // this needs access to set up the texture properly
// Material layers. These are shared so reference counting is used.
RefCountedPtr<FTexture> Base;

View file

@ -114,7 +114,7 @@ FMaterial::FMaterial(FGameTexture * tx, int scaleflags)
if (index >= FIRST_USER_SHADER)
{
const UserShaderDesc &usershader = usershaders[index - FIRST_USER_SHADER];
//if (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->CustomShaderTextures)
{