mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
- More adjustments
This commit is contained in:
parent
245a8243b0
commit
e6b4c63b99
2 changed files with 16 additions and 19 deletions
|
@ -133,14 +133,15 @@ void IHardwareTexture::Resize(int swidth, int sheight, int width, int height, un
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
IHardwareTexture * FMaterial::ValidateSysTexture(FTexture * tex, bool expand)
|
IHardwareTexture * FMaterial::ValidateSysTexture(FTexture * tex, int translation, bool expand)
|
||||||
{
|
{
|
||||||
if (tex && tex->UseType!=ETextureType::Null)
|
if (tex && tex->UseType!=ETextureType::Null)
|
||||||
{
|
{
|
||||||
IHardwareTexture *gltex = tex->SystemTexture[expand];
|
IHardwareTexture *gltex = tex->SystemTextures.GetHardwareTexture(0, expand);
|
||||||
if (gltex == nullptr)
|
if (gltex == nullptr)
|
||||||
{
|
{
|
||||||
gltex = tex->SystemTexture[expand] = screen->CreateHardwareTexture();
|
tex->SystemTextures.AddHardwareTexture(0, expand, screen->CreateHardwareTexture());
|
||||||
|
gltex = tex->SystemTextures.GetHardwareTexture(0, expand);
|
||||||
}
|
}
|
||||||
return gltex;
|
return gltex;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +183,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
||||||
{
|
{
|
||||||
for (auto &texture : { tx->Normal, tx->Specular })
|
for (auto &texture : { tx->Normal, tx->Specular })
|
||||||
{
|
{
|
||||||
ValidateSysTexture(texture, expanded);
|
ValidateSysTexture(texture, 0, expanded);
|
||||||
mTextureLayers.Push(texture);
|
mTextureLayers.Push(texture);
|
||||||
}
|
}
|
||||||
mShaderIndex = SHADER_Specular;
|
mShaderIndex = SHADER_Specular;
|
||||||
|
@ -191,7 +192,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
||||||
{
|
{
|
||||||
for (auto &texture : { tx->Normal, tx->Metallic, tx->Roughness, tx->AmbientOcclusion })
|
for (auto &texture : { tx->Normal, tx->Metallic, tx->Roughness, tx->AmbientOcclusion })
|
||||||
{
|
{
|
||||||
ValidateSysTexture(texture, expanded);
|
ValidateSysTexture(texture, 0, expanded);
|
||||||
mTextureLayers.Push(texture);
|
mTextureLayers.Push(texture);
|
||||||
}
|
}
|
||||||
mShaderIndex = SHADER_PBR;
|
mShaderIndex = SHADER_PBR;
|
||||||
|
@ -200,7 +201,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
||||||
tx->CreateDefaultBrightmap();
|
tx->CreateDefaultBrightmap();
|
||||||
if (tx->Brightmap)
|
if (tx->Brightmap)
|
||||||
{
|
{
|
||||||
ValidateSysTexture(tx->Brightmap, expanded);
|
ValidateSysTexture(tx->Brightmap, 0, expanded);
|
||||||
mTextureLayers.Push(tx->Brightmap);
|
mTextureLayers.Push(tx->Brightmap);
|
||||||
if (mShaderIndex == SHADER_Specular)
|
if (mShaderIndex == SHADER_Specular)
|
||||||
mShaderIndex = SHADER_SpecularBrightmap;
|
mShaderIndex = SHADER_SpecularBrightmap;
|
||||||
|
@ -218,14 +219,14 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
||||||
for (auto &texture : tx->CustomShaderTextures)
|
for (auto &texture : tx->CustomShaderTextures)
|
||||||
{
|
{
|
||||||
if (texture == nullptr) continue;
|
if (texture == nullptr) continue;
|
||||||
ValidateSysTexture(texture, expanded);
|
ValidateSysTexture(texture, 0, expanded);
|
||||||
mTextureLayers.Push(texture);
|
mTextureLayers.Push(texture);
|
||||||
}
|
}
|
||||||
mShaderIndex = tx->shaderindex;
|
mShaderIndex = tx->shaderindex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mBaseLayer = ValidateSysTexture(tx, expanded);
|
mBaseLayer = ValidateSysTexture(tx, 0, expanded);
|
||||||
|
|
||||||
|
|
||||||
mWidth = tx->GetWidth();
|
mWidth = tx->GetWidth();
|
||||||
|
@ -513,26 +514,22 @@ FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translat
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Flushes all hardware dependent data
|
// Flushes all hardware dependent data.
|
||||||
|
// Thia must not, under any circumstances, delete the wipe textures, because
|
||||||
|
// all CCMDs triggering a flush can be executed while a wipe is in progress
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FMaterial::FlushAll()
|
void FMaterial::FlushAll()
|
||||||
{
|
{
|
||||||
for(int i=mMaterials.Size()-1;i>=0;i--)
|
|
||||||
{
|
|
||||||
mMaterials[i]->mBaseLayer->Clean(true);
|
|
||||||
}
|
|
||||||
// This is for shader layers. All shader layers must be managed by the texture manager
|
|
||||||
// so this will catch everything.
|
|
||||||
for(int i=TexMan.NumTextures()-1;i>=0;i--)
|
for(int i=TexMan.NumTextures()-1;i>=0;i--)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 2; j++)
|
for (int j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
auto gltex = TexMan.ByIndex(i)->SystemTexture[j];
|
TexMan.ByIndex(i)->SystemTextures.Clean(true);
|
||||||
if (gltex != nullptr) gltex->Clean(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// This must also delete the software renderer's canvas.
|
||||||
}
|
}
|
||||||
|
|
||||||
void FMaterial::Clean(bool f)
|
void FMaterial::Clean(bool f)
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
void Precache();
|
void Precache();
|
||||||
void PrecacheList(SpriteHits &translations);
|
void PrecacheList(SpriteHits &translations);
|
||||||
int GetShaderIndex() const { return mShaderIndex; }
|
int GetShaderIndex() const { return mShaderIndex; }
|
||||||
IHardwareTexture * ValidateSysTexture(FTexture * tex, bool expand);
|
IHardwareTexture * ValidateSysTexture(FTexture * tex, int translation, bool expand);
|
||||||
void AddTextureLayer(FTexture *tex)
|
void AddTextureLayer(FTexture *tex)
|
||||||
{
|
{
|
||||||
ValidateTexture(tex, false);
|
ValidateTexture(tex, false);
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
i--;
|
i--;
|
||||||
FTexture *layer = mTextureLayers[i];
|
FTexture *layer = mTextureLayers[i];
|
||||||
if (pLayer) *pLayer = layer;
|
if (pLayer) *pLayer = layer;
|
||||||
return ValidateSysTexture(layer, isExpanded());
|
return ValidateSysTexture(layer, 0, isExpanded());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue