- fixed texture layer management so that each material layer can decide for itself if it wants to allow upscaling.

- rewrote the hardware texture precacher to use the new texture management to properly track the data to delete.
This commit is contained in:
Christoph Oelckers 2020-04-19 10:08:24 +02:00
commit b2281c38e1
20 changed files with 190 additions and 135 deletions

View file

@ -314,20 +314,19 @@ void PolyRenderState::ApplyMaterial()
{
mTempTM = mMaterial.mMaterial->Source()->isHardwareCanvas() ? TM_OPAQUE : TM_NORMAL;
FTexture* layer;
MaterialLayerInfo* layer;
auto base = static_cast<PolyHardwareTexture*>(mMaterial.mMaterial->GetLayer(0, mMaterial.mTranslation, &layer));
if (base)
{
DCanvas *texcanvas = base->GetImage(layer, mMaterial);
DCanvas *texcanvas = base->GetImage(layer->layerTexture, mMaterial.mTranslation, layer->scaleFlags);
mDrawCommands->SetTexture(0, texcanvas->GetPixels(), texcanvas->GetWidth(), texcanvas->GetHeight(), texcanvas->IsBgra());
int numLayers = mMaterial.mMaterial->GetLayers();
int numLayers = mMaterial.mMaterial->NumLayers();
for (int i = 1; i < numLayers; i++)
{
FTexture* layer;
auto systex = static_cast<PolyHardwareTexture*>(mMaterial.mMaterial->GetLayer(i, 0, &layer));
texcanvas = systex->GetImage(layer, 0, mMaterial.mMaterial->GetScaleFlags());
texcanvas = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags);
mDrawCommands->SetTexture(i, texcanvas->GetPixels(), texcanvas->GetWidth(), texcanvas->GetHeight(), texcanvas->IsBgra());
}
}