Skip to content

Commit

Permalink
Hack to set emis, if brightness/glow map exist
Browse files Browse the repository at this point in the history
  • Loading branch information
vs-shirokii committed Aug 16, 2024
1 parent e61961a commit 36ffff5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
37 changes: 28 additions & 9 deletions src/common/rendering/rt/rt_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ namespace cvar
bool rt_firststart = false;
}

RT_CVAR( rt_mod_compat, 1, "mod compatibility level: 0 - none, 1 - enable" )
RT_CVAR( rt_mod_compat, 3, "mod compatibility level bit mask: < bit 1: brightmap fallback | bit 0: general >" )

// clang-format on

Expand Down Expand Up @@ -1665,17 +1665,36 @@ class RTRenderState : public FRenderState
{
return true;
}
if( rt_mod_compat )
if( rt_mod_compat & 2 )
{
if( mBrightmapEnabled )
if( rtstate.is< RtPrim::ExportInstance >() )
{
if( mTextureModeFlags & TEXF_Brightmap )
{
return true;
}
if( mTextureModeFlags & TEXF_Glowmap )
if( mBrightmapEnabled )
{
return true;
if( mTextureModeFlags & TEXF_Glowmap )
{
if( mMaterial.mMaterial && mMaterial.mMaterial->sourcetex &&
mMaterial.mMaterial->sourcetex->Layers.get() &&
mMaterial.mMaterial->sourcetex->Layers->Glowmap.get() &&
mMaterial.mMaterial->sourcetex->Layers->Glowmap->GetSourceLump() >= 0 &&
mMaterial.mMaterial->sourcetex->Layers->Glowmap->GetWidth() > 0 &&
mMaterial.mMaterial->sourcetex->Layers->Glowmap->GetHeight() > 0 )
{
return true;
}
}

if( mTextureModeFlags & TEXF_Brightmap )
{
if( mMaterial.mMaterial && mMaterial.mMaterial->sourcetex &&
mMaterial.mMaterial->sourcetex->Brightmap.get() &&
mMaterial.mMaterial->sourcetex->Brightmap->GetSourceLump() >= 0 &&
mMaterial.mMaterial->sourcetex->Brightmap->GetWidth() > 0 &&
mMaterial.mMaterial->sourcetex->Brightmap->GetHeight() > 0 )
{
return true;
}
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/common/textures/gametexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ class FGameTexture
friend class FMaterial;
friend class GLDefsParser; // this needs access to set up the texture properly

public:

// Material layers. These are shared so reference counting is used.
RefCountedPtr<FTexture> Base;
RefCountedPtr<FTexture> Brightmap;
std::unique_ptr<FMaterialLayers> Layers;

private:

FString Name;
FTextureID id;

Expand Down

0 comments on commit 36ffff5

Please sign in to comment.