- got rid of the gl_info substructure in FTexture and moved all elements into the main class.

This commit is contained in:
Christoph Oelckers 2018-04-24 23:51:19 +02:00
commit e24b597ae4
5 changed files with 86 additions and 93 deletions

View file

@ -74,7 +74,7 @@ public:
WidthBits = bits;
UseType = ETextureType::SWCanvas;
bNoCompress = true;
gl_info.SystemTexture[0] = screen->CreateHardwareTexture(this);
SystemTexture[0] = screen->CreateHardwareTexture(this);
}
// This is just a wrapper around the hardware texture and should never call the bitmap getters - if it does, something is wrong.
@ -100,7 +100,7 @@ SWSceneDrawer::~SWSceneDrawer()
void SWSceneDrawer::RenderView(player_t *player)
{
DCanvas buffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor());
if (FBTexture == nullptr || FBTexture->gl_info.SystemTexture[0] == nullptr ||
if (FBTexture == nullptr || FBTexture->SystemTexture[0] == nullptr ||
FBTexture->GetWidth() != screen->GetWidth() ||
FBTexture->GetHeight() != screen->GetHeight() ||
(V_IsTrueColor() ? 1:0) != FBTexture->WidthBits)
@ -108,15 +108,15 @@ void SWSceneDrawer::RenderView(player_t *player)
// This manually constructs its own material here.
if (FBTexture != nullptr) delete FBTexture;
FBTexture = new FSWSceneTexture(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor());
FBTexture->gl_info.SystemTexture[0]->AllocateBuffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor() ? 4 : 1);
FBTexture->SystemTexture[0]->AllocateBuffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor() ? 4 : 1);
auto mat = FMaterial::ValidateTexture(FBTexture, false);
mat->AddTextureLayer(PaletteTexture);
}
auto buf = FBTexture->gl_info.SystemTexture[0]->MapBuffer();
auto buf = FBTexture->SystemTexture[0]->MapBuffer();
if (!buf) I_FatalError("Unable to map buffer for software rendering");
buffer.SetBuffer(screen->GetWidth(), screen->GetHeight(), screen->GetWidth(), buf);
SWRenderer->RenderView(player, &buffer);
FBTexture->gl_info.SystemTexture[0]->CreateTexture(nullptr, screen->GetWidth(), screen->GetHeight(), 0, false, 0, "swbuffer");
FBTexture->SystemTexture[0]->CreateTexture(nullptr, screen->GetWidth(), screen->GetHeight(), 0, false, 0, "swbuffer");
auto map = swrenderer::CameraLight::Instance()->ShaderColormap();
screen->Begin2D(false);