mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-29 04:50:42 +00:00
- texture code restructuring.
This commit is contained in:
parent
cdcb25bc1f
commit
423f758314
14 changed files with 80 additions and 45 deletions
|
@ -2104,6 +2104,7 @@ int32_t enginePostInit(void)
|
||||||
V_LoadTranslations(); // loading the translations must be delayed until the palettes have been fully set up.
|
V_LoadTranslations(); // loading the translations must be delayed until the palettes have been fully set up.
|
||||||
lookups.postLoadTables();
|
lookups.postLoadTables();
|
||||||
TileFiles.SetupReverseTileMap();
|
TileFiles.SetupReverseTileMap();
|
||||||
|
TileFiles.PostLoadSetup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3062,7 +3063,6 @@ void twod_rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t pic
|
||||||
F2DDrawer::RenderCommand dg = {};
|
F2DDrawer::RenderCommand dg = {};
|
||||||
int method = 0;
|
int method = 0;
|
||||||
|
|
||||||
dg.mTranslationId = pic? 0 : TRANSLATION(Translation_Remap + basepal, dapalnum);
|
|
||||||
dg.mType = F2DDrawer::DrawTypeTriangles;
|
dg.mType = F2DDrawer::DrawTypeTriangles;
|
||||||
if (clipx1 > 0 || clipy1 > 0 || clipx2 < screen->GetWidth() - 1 || clipy2 < screen->GetHeight() - 1)
|
if (clipx1 > 0 || clipy1 > 0 || clipx2 < screen->GetWidth() - 1 || clipy2 < screen->GetHeight() - 1)
|
||||||
{
|
{
|
||||||
|
@ -3088,6 +3088,12 @@ void twod_rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t pic
|
||||||
}
|
}
|
||||||
|
|
||||||
dg.mTexture = pic ? pic : tileGetTexture(picnum);
|
dg.mTexture = pic ? pic : tileGetTexture(picnum);
|
||||||
|
if (!dg.mTexture || !dg.mTexture->isValid()) return; // empty tile.
|
||||||
|
|
||||||
|
// todo: check for hires replacements
|
||||||
|
if (basepal == 0 && dapalnum == 0 && pic) dg.mTranslationId = 0;
|
||||||
|
else dg.mTranslationId = TRANSLATION(Translation_Remap + basepal, dapalnum);
|
||||||
|
|
||||||
dg.mVertCount = 4;
|
dg.mVertCount = 4;
|
||||||
dg.mVertIndex = (int)twod->mVertices.Reserve(4);
|
dg.mVertIndex = (int)twod->mVertices.Reserve(4);
|
||||||
auto ptr = &twod->mVertices[dg.mVertIndex];
|
auto ptr = &twod->mVertices[dg.mVertIndex];
|
||||||
|
|
|
@ -1712,7 +1712,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// The data lookup here is one incredible mess. Thanks to whoever cooked this up... :(
|
// The data lookup here is one incredible mess. Thanks to whoever cooked this up... :(
|
||||||
// Todo: assign the laxers to the base textures at setup time
|
// Todo: assign the layers to the base textures at setup time
|
||||||
if (!(tspr->clipdist & TSPR_FLAGS_MDHACK))
|
if (!(tspr->clipdist & TSPR_FLAGS_MDHACK))
|
||||||
{
|
{
|
||||||
det = tex = hw_detailmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, DETAILPAL, surfi, nullptr) : nullptr;
|
det = tex = hw_detailmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, DETAILPAL, surfi, nullptr) : nullptr;
|
||||||
|
|
|
@ -1150,6 +1150,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
|
||||||
}
|
}
|
||||||
|
|
||||||
GLInterface.SetPalswap(globalpal);
|
GLInterface.SetPalswap(globalpal);
|
||||||
|
// The texture here is already translated.
|
||||||
GLInterface.SetTexture(-1, htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, 0, CLAMP_XY);
|
GLInterface.SetTexture(-1, htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, 0, CLAMP_XY);
|
||||||
|
|
||||||
// This must be done after setting up the texture.
|
// This must be done after setting up the texture.
|
||||||
|
@ -1159,9 +1160,6 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
|
||||||
else
|
else
|
||||||
GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
|
GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
|
||||||
|
|
||||||
GLInterface.UseBrightmaps(false);
|
|
||||||
GLInterface.UseGlowMapping(false);
|
|
||||||
GLInterface.UseDetailMapping(false);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto data = screen->mVertexData->AllocVertices(m->qcnt * 6);
|
auto data = screen->mVertexData->AllocVertices(m->qcnt * 6);
|
||||||
|
|
|
@ -166,7 +166,6 @@ IHardwareTexture *FMaterial::GetLayer(int i, int translation, MaterialLayerInfo
|
||||||
|
|
||||||
FMaterial * FMaterial::ValidateTexture(FGameTexture * gtex, int scaleflags, bool create)
|
FMaterial * FMaterial::ValidateTexture(FGameTexture * gtex, int scaleflags, bool create)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if (gtex && gtex->isValid())
|
if (gtex && gtex->isValid())
|
||||||
{
|
{
|
||||||
if (!gtex->expandSprites()) scaleflags &= ~CTF_Expand;
|
if (!gtex->expandSprites()) scaleflags &= ~CTF_Expand;
|
||||||
|
@ -178,7 +177,6 @@ FMaterial * FMaterial::ValidateTexture(FGameTexture * gtex, int scaleflags, bool
|
||||||
}
|
}
|
||||||
return hwtex;
|
return hwtex;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "v_2ddrawer.h"
|
#include "v_2ddrawer.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "../glbackend/glbackend.h"
|
#include "../glbackend/glbackend.h"
|
||||||
|
#include "hw_material.h"
|
||||||
/*
|
/*
|
||||||
#include "hwrenderer/scene/hw_portal.h"
|
#include "hwrenderer/scene/hw_portal.h"
|
||||||
#include "hwrenderer/utility/hw_clock.h"
|
#include "hwrenderer/utility/hw_clock.h"
|
||||||
|
@ -378,6 +379,11 @@ void DFrameBuffer::FPSLimit()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FMaterial* DFrameBuffer::CreateMaterial(FGameTexture* tex, int scaleflags)
|
||||||
|
{
|
||||||
|
return new FMaterial(tex, scaleflags);
|
||||||
|
}
|
||||||
|
|
||||||
void DFrameBuffer::BeginScene()
|
void DFrameBuffer::BeginScene()
|
||||||
{
|
{
|
||||||
if (videoGetRenderMode() < REND_POLYMOST) return;
|
if (videoGetRenderMode() < REND_POLYMOST) return;
|
||||||
|
|
|
@ -51,7 +51,6 @@ static const int VID_MIN_UI_WIDTH = 640;
|
||||||
static const int VID_MIN_UI_HEIGHT = 400;
|
static const int VID_MIN_UI_HEIGHT = 400;
|
||||||
|
|
||||||
struct sector_t;
|
struct sector_t;
|
||||||
class FTexture;
|
|
||||||
struct FPortalSceneState;
|
struct FPortalSceneState;
|
||||||
class FSkyVertexBuffer;
|
class FSkyVertexBuffer;
|
||||||
class IIndexBuffer;
|
class IIndexBuffer;
|
||||||
|
@ -115,7 +114,6 @@ inline bool V_IsTrueColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FTexture;
|
|
||||||
class FileWriter;
|
class FileWriter;
|
||||||
enum FTextureFormat : uint32_t;
|
enum FTextureFormat : uint32_t;
|
||||||
class FModelRenderer;
|
class FModelRenderer;
|
||||||
|
@ -148,7 +146,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
class IHardwareTexture;
|
class IHardwareTexture;
|
||||||
class FTexture;
|
class FGameTexture;
|
||||||
|
|
||||||
|
|
||||||
class DFrameBuffer
|
class DFrameBuffer
|
||||||
|
@ -233,6 +231,7 @@ public:
|
||||||
virtual IHardwareTexture *CreateHardwareTexture(int numchannels) { return nullptr; }
|
virtual IHardwareTexture *CreateHardwareTexture(int numchannels) { return nullptr; }
|
||||||
virtual void PrecacheMaterial(FMaterial *mat, int translation) {}
|
virtual void PrecacheMaterial(FMaterial *mat, int translation) {}
|
||||||
virtual FModelRenderer *CreateModelRenderer(int mli) { return nullptr; }
|
virtual FModelRenderer *CreateModelRenderer(int mli) { return nullptr; }
|
||||||
|
virtual FMaterial* CreateMaterial(FGameTexture* tex, int scaleflags);
|
||||||
virtual void BeginFrame() {}
|
virtual void BeginFrame() {}
|
||||||
virtual void SetWindowSize(int w, int h) {}
|
virtual void SetWindowSize(int w, int h) {}
|
||||||
virtual void StartPrecaching() {}
|
virtual void StartPrecaching() {}
|
||||||
|
@ -248,8 +247,11 @@ public:
|
||||||
bool BuffersArePersistent() { return !!(hwcaps & RFL_BUFFER_STORAGE); }
|
bool BuffersArePersistent() { return !!(hwcaps & RFL_BUFFER_STORAGE); }
|
||||||
|
|
||||||
// Begin/End 2D drawing operations.
|
// Begin/End 2D drawing operations.
|
||||||
void Begin2D() { isIn2D = true; }
|
void Begin2D()
|
||||||
void End2D() { isIn2D = false; }
|
{
|
||||||
|
m2DDrawer.Begin(Width, Height);
|
||||||
|
}
|
||||||
|
void End2D() { m2DDrawer.End(); }
|
||||||
|
|
||||||
void BeginScene();
|
void BeginScene();
|
||||||
void FinishScene();
|
void FinishScene();
|
||||||
|
@ -257,7 +259,7 @@ public:
|
||||||
void End2DAndUpdate()
|
void End2DAndUpdate()
|
||||||
{
|
{
|
||||||
DrawRateStuff();
|
DrawRateStuff();
|
||||||
End2D();
|
m2DDrawer.End();
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,9 +443,9 @@ FGameTexture* BuildTiles::ValidateCustomTile(int tilenum, ReplacementType type)
|
||||||
replacement = new FCanvasTexture(0, 0);
|
replacement = new FCanvasTexture(0, 0);
|
||||||
}
|
}
|
||||||
else return nullptr;
|
else return nullptr;
|
||||||
auto reptex = MakeGameTexture(replacement, "", ETextureType::Any);
|
auto rep = MakeGameTexture(replacement, tile->GetName(), ETextureType::Override);
|
||||||
AddTile(tilenum, reptex);
|
AddTile(tilenum, rep);
|
||||||
return reptex;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -777,7 +777,8 @@ void tileSetDummy(int tile, int width, int height)
|
||||||
}
|
}
|
||||||
else if (width > 0 && height > 0)
|
else if (width > 0 && height > 0)
|
||||||
{
|
{
|
||||||
auto dtile = MakeGameTexture(new FImageTexture(new FDummyTile(width, height)), "", ETextureType::Any);
|
FStringf texname("#%05d", tile);
|
||||||
|
auto dtile = MakeGameTexture(new FImageTexture(new FDummyTile(width, height)), texname, ETextureType::Any);
|
||||||
TileFiles.AddTile(tile, dtile);
|
TileFiles.AddTile(tile, dtile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -831,7 +832,7 @@ int BuildTiles::tileCreateRotated(int tileNum)
|
||||||
*(dst + y * width + xofs) = *(src + y + yofs);
|
*(dst + y * width + xofs) = *(src + y + yofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dtex = MakeGameTexture(new FImageTexture(new FLooseTile(dbuffer, tex->GetTexelHeight(), tex->GetTexelWidth())), "", ETextureType::Any);
|
auto dtex = MakeGameTexture(new FImageTexture(new FLooseTile(dbuffer, tex->GetTexelHeight(), tex->GetTexelWidth())), "", ETextureType::Override);
|
||||||
int index = findUnusedTile();
|
int index = findUnusedTile();
|
||||||
bool mapart = TileFiles.tiledata[tileNum].texture != TileFiles.tiledata[tileNum].backup;
|
bool mapart = TileFiles.tiledata[tileNum].texture != TileFiles.tiledata[tileNum].backup;
|
||||||
TileFiles.AddTile(index, dtex, mapart);
|
TileFiles.AddTile(index, dtex, mapart);
|
||||||
|
|
|
@ -104,7 +104,7 @@ void PaletteManager::BindPalette(int index)
|
||||||
p->CreateTexture((uint8_t*)palettedata->Palette, 256, 1, 15, false, "Palette");
|
p->CreateTexture((uint8_t*)palettedata->Palette, 256, 1, 15, false, "Palette");
|
||||||
palettetextures[index] = p;
|
palettetextures[index] = p;
|
||||||
}
|
}
|
||||||
inst->BindTexture(2, palettetextures[index], SamplerNoFilterClampXY);
|
inst->SetPaletteTexture(palettetextures[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ void PaletteManager::BindPalswap(int index)
|
||||||
p->CreateTexture(lookup.Data(), 256, numshades, 15, false, "Palette");
|
p->CreateTexture(lookup.Data(), 256, numshades, 15, false, "Palette");
|
||||||
palswaptextures[index] = p;
|
palswaptextures[index] = p;
|
||||||
}
|
}
|
||||||
inst->BindTexture(1, palswaptextures[index], SamplerNoFilterClampXY);
|
inst->SetLookupTexture(palswaptextures[index]);
|
||||||
inst->SetFadeColor(lookups.getFade(index));
|
inst->SetFadeColor(lookups.getFade(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ struct PolymostRenderState
|
||||||
PalEntry fullscreenTint = 0xffffff, hictint = 0xffffff, hictint_overlay = 0xffffff;
|
PalEntry fullscreenTint = 0xffffff, hictint = 0xffffff, hictint_overlay = 0xffffff;
|
||||||
int hictint_flags = -1;
|
int hictint_flags = -1;
|
||||||
FDepthBiasState mBias{ };
|
FDepthBiasState mBias{ };
|
||||||
|
OpenGLRenderer::FHardwareTexture* PaletteTexture = nullptr, * LookupTexture = nullptr;
|
||||||
|
|
||||||
int StateFlags = STF_COLORMASK|STF_DEPTHMASK;
|
int StateFlags = STF_COLORMASK|STF_DEPTHMASK;
|
||||||
FRenderStyle Style{};
|
FRenderStyle Style{};
|
||||||
|
@ -96,7 +97,7 @@ struct PolymostRenderState
|
||||||
PalEntry ClearColor = 0;
|
PalEntry ClearColor = 0;
|
||||||
short vp_x, vp_y, vp_w, vp_h;
|
short vp_x, vp_y, vp_w, vp_h;
|
||||||
short sc_x = SHRT_MIN, sc_y, sc_w, sc_h;
|
short sc_x = SHRT_MIN, sc_y, sc_w, sc_h;
|
||||||
int texIds[6], samplerIds[6];
|
int texIds[4], samplerIds[4];
|
||||||
|
|
||||||
PalEntry FogColor;
|
PalEntry FogColor;
|
||||||
|
|
||||||
|
|
|
@ -166,15 +166,15 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
|
||||||
int SamplerLoc;
|
int SamplerLoc;
|
||||||
SamplerLoc = glGetUniformLocation(hShader, "s_texture");
|
SamplerLoc = glGetUniformLocation(hShader, "s_texture");
|
||||||
glUniform1i(SamplerLoc, 0);
|
glUniform1i(SamplerLoc, 0);
|
||||||
SamplerLoc = glGetUniformLocation(hShader, "s_palswap");
|
|
||||||
glUniform1i(SamplerLoc, 1);
|
|
||||||
SamplerLoc = glGetUniformLocation(hShader, "s_palette");
|
|
||||||
glUniform1i(SamplerLoc, 2);
|
|
||||||
SamplerLoc = glGetUniformLocation(hShader, "s_detail");
|
|
||||||
glUniform1i(SamplerLoc, 3);
|
|
||||||
SamplerLoc = glGetUniformLocation(hShader, "s_glow");
|
|
||||||
glUniform1i(SamplerLoc, 4);
|
|
||||||
SamplerLoc = glGetUniformLocation(hShader, "s_brightmap");
|
SamplerLoc = glGetUniformLocation(hShader, "s_brightmap");
|
||||||
|
glUniform1i(SamplerLoc, 1);
|
||||||
|
SamplerLoc = glGetUniformLocation(hShader, "s_detail");
|
||||||
|
glUniform1i(SamplerLoc, 2);
|
||||||
|
SamplerLoc = glGetUniformLocation(hShader, "s_glow");
|
||||||
|
glUniform1i(SamplerLoc, 3);
|
||||||
|
SamplerLoc = glGetUniformLocation(hShader, "s_palette");
|
||||||
|
glUniform1i(SamplerLoc, 4);
|
||||||
|
SamplerLoc = glGetUniformLocation(hShader, "s_palswap");
|
||||||
glUniform1i(SamplerLoc, 5);
|
glUniform1i(SamplerLoc, 5);
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
|
@ -121,8 +121,8 @@ bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int me
|
||||||
{
|
{
|
||||||
auto htex = LoadTexture(det, TT_TRUECOLOR, 0);
|
auto htex = LoadTexture(det, TT_TRUECOLOR, 0);
|
||||||
UseDetailMapping(true);
|
UseDetailMapping(true);
|
||||||
htex->BindOrCreate(det, 3, CLAMP_NONE, 0, 0);
|
htex->BindOrCreate(det, 2, CLAMP_NONE, 0, 0);
|
||||||
BindTexture(3, htex, SamplerRepeat);
|
BindTexture(2, htex, SamplerRepeat);
|
||||||
texbound[0] = true;
|
texbound[0] = true;
|
||||||
|
|
||||||
/* todo:
|
/* todo:
|
||||||
|
@ -137,8 +137,8 @@ bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int me
|
||||||
{
|
{
|
||||||
auto htex = LoadTexture(glow, TT_TRUECOLOR, 0);
|
auto htex = LoadTexture(glow, TT_TRUECOLOR, 0);
|
||||||
UseGlowMapping(true);
|
UseGlowMapping(true);
|
||||||
htex->BindOrCreate(glow, 4, sampler, 0, CTF_Upscale);
|
htex->BindOrCreate(glow, 3, sampler, 0, CTF_Upscale);
|
||||||
BindTexture(4, htex, SamplerRepeat);
|
BindTexture(3, htex, SamplerRepeat);
|
||||||
texbound[1] = true;
|
texbound[1] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,15 +152,15 @@ bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int me
|
||||||
if (htex != nullptr)
|
if (htex != nullptr)
|
||||||
{
|
{
|
||||||
UseBrightmaps(true);
|
UseBrightmaps(true);
|
||||||
htex->BindOrCreate(btex, 5, sampler, 0, CTF_Upscale);
|
htex->BindOrCreate(btex, 1, sampler, 0, CTF_Upscale);
|
||||||
BindTexture(5, htex, sampler);
|
BindTexture(1, htex, sampler);
|
||||||
texbound[2] = true;
|
texbound[2] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!texbound[0]) UnbindTexture(3);
|
if (!texbound[0]) UnbindTexture(2);
|
||||||
if (!texbound[1]) UnbindTexture(4);
|
if (!texbound[1]) UnbindTexture(3);
|
||||||
if (!texbound[2]) UnbindTexture(5);
|
if (!texbound[2]) UnbindTexture(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
|
|
|
@ -286,6 +286,8 @@ void GLInstance::DrawImGui(ImDrawData* data)
|
||||||
|
|
||||||
void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
|
void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
|
||||||
{
|
{
|
||||||
|
if (!OpenGLRenderer::GLRenderer) return;
|
||||||
|
auto sm = OpenGLRenderer::GLRenderer->mSamplerManager;
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
for (int i = 0; i < MAX_TEXTURES; i++)
|
for (int i = 0; i < MAX_TEXTURES; i++)
|
||||||
{
|
{
|
||||||
|
@ -297,13 +299,24 @@ void PolymostRenderState::Apply(PolymostShader* shader, GLState &oldState)
|
||||||
reset = true;
|
reset = true;
|
||||||
}
|
}
|
||||||
glBindTexture(GL_TEXTURE_2D, texIds[i]);
|
glBindTexture(GL_TEXTURE_2D, texIds[i]);
|
||||||
if (OpenGLRenderer::GLRenderer)
|
sm->Bind(i, samplerIds[i], -1);
|
||||||
OpenGLRenderer::GLRenderer->mSamplerManager->Bind(i, samplerIds[i], -1);
|
|
||||||
oldState.TexId[i] = texIds[i];
|
oldState.TexId[i] = texIds[i];
|
||||||
oldState.SamplerId[i] = samplerIds[i];
|
oldState.SamplerId[i] = samplerIds[i];
|
||||||
}
|
}
|
||||||
if (reset) glActiveTexture(GL_TEXTURE0);
|
|
||||||
}
|
}
|
||||||
|
if (PaletteTexture != nullptr)
|
||||||
|
{
|
||||||
|
PaletteTexture->Bind(4, false);
|
||||||
|
sm->Bind(4, CLAMP_NOFILTER, -1);
|
||||||
|
}
|
||||||
|
if (LookupTexture != nullptr)
|
||||||
|
{
|
||||||
|
LookupTexture->Bind(5, false);
|
||||||
|
sm->Bind(5, CLAMP_NOFILTER, -1);
|
||||||
|
}
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
|
|
||||||
if (StateFlags != oldState.Flags)
|
if (StateFlags != oldState.Flags)
|
||||||
{
|
{
|
||||||
if ((StateFlags ^ oldState.Flags) & STF_DEPTHTEST)
|
if ((StateFlags ^ oldState.Flags) & STF_DEPTHTEST)
|
||||||
|
|
|
@ -101,7 +101,7 @@ extern float shadediv[256];
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MAX_TEXTURES = 6, /*15*/ // slot 15 is used internally and not available. - The renderer uses only 5, though.
|
MAX_TEXTURES = 4, /*15*/ // slot 15 is used internally and not available. - The renderer uses only 5, though.
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GLState
|
struct GLState
|
||||||
|
@ -120,7 +120,6 @@ class GLInstance
|
||||||
int lastPalswapIndex = -1;
|
int lastPalswapIndex = -1;
|
||||||
OpenGLRenderer::FHardwareTexture* texv;
|
OpenGLRenderer::FHardwareTexture* texv;
|
||||||
FGameTexture* currentTexture = nullptr;
|
FGameTexture* currentTexture = nullptr;
|
||||||
int TextureType;
|
|
||||||
int MatrixChange = 0;
|
int MatrixChange = 0;
|
||||||
|
|
||||||
// Cached GL state.
|
// Cached GL state.
|
||||||
|
@ -481,6 +480,16 @@ public:
|
||||||
|
|
||||||
OpenGLRenderer::FHardwareTexture *LoadTexture(FTexture* tex, int texturetype, int palid);
|
OpenGLRenderer::FHardwareTexture *LoadTexture(FTexture* tex, int texturetype, int palid);
|
||||||
|
|
||||||
|
void SetPaletteTexture(OpenGLRenderer::FHardwareTexture* tex)
|
||||||
|
{
|
||||||
|
renderState.PaletteTexture = tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetLookupTexture(OpenGLRenderer::FHardwareTexture* tex)
|
||||||
|
{
|
||||||
|
renderState.LookupTexture = tex;
|
||||||
|
}
|
||||||
|
|
||||||
bool SetTexture(int globalpicnum, FGameTexture* tex, int palette, int method, int sampleroverride);
|
bool SetTexture(int globalpicnum, FGameTexture* tex, int palette, int method, int sampleroverride);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -162,14 +162,15 @@ void GLInstance::Draw2D(F2DDrawer *drawer)
|
||||||
DisableScissor();
|
DisableScissor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.mTexture != nullptr)
|
auto tex = cmd.mTexture;
|
||||||
|
if (tex != nullptr && tex->isValid())
|
||||||
{
|
{
|
||||||
auto tex = cmd.mTexture;
|
auto tex = cmd.mTexture;
|
||||||
|
|
||||||
SetFadeDisable(true);
|
SetFadeDisable(true);
|
||||||
SetShade(0, numshades);
|
SetShade(0, numshades);
|
||||||
|
|
||||||
SetTexture(TileFiles.GetTileIndex(cmd.mTexture), cmd.mTexture, cmd.mTranslationId, 0, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY);
|
SetTexture(TileFiles.GetTileIndex(tex), tex, cmd.mTranslationId, 0, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY);
|
||||||
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
|
EnableBlend(!(cmd.mRenderStyle.Flags & STYLEF_Alpha1));
|
||||||
UseColorOnly(false);
|
UseColorOnly(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue