mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- moved the hires texture replacement logic into a backend callback.
This way it can be handled transparently to the calling code. Fonts do not work yet, though.
This commit is contained in:
parent
8c241afc40
commit
ed599d0f05
12 changed files with 85 additions and 94 deletions
|
@ -1495,7 +1495,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
||||||
#endif
|
#endif
|
||||||
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
|
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
|
||||||
GLInterface.SetFade(sector[tspr->sectnum].floorpal);
|
GLInterface.SetFade(sector[tspr->sectnum].floorpal);
|
||||||
GLInterface.SetTexture(-1, tex, palid, CLAMP_XY);
|
GLInterface.SetTexture(tex, palid, CLAMP_XY);
|
||||||
|
|
||||||
if (tspr->clipdist & TSPR_FLAGS_MDHACK)
|
if (tspr->clipdist & TSPR_FLAGS_MDHACK)
|
||||||
{
|
{
|
||||||
|
@ -1559,7 +1559,6 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
||||||
GLInterface.SetCull(Cull_None);
|
GLInterface.SetCull(Cull_None);
|
||||||
|
|
||||||
GLInterface.SetIdentityMatrix(Matrix_Model);
|
GLInterface.SetIdentityMatrix(Matrix_Model);
|
||||||
GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
|
|
||||||
|
|
||||||
globalnoeffect=0;
|
globalnoeffect=0;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -29,12 +29,10 @@ CVARD(Bool, hw_animsmoothing, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/di
|
||||||
CVARD(Bool, hw_hightile, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable hightile texture rendering")
|
CVARD(Bool, hw_hightile, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable hightile texture rendering")
|
||||||
CVARD(Bool, hw_models, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable model rendering")
|
CVARD(Bool, hw_models, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable model rendering")
|
||||||
CVARD(Bool, hw_parallaxskypanning, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable parallaxed floor/ceiling panning when drawing a parallaxing sky")
|
CVARD(Bool, hw_parallaxskypanning, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable parallaxed floor/ceiling panning when drawing a parallaxing sky")
|
||||||
CVARD(Bool, hw_shadeinterpolate, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable shade interpolation")
|
|
||||||
CVARD(Float, hw_shadescale, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "multiplier for shading")
|
CVARD(Float, hw_shadescale, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "multiplier for shading")
|
||||||
bool hw_int_useindexedcolortextures;
|
bool hw_int_useindexedcolortextures;
|
||||||
CUSTOM_CVARD(Bool, hw_useindexedcolortextures, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable indexed color texture rendering")
|
CUSTOM_CVARD(Bool, hw_useindexedcolortextures, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable indexed color texture rendering")
|
||||||
{
|
{
|
||||||
hw_int_useindexedcolortextures = self;
|
|
||||||
if (screen) screen->SetTextureFilterMode();
|
if (screen) screen->SetTextureFilterMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +377,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
|
|
||||||
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
|
int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
|
||||||
GLInterface.SetFade(globalfloorpal);
|
GLInterface.SetFade(globalfloorpal);
|
||||||
bool success = GLInterface.SetTexture(globalpicnum, tileGetTexture(globalpicnum), palid, sampleroverride);
|
bool success = GLInterface.SetTexture(tileGetTexture(globalpicnum), palid, sampleroverride);
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
tsiz.x = tsiz.y = 1;
|
tsiz.x = tsiz.y = 1;
|
||||||
|
@ -461,7 +459,6 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
}
|
}
|
||||||
GLInterface.Draw(DT_TriangleFan, data.second, npoints);
|
GLInterface.Draw(DT_TriangleFan, data.second, npoints);
|
||||||
|
|
||||||
GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
|
|
||||||
GLInterface.SetNpotEmulation(0.f, 0.f);
|
GLInterface.SetNpotEmulation(0.f, 0.f);
|
||||||
GLInterface.SetTextureMode(TM_NORMAL);
|
GLInterface.SetTextureMode(TM_NORMAL);
|
||||||
|
|
||||||
|
@ -2489,8 +2486,6 @@ void polymost_drawrooms()
|
||||||
ghoriz = FixedToFloat(qglobalhoriz);
|
ghoriz = FixedToFloat(qglobalhoriz);
|
||||||
ghorizcorrect = FixedToFloat(divscale16(xdimenscale, viewingrange));
|
ghorizcorrect = FixedToFloat(divscale16(xdimenscale, viewingrange));
|
||||||
|
|
||||||
GLInterface.SetShadeInterpolate(hw_shadeinterpolate);
|
|
||||||
|
|
||||||
//global cos/sin height angle
|
//global cos/sin height angle
|
||||||
if (r_yshearing)
|
if (r_yshearing)
|
||||||
{
|
{
|
||||||
|
@ -3604,7 +3599,9 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
|
||||||
//Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
|
//Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
|
||||||
hicprecaching = 1;
|
hicprecaching = 1;
|
||||||
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
|
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
|
||||||
GLInterface.SetTexture(dapicnum, tileGetTexture(dapicnum), palid, CLAMP_NONE);
|
auto tex = tileGetTexture(dapicnum);
|
||||||
|
if (tex->isValid())
|
||||||
|
GLInterface.SetTexture(tex, palid, CLAMP_NONE);
|
||||||
hicprecaching = 0;
|
hicprecaching = 0;
|
||||||
|
|
||||||
if (datype == 0 || !hw_models) return;
|
if (datype == 0 || !hw_models) return;
|
||||||
|
@ -3619,7 +3616,7 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
|
||||||
{
|
{
|
||||||
auto tex = mdloadskin((md2model_t *)models[mid], 0, dapalnum, i, nullptr);
|
auto tex = mdloadskin((md2model_t *)models[mid], 0, dapalnum, i, nullptr);
|
||||||
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
|
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
|
||||||
if (tex) GLInterface.SetTexture(-1, tex, palid, CLAMP_NONE);
|
if (tex) GLInterface.SetTexture(tex, palid, CLAMP_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1151,16 +1151,8 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr)
|
||||||
|
|
||||||
GLInterface.SetPalswap(globalpal);
|
GLInterface.SetPalswap(globalpal);
|
||||||
GLInterface.SetFade(sector[tspr->sectnum].floorpal);
|
GLInterface.SetFade(sector[tspr->sectnum].floorpal);
|
||||||
// The texture here is already translated.
|
// The texture here is already translated.
|
||||||
GLInterface.SetTexture(-1, htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, CLAMP_NOFILTER_XY, true);
|
GLInterface.SetTexture(htex, 0/*TRANSLATION(Translation_Remap + curbasepal, globalpal)*/, CLAMP_NOFILTER_XY, true);
|
||||||
|
|
||||||
// This must be done after setting up the texture.
|
|
||||||
auto& h = lookups.tables[globalpal];
|
|
||||||
if (h.tintFlags & (TINTF_USEONART|TINTF_ALWAYSUSEART))
|
|
||||||
GLInterface.SetTinting(h.tintFlags, h.tintColor, h.tintColor);
|
|
||||||
else
|
|
||||||
GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto data = screen->mVertexData->AllocVertices(m->qcnt * 6);
|
auto data = screen->mVertexData->AllocVertices(m->qcnt * 6);
|
||||||
|
@ -1216,7 +1208,6 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr)
|
||||||
}
|
}
|
||||||
GLInterface.SetIdentityMatrix(Matrix_Model);
|
GLInterface.SetIdentityMatrix(Matrix_Model);
|
||||||
GLInterface.SetFadeDisable(false);
|
GLInterface.SetFadeDisable(false);
|
||||||
GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct SystemCallbacks
|
||||||
void (*MenuClosed)();
|
void (*MenuClosed)();
|
||||||
bool (*CheckMenudefOption)(const char* opt);
|
bool (*CheckMenudefOption)(const char* opt);
|
||||||
void (*ConsoleToggled)(int state);
|
void (*ConsoleToggled)(int state);
|
||||||
bool (*PreBindTexture)(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& clampmode, int& translation, int& overrideshader);
|
bool (*PreBindTexture)(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SystemCallbacks sysCallbacks;
|
extern SystemCallbacks sysCallbacks;
|
||||||
|
|
|
@ -586,11 +586,13 @@ private:
|
||||||
public:
|
public:
|
||||||
void SetMaterial(FGameTexture* tex, EUpscaleFlags upscalemask, int scaleflags, int clampmode, int translation, int overrideshader)
|
void SetMaterial(FGameTexture* tex, EUpscaleFlags upscalemask, int scaleflags, int clampmode, int translation, int overrideshader)
|
||||||
{
|
{
|
||||||
if (sysCallbacks.PreBindTexture && !sysCallbacks.PreBindTexture(this, tex, upscalemask, clampmode, translation, overrideshader))
|
if (!sysCallbacks.PreBindTexture || !sysCallbacks.PreBindTexture(this, tex, upscalemask, scaleflags, clampmode, translation, overrideshader))
|
||||||
{
|
{
|
||||||
if (shouldUpscale(tex, upscalemask)) scaleflags |= CTF_Upscale;
|
if (shouldUpscale(tex, upscalemask)) scaleflags |= CTF_Upscale;
|
||||||
}
|
}
|
||||||
SetMaterial(FMaterial::ValidateTexture(tex, scaleflags), clampmode, translation, overrideshader);
|
auto mat = FMaterial::ValidateTexture(tex, scaleflags);
|
||||||
|
assert(mat);
|
||||||
|
SetMaterial(mat, clampmode, translation, overrideshader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetClipSplit(float bottom, float top)
|
void SetClipSplit(float bottom, float top)
|
||||||
|
|
|
@ -131,6 +131,7 @@ void I_DetectOS(void);
|
||||||
void LoadScripts();
|
void LoadScripts();
|
||||||
void MainLoop();
|
void MainLoop();
|
||||||
void SetConsoleNotifyBuffer();
|
void SetConsoleNotifyBuffer();
|
||||||
|
bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
||||||
|
|
||||||
DBaseStatusBar* StatusBar;
|
DBaseStatusBar* StatusBar;
|
||||||
|
|
||||||
|
@ -521,7 +522,9 @@ int GameMain()
|
||||||
validFilter,
|
validFilter,
|
||||||
StrTable_GetGender,
|
StrTable_GetGender,
|
||||||
System_MenuClosed,
|
System_MenuClosed,
|
||||||
nullptr
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
PreBindTexture
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -48,6 +48,10 @@
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "gamestruct.h"
|
#include "gamestruct.h"
|
||||||
|
|
||||||
|
#include "hw_renderstate.h"
|
||||||
|
|
||||||
|
CVARD(Bool, hw_shadeinterpolate, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable shade interpolation")
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MAXARTFILES_BASE = 200,
|
MAXARTFILES_BASE = 200,
|
||||||
|
@ -1237,3 +1241,52 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TileFiles, GetTexture, GetTexture)
|
||||||
ACTION_RETURN_INT(GetTexture(tile, animate));
|
ACTION_RETURN_INT(GetTexture(tile, animate));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader)
|
||||||
|
{
|
||||||
|
TexturePick pick;
|
||||||
|
auto t = tex;
|
||||||
|
|
||||||
|
if (PickTexture(-1, tex, translation, pick))
|
||||||
|
{
|
||||||
|
int TextureType = (pick.translation & 0x80000000) ? TT_INDEXED : TT_TRUECOLOR;
|
||||||
|
int lookuppal = pick.translation & 0x7fffffff;
|
||||||
|
|
||||||
|
if (pick.translation & 0x80000000) scaleflags |= CTF_Indexed;
|
||||||
|
tex = pick.texture;
|
||||||
|
translation = lookuppal;
|
||||||
|
|
||||||
|
FVector4 addcol(0, 0, 0, 0);
|
||||||
|
FVector4 modcol(pick.basepalTint.r * (1.f / 255.f), pick.basepalTint.g * (1.f / 255.f), pick.basepalTint.b * (1.f / 255.f), 1);
|
||||||
|
FVector4 blendcol(0, 0, 0, 0);
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
|
if (pick.basepalTint != 0xffffff) flags |= TextureManipulation::ActiveBit;
|
||||||
|
if (pick.tintFlags != -1)
|
||||||
|
{
|
||||||
|
flags |= TextureManipulation::ActiveBit;
|
||||||
|
if (pick.tintFlags & TINTF_COLORIZE)
|
||||||
|
{
|
||||||
|
modcol.X *= pick.tintColor.r * (1.f / 64.f);
|
||||||
|
modcol.Y *= pick.tintColor.g * (1.f / 64.f);
|
||||||
|
modcol.Z *= pick.tintColor.b * (1.f / 64.f);
|
||||||
|
}
|
||||||
|
if (pick.tintFlags & TINTF_GRAYSCALE)
|
||||||
|
modcol.W = 1.f;
|
||||||
|
|
||||||
|
if (pick.tintFlags & TINTF_INVERT)
|
||||||
|
flags |= TextureManipulation::InvertBit;
|
||||||
|
|
||||||
|
if (pick.tintFlags & TINTF_BLENDMASK)
|
||||||
|
{
|
||||||
|
blendcol = modcol; // WTF???, but the tinting code really uses the same color for both!
|
||||||
|
flags |= (((pick.tintFlags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addcol.W = flags;
|
||||||
|
if ((pick.translation & 0x80000000) && hw_shadeinterpolate) addcol.W += 16384; // hijack a free bit in here.
|
||||||
|
state->SetTextureColors(&modcol.X, &addcol.X, &blendcol.X);
|
||||||
|
}
|
||||||
|
return tex->GetTexelWidth() > t->GetTexelWidth() && tex->GetTexelHeight() > t->GetTexelHeight(); // returning 'true' means to disable programmatic upscaling.
|
||||||
|
}
|
||||||
|
|
|
@ -502,7 +502,6 @@ void displayrooms(int snum, double smoothratio)
|
||||||
if (sect < 0 || sect >= MAXSECTORS) return;
|
if (sect < 0 || sect >= MAXSECTORS) return;
|
||||||
|
|
||||||
GLInterface.SetMapFog(fogactive != 0);
|
GLInterface.SetMapFog(fogactive != 0);
|
||||||
if (fogactive) hw_int_useindexedcolortextures = false;
|
|
||||||
dointerpolations(smoothratio);
|
dointerpolations(smoothratio);
|
||||||
|
|
||||||
setgamepalette(BASEPAL);
|
setgamepalette(BASEPAL);
|
||||||
|
@ -659,7 +658,6 @@ void displayrooms(int snum, double smoothratio)
|
||||||
}
|
}
|
||||||
else p->visibility = ud.const_visibility;
|
else p->visibility = ud.const_visibility;
|
||||||
}
|
}
|
||||||
if (fogactive) hw_int_useindexedcolortextures = hw_useindexedcolortextures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameInterface::GenerateSavePic()
|
bool GameInterface::GenerateSavePic()
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "../../glbackend/glbackend.h"
|
#include "../../glbackend/glbackend.h"
|
||||||
#include "texturemanager.h"
|
#include "texturemanager.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
@ -56,8 +57,12 @@ CVAR(Int, fixpalette, -1, 0)
|
||||||
CVAR(Int, fixpalswap, -1, 0)
|
CVAR(Int, fixpalswap, -1, 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sampler, bool notindexed)
|
bool GLInstance::SetTexture(FGameTexture* tex, int paletteid, int sampler, bool notindexed)
|
||||||
{
|
{
|
||||||
|
if (!tex->isValid())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
int basepal = GetTranslationType(paletteid) - Translation_Remap;
|
int basepal = GetTranslationType(paletteid) - Translation_Remap;
|
||||||
int translation = GetTranslationIndex(paletteid);
|
int translation = GetTranslationIndex(paletteid);
|
||||||
|
@ -66,23 +71,15 @@ bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sa
|
||||||
paletteid = TRANSLATION(Translation_Remap + usepalette, usepalswap);
|
paletteid = TRANSLATION(Translation_Remap + usepalette, usepalswap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TexturePick texpick;
|
SetPalswap(GetTranslationIndex(paletteid));
|
||||||
if (!PickTexture(picnum, tex, paletteid, texpick)) return false;
|
|
||||||
|
|
||||||
int TextureType = (texpick.translation & 0x80000000) ? TT_INDEXED : TT_TRUECOLOR;
|
|
||||||
|
|
||||||
// This is intentionally the same value for both parameters. The shader does not use the same uniform for modulation and overlay colors.
|
|
||||||
SetTinting(texpick.tintFlags, texpick.tintColor, texpick.tintColor);
|
|
||||||
int lookuppal = texpick.translation & 0x7fffffff;
|
|
||||||
SetPalswap(GetTranslationIndex(lookuppal));
|
|
||||||
|
|
||||||
SetBasepalTint(texpick.basepalTint);
|
|
||||||
auto &mat = renderState.mMaterial;
|
auto &mat = renderState.mMaterial;
|
||||||
mat.mTexture = texpick.texture;
|
assert(tex->isValid());
|
||||||
|
mat.mTexture = tex;
|
||||||
mat.uFlags = UF_None;
|
mat.uFlags = UF_None;
|
||||||
mat.mScaleFlags = (TextureType == TT_INDEXED) ? CTF_Indexed : 0;
|
mat.mScaleFlags = 0;
|
||||||
mat.mClampMode = sampler;
|
mat.mClampMode = sampler;
|
||||||
mat.mTranslation = texpick.translation;
|
mat.mTranslation = paletteid;
|
||||||
mat.mOverrideShader = -1;
|
mat.mOverrideShader = -1;
|
||||||
mat.mChanged = true;
|
mat.mChanged = true;
|
||||||
GLInterface.SetAlphaThreshold(tex->alphaThreshold);
|
GLInterface.SetAlphaThreshold(tex->alphaThreshold);
|
||||||
|
|
|
@ -106,6 +106,8 @@ void GLInstance::DoDraw()
|
||||||
|
|
||||||
if (rendercommands.Size() > 0)
|
if (rendercommands.Size() > 0)
|
||||||
{
|
{
|
||||||
|
if (!useMapFog) hw_int_useindexedcolortextures = hw_useindexedcolortextures;
|
||||||
|
|
||||||
lastState.Flags = ~rendercommands[0].StateFlags; // Force ALL flags to be considered 'changed'.
|
lastState.Flags = ~rendercommands[0].StateFlags; // Force ALL flags to be considered 'changed'.
|
||||||
lastState.DepthFunc = INT_MIN; // Something totally invalid.
|
lastState.DepthFunc = INT_MIN; // Something totally invalid.
|
||||||
screen->RenderState()->EnableMultisampling(true);
|
screen->RenderState()->EnableMultisampling(true);
|
||||||
|
@ -117,6 +119,7 @@ void GLInstance::DoDraw()
|
||||||
}
|
}
|
||||||
renderState.Apply(*screen->RenderState(), lastState); // apply any pending change before returning.
|
renderState.Apply(*screen->RenderState(), lastState); // apply any pending change before returning.
|
||||||
rendercommands.Clear();
|
rendercommands.Clear();
|
||||||
|
hw_int_useindexedcolortextures = false;
|
||||||
}
|
}
|
||||||
matrixArray.Resize(1);
|
matrixArray.Resize(1);
|
||||||
}
|
}
|
||||||
|
@ -243,37 +246,6 @@ void PolymostRenderState::Apply(FRenderState& state, GLState& oldState)
|
||||||
state.SetNpotEmulation(NPOTEmulation.Y, NPOTEmulation.X);
|
state.SetNpotEmulation(NPOTEmulation.Y, NPOTEmulation.X);
|
||||||
state.AlphaFunc(Alpha_Greater, AlphaTest ? AlphaThreshold : -1.f);
|
state.AlphaFunc(Alpha_Greater, AlphaTest ? AlphaThreshold : -1.f);
|
||||||
|
|
||||||
FVector4 addcol(0, 0, 0, 0);
|
|
||||||
FVector4 modcol(fullscreenTint.r / 255.f, fullscreenTint.g / 255.f, fullscreenTint.b / 255.f, 1);
|
|
||||||
FVector4 blendcol(0, 0, 0, 0);
|
|
||||||
int flags = 0;
|
|
||||||
|
|
||||||
if (fullscreenTint != 0xffffff) flags |= 16;
|
|
||||||
if (hictint_flags != -1)
|
|
||||||
{
|
|
||||||
flags |= TextureManipulation::ActiveBit;
|
|
||||||
if (hictint_flags & TINTF_COLORIZE)
|
|
||||||
{
|
|
||||||
modcol.X *= hictint.r / 64.f;
|
|
||||||
modcol.Y *= hictint.g / 64.f;
|
|
||||||
modcol.Z *= hictint.b / 64.f;
|
|
||||||
}
|
|
||||||
if (hictint_flags & TINTF_GRAYSCALE)
|
|
||||||
modcol.W = 1.f;
|
|
||||||
|
|
||||||
if (hictint_flags & TINTF_INVERT)
|
|
||||||
flags |= TextureManipulation::InvertBit;
|
|
||||||
|
|
||||||
if (hictint_flags & TINTF_BLENDMASK)
|
|
||||||
{
|
|
||||||
blendcol = modcol; // WTF???, but the tinting code really uses the same color for both!
|
|
||||||
flags |= (((hictint_flags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addcol.W = flags;
|
|
||||||
if (Flags & RF_ShadeInterpolate) addcol.W += 16384; // hijack a free bit in here.
|
|
||||||
state.SetTextureColors(&modcol.X, &addcol.X, &blendcol.X);
|
|
||||||
|
|
||||||
if (matrixIndex[Matrix_Model] != -1)
|
if (matrixIndex[Matrix_Model] != -1)
|
||||||
{
|
{
|
||||||
state.EnableModelMatrix(true);
|
state.EnableModelMatrix(true);
|
||||||
|
|
|
@ -293,12 +293,6 @@ public:
|
||||||
renderState.NPOTEmulation.X = xOffset;
|
renderState.NPOTEmulation.X = xOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetShadeInterpolate(int32_t yes)
|
|
||||||
{
|
|
||||||
if (yes) renderState.Flags |= RF_ShadeInterpolate;
|
|
||||||
else renderState.Flags &= ~RF_ShadeInterpolate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFadeDisable(bool yes)
|
void SetFadeDisable(bool yes)
|
||||||
{
|
{
|
||||||
if (yes) renderState.Flags |= RF_FogDisabled;
|
if (yes) renderState.Flags |= RF_FogDisabled;
|
||||||
|
@ -324,18 +318,6 @@ public:
|
||||||
renderState.Flags &= ~RF_MapFog;
|
renderState.Flags &= ~RF_MapFog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTinting(int flags, PalEntry color, PalEntry overlayColor)
|
|
||||||
{
|
|
||||||
renderState.hictint = color;
|
|
||||||
renderState.hictint_overlay = overlayColor;
|
|
||||||
renderState.hictint_flags = flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetBasepalTint(PalEntry color)
|
|
||||||
{
|
|
||||||
renderState.fullscreenTint = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnableAlphaTest(bool on)
|
void EnableAlphaTest(bool on)
|
||||||
{
|
{
|
||||||
renderState.AlphaTest = on;
|
renderState.AlphaTest = on;
|
||||||
|
@ -346,7 +328,7 @@ public:
|
||||||
renderState.AlphaThreshold = al;
|
renderState.AlphaThreshold = al;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetTexture(int globalpicnum, FGameTexture* tex, int palette, int sampleroverride, bool notindexed = false);
|
bool SetTexture(FGameTexture* tex, int palette, int sampleroverride, bool notindexed = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GLInstance GLInterface;
|
extern GLInstance GLInterface;
|
||||||
|
|
|
@ -16,7 +16,6 @@ enum EMatrixType
|
||||||
enum PRSFlags
|
enum PRSFlags
|
||||||
{
|
{
|
||||||
RF_ColorOnly = 1,
|
RF_ColorOnly = 1,
|
||||||
RF_ShadeInterpolate = 64,
|
|
||||||
RF_FogDisabled = 128,
|
RF_FogDisabled = 128,
|
||||||
RF_MapFog = 256, // RRRA E2L1.
|
RF_MapFog = 256, // RRRA E2L1.
|
||||||
|
|
||||||
|
@ -78,8 +77,6 @@ struct PolymostRenderState
|
||||||
bool AlphaTest = true;
|
bool AlphaTest = true;
|
||||||
float Color[4] = { 1,1,1,1 };
|
float Color[4] = { 1,1,1,1 };
|
||||||
short matrixIndex[NUMMATRICES] = { -1 };
|
short matrixIndex[NUMMATRICES] = { -1 };
|
||||||
PalEntry fullscreenTint = 0xffffff, hictint = 0xffffff, hictint_overlay = 0xffffff;
|
|
||||||
int hictint_flags = -1;
|
|
||||||
FDepthBiasState mBias{ };
|
FDepthBiasState mBias{ };
|
||||||
PolymostTextureState mMaterial;
|
PolymostTextureState mMaterial;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue