mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-13 22:42:07 +00:00
use FTranslationID in the high level parts of the hardware renderer.
This commit is contained in:
parent
c426094d54
commit
9f90c64727
11 changed files with 27 additions and 16 deletions
|
@ -187,6 +187,11 @@ public:
|
|||
void CopyTranslation(FTranslationID dest, FTranslationID src);
|
||||
FTranslationID StoreTranslation(int slot, FRemapTable* remap);
|
||||
FRemapTable* TranslationToTable(int translation) const;
|
||||
FRemapTable* TranslationToTable(FTranslationID translation) const
|
||||
{
|
||||
return TranslationToTable(translation.index());
|
||||
}
|
||||
|
||||
void GenerateGlobalBrightmapFromColormap(const uint8_t* cmapdata, int numlevels);
|
||||
|
||||
void PushIdentityTable(int slot)
|
||||
|
|
|
@ -635,6 +635,12 @@ public:
|
|||
SetMaterial(mat, clampmode, translation, overrideshader);
|
||||
}
|
||||
|
||||
void SetMaterial(FGameTexture* tex, EUpscaleFlags upscalemask, int scaleflags, int clampmode, FTranslationID translation, int overrideshader)
|
||||
{
|
||||
SetMaterial(tex, upscalemask, scaleflags, clampmode, translation.index(), overrideshader);
|
||||
}
|
||||
|
||||
|
||||
void SetClipSplit(float bottom, float top)
|
||||
{
|
||||
mClipSplit[0] = bottom;
|
||||
|
|
|
@ -118,7 +118,7 @@ void FHWModelRenderer::SetInterpolation(double inter)
|
|||
|
||||
void FHWModelRenderer::SetMaterial(FGameTexture *skin, bool clampNoFilter, FTranslationID translation)
|
||||
{
|
||||
state.SetMaterial(skin, UF_Skin, 0, clampNoFilter ? CLAMP_NOFILTER : CLAMP_NONE, translation.index(), -1);
|
||||
state.SetMaterial(skin, UF_Skin, 0, clampNoFilter ? CLAMP_NOFILTER : CLAMP_NONE, translation, -1);
|
||||
state.SetLightIndex(modellightindex);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void HWDecal::DrawDecal(HWDrawInfo *di, FRenderState &state)
|
|||
|
||||
state.SetTextureMode(decal->RenderStyle);
|
||||
state.SetRenderStyle(decal->RenderStyle);
|
||||
state.SetMaterial(texture, UF_Sprite, 0, CLAMP_XY, decal->Translation.index(), -1);
|
||||
state.SetMaterial(texture, UF_Sprite, 0, CLAMP_XY, decal->Translation, -1);
|
||||
|
||||
|
||||
// If srcalpha is one it looks better with a higher alpha threshold
|
||||
|
|
|
@ -368,7 +368,7 @@ public:
|
|||
FRenderStyle RenderStyle;
|
||||
int OverrideShader;
|
||||
|
||||
int translation;
|
||||
FTranslationID translation;
|
||||
int index;
|
||||
float depth;
|
||||
int vertexindex;
|
||||
|
|
|
@ -214,7 +214,7 @@ void HWFlat::DrawSubsectors(HWDrawInfo *di, FRenderState &state)
|
|||
|
||||
void HWFlat::DrawOtherPlanes(HWDrawInfo *di, FRenderState &state)
|
||||
{
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, 0, -1);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, NO_TRANSLATION, -1);
|
||||
|
||||
// Draw the subsectors assigned to it due to missing textures
|
||||
auto pNode = (renderflags&SSRF_RENDERFLOOR) ?
|
||||
|
@ -246,7 +246,7 @@ void HWFlat::DrawFloodPlanes(HWDrawInfo *di, FRenderState &state)
|
|||
// This requires a stencil because the projected plane interferes with
|
||||
// the depth buffer
|
||||
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, 0, -1);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, NO_TRANSLATION, -1);
|
||||
|
||||
// Draw the subsectors assigned to it due to missing textures
|
||||
auto pNode = (renderflags&SSRF_RENDERFLOOR) ?
|
||||
|
@ -334,14 +334,14 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
{
|
||||
if (sector->special != GLSector_Skybox)
|
||||
{
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, 0, -1);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, NO_TRANSLATION, -1);
|
||||
SetPlaneTextureRotation(state, &plane, texture);
|
||||
DrawSubsectors(di, state);
|
||||
state.EnableTextureMatrix(false);
|
||||
}
|
||||
else if (!hacktype)
|
||||
{
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_XY, 0, -1);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_XY, NO_TRANSLATION, -1);
|
||||
state.SetLightIndex(dynlightindex);
|
||||
state.Draw(DT_TriangleStrip,iboindex, 4);
|
||||
flatvertices += 4;
|
||||
|
@ -362,7 +362,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
{
|
||||
if (!texture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_threshold);
|
||||
else state.AlphaFunc(Alpha_GEqual, 0.f);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, 0, -1);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, NO_TRANSLATION, -1);
|
||||
SetPlaneTextureRotation(state, &plane, texture);
|
||||
DrawSubsectors(di, state);
|
||||
state.EnableTextureMatrix(false);
|
||||
|
|
|
@ -984,7 +984,7 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
|
||||
|
||||
state.EnableBrightmap(true);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, 0, -1);
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_NONE, NO_TRANSLATION, -1);
|
||||
state.SetObjectColor(origin->specialcolor);
|
||||
|
||||
SetPlaneTextureRotation(state, sp, texture);
|
||||
|
|
|
@ -1077,7 +1077,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
}
|
||||
}
|
||||
|
||||
translation = thing->Translation.index();
|
||||
translation = thing->Translation;
|
||||
|
||||
OverrideShader = -1;
|
||||
trans = thing->Alpha;
|
||||
|
@ -1326,7 +1326,7 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
|
|||
|
||||
if (lump.isValid())
|
||||
{
|
||||
translation = 0;
|
||||
translation = NO_TRANSLATION;
|
||||
//auto tex = TexMan.GetGameTexture(lump, false);
|
||||
|
||||
ul = 0;
|
||||
|
|
|
@ -135,7 +135,7 @@ void HWWall::RenderMirrorSurface(HWWallDispatcher*di, FRenderState &state)
|
|||
state.AlphaFunc(Alpha_Greater, 0);
|
||||
|
||||
auto tex = TexMan.GetGameTexture(TexMan.mirrorTexture, false);
|
||||
state.SetMaterial(tex, UF_None, 0, CLAMP_NONE, 0, -1); // do not upscale the mirror texture.
|
||||
state.SetMaterial(tex, UF_None, 0, CLAMP_NONE, NO_TRANSLATION, -1); // do not upscale the mirror texture.
|
||||
|
||||
flags &= ~HWWall::HWF_GLOW;
|
||||
RenderWall(state, HWWall::RWF_BLANK);
|
||||
|
@ -191,7 +191,7 @@ void HWWall::RenderTexturedWall(HWWallDispatcher*di, FRenderState &state, int rf
|
|||
state.SetGlowParams(topglowcolor, bottomglowcolor);
|
||||
SetGlowPlanes(state, frontsector->ceilingplane, frontsector->floorplane);
|
||||
}
|
||||
state.SetMaterial(texture, UF_Texture, 0, flags & 3, 0, -1);
|
||||
state.SetMaterial(texture, UF_Texture, 0, flags & 3, NO_TRANSLATION, -1);
|
||||
#ifdef NPOT_EMULATION
|
||||
// Test code, could be reactivated as a compatibility option in the unlikely event that some old vanilla map eve needs it.
|
||||
if (hw_npottest)
|
||||
|
|
|
@ -98,8 +98,8 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
|
|||
{
|
||||
float thresh = (huds->texture->GetTranslucency() || huds->OverrideShader != -1) ? 0.f : gl_mask_sprite_threshold;
|
||||
state.AlphaFunc(Alpha_GEqual, thresh);
|
||||
uint32_t trans = huds->weapon->GetTranslation().index();
|
||||
if ((huds->weapon->Flags & PSPF_PLAYERTRANSLATED)) trans = huds->owner->Translation.index();
|
||||
FTranslationID trans = huds->weapon->GetTranslation();
|
||||
if ((huds->weapon->Flags & PSPF_PLAYERTRANSLATED)) trans = huds->owner->Translation;
|
||||
state.SetMaterial(huds->texture, UF_Sprite, CTF_Expand, CLAMP_XY_NOMIP, trans, huds->OverrideShader);
|
||||
state.Draw(DT_TriangleStrip, huds->mx, 4);
|
||||
}
|
||||
|
|
|
@ -469,7 +469,7 @@ namespace swrenderer
|
|||
SetTranslationMap(nullptr);
|
||||
if (translation != NO_TRANSLATION)
|
||||
{
|
||||
FRemapTable *table = GPalette.TranslationToTable(translation.index());
|
||||
FRemapTable *table = GPalette.TranslationToTable(translation);
|
||||
if (table != NULL)
|
||||
{
|
||||
if (viewport->RenderTarget->IsBgra())
|
||||
|
|
Loading…
Reference in a new issue