- continued work on texture management.

This commit is contained in:
Christoph Oelckers 2018-12-12 18:39:38 +01:00
commit c5447f0cdd
18 changed files with 79 additions and 140 deletions

View file

@ -339,14 +339,14 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
// Textures that are already scaled in the texture lump will not get replaced by hires textures.
int flags = mat->isExpanded() ? CTF_Expand : (gl_texture_usehires && !tex->isScaled()) ? CTF_CheckHires : 0;
int numLayers = mat->GetLayers();
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0));
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0, translation));
if (base->BindOrCreate(tex, 0, CLAMP_NONE, translation, flags))
{
for (int i = 1; i < numLayers; i++)
{
FTexture *layer;
auto systex = static_cast<FHardwareTexture*>(mat->GetLayer(i, &layer));
auto systex = static_cast<FHardwareTexture*>(mat->GetLayer(i, 0, &layer));
systex->BindOrCreate(layer, i, CLAMP_NONE, 0, mat->isExpanded() ? CTF_Expand : 0);
}
}
@ -354,13 +354,6 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
FHardwareTexture::UnbindAll();
}
bool OpenGLFrameBuffer::CheckPrecacheMaterial(FMaterial *mat)
{
if (!mat->tex->GetImage()) return true;
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0));
return base->Exists(0);
}
FModelRenderer *OpenGLFrameBuffer::CreateModelRenderer(int mli)
{
return new FGLModelRenderer(nullptr, gl_RenderState, mli);