mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-13 22:42:07 +00:00
use translation IDs in the software renderer.
This commit is contained in:
parent
c5c822ea75
commit
c426094d54
11 changed files with 27 additions and 29 deletions
|
@ -241,7 +241,7 @@ namespace swrenderer
|
|||
cmlight.SetColormap(thread, MINZ, light.GetLightLevel(), light.GetFoggy(), usecolormap, decal->RenderFlags & RF_FULLBRIGHT, false, false, false, false);
|
||||
|
||||
SpriteDrawerArgs drawerargs;
|
||||
bool visible = drawerargs.SetStyle(thread->Viewport.get(), decal->RenderStyle, (float)decal->Alpha, decal->Translation.index(), decal->AlphaColor, cmlight);
|
||||
bool visible = drawerargs.SetStyle(thread->Viewport.get(), decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor, cmlight);
|
||||
if (visible)
|
||||
{
|
||||
drawerargs.DrawMasked(thread, zpos + WallSpriteTile->GetTopOffset(0) * decal->ScaleY, decal->ScaleY, decal->RenderFlags & RF_XFLIP, decal->RenderFlags & RF_YFLIP, WallC, clipper->x1, clipper->x2, light, WallSpriteTile, mfloorclip, mceilingclip, decal->RenderStyle);
|
||||
|
|
|
@ -307,9 +307,9 @@ namespace swrenderer
|
|||
vis.yscale = float(pspriteyscale / stex->GetScale().Y);
|
||||
vis.pic = stex;
|
||||
|
||||
uint32_t trans = pspr->GetTranslation().index();
|
||||
if ((pspr->Flags & PSPF_PLAYERTRANSLATED)) trans = owner->Translation.index();
|
||||
vis.Translation = trans;
|
||||
auto itrans = pspr->GetTranslation();
|
||||
if ((pspr->Flags & PSPF_PLAYERTRANSLATED)) itrans = owner->Translation;
|
||||
vis.Translation = itrans;
|
||||
|
||||
// If flip is used, provided that it's not already flipped (that would just invert itself)
|
||||
// (It's an XOR...)
|
||||
|
@ -432,7 +432,7 @@ namespace swrenderer
|
|||
accelSprite.x1 = x1;
|
||||
accelSprite.flip = vis.xiscale < 0;
|
||||
|
||||
accelSprite.Translation = trans;
|
||||
accelSprite.Translation = itrans;
|
||||
|
||||
if (vis.Light.BaseColormap >= &SpecialSWColormaps[0] &&
|
||||
vis.Light.BaseColormap < &SpecialSWColormaps[SpecialColormaps.Size()])
|
||||
|
@ -468,7 +468,7 @@ namespace swrenderer
|
|||
viewwindowy + viewheight / 2 - sprite.texturemid * sprite.yscale - 0.5,
|
||||
DTA_DestWidthF, FIXED2DBL(sprite.pic->GetWidth() * sprite.xscale),
|
||||
DTA_DestHeightF, sprite.pic->GetHeight() * sprite.yscale,
|
||||
DTA_TranslationIndex, sprite.Translation,
|
||||
DTA_TranslationIndex, sprite.Translation.index(),
|
||||
DTA_FlipX, sprite.flip,
|
||||
DTA_TopOffset, 0,
|
||||
DTA_LeftOffset, 0,
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "r_visiblesprite.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "palettecontainer.h"
|
||||
|
||||
class DPSprite;
|
||||
|
||||
|
@ -46,7 +47,7 @@ namespace swrenderer
|
|||
|
||||
float Alpha = 0.0f;
|
||||
FRenderStyle RenderStyle;
|
||||
uint32_t Translation = 0;
|
||||
FTranslationID Translation = NO_TRANSLATION;
|
||||
uint32_t FillColor = 0;
|
||||
|
||||
ColormapLight Light;
|
||||
|
@ -66,7 +67,7 @@ namespace swrenderer
|
|||
|
||||
float Alpha = 0.0f;
|
||||
FRenderStyle RenderStyle;
|
||||
uint32_t Translation = 0;
|
||||
FTranslationID Translation = NO_TRANSLATION; // this gets passed to the 2D code which works with high level IDs.
|
||||
uint32_t FillColor = 0;
|
||||
|
||||
FDynamicColormap *basecolormap = nullptr;
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace swrenderer
|
|||
vis->RenderStyle = LegacyRenderStyles[STYLE_Normal];
|
||||
}
|
||||
vis->FillColor = thing->fillcolor;
|
||||
vis->Translation = thing->Translation.index(); // [RH] thing translation table
|
||||
vis->Translation = thing->Translation; // [RH] thing translation table
|
||||
vis->FakeFlatStat = fakeside;
|
||||
vis->Alpha = float(thing->Alpha);
|
||||
vis->fakefloor = fakefloor;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace swrenderer
|
|||
FWallCoords wallc;
|
||||
double SpriteScale;
|
||||
|
||||
uint32_t Translation = 0;
|
||||
FTranslationID Translation = NO_TRANSLATION;
|
||||
uint32_t FillColor = 0;
|
||||
|
||||
uint32_t dynlightcolor = 0;
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace swrenderer
|
|||
vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
||||
vis->RenderStyle = thing->RenderStyle;
|
||||
vis->FillColor = thing->fillcolor;
|
||||
vis->Translation = thing->Translation.index(); // [RH] thing translation table
|
||||
vis->Translation = thing->Translation; // [RH] thing translation table
|
||||
vis->FakeFlatStat = fakeside;
|
||||
vis->Alpha = float(thing->Alpha);
|
||||
vis->fakefloor = fakefloor;
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace swrenderer
|
|||
FVoxel *voxel = nullptr;
|
||||
bool bInMirror = false;
|
||||
|
||||
uint32_t Translation = 0;
|
||||
FTranslationID Translation = NO_TRANSLATION;
|
||||
uint32_t FillColor = 0;
|
||||
|
||||
enum { DVF_OFFSCREEN = 1, DVF_SPANSONLY = 2, DVF_MIRRORED = 4, DVF_FIND_X1X2 = 8 };
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace swrenderer
|
|||
if (thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D
|
||||
vis->RenderStyle = thing->RenderStyle;
|
||||
vis->FillColor = thing->fillcolor;
|
||||
vis->Translation = thing->Translation.index();
|
||||
vis->Translation = thing->Translation;
|
||||
vis->FakeFlatStat = WaterFakeSide::Center;
|
||||
vis->Alpha = float(thing->Alpha);
|
||||
vis->fakefloor = NULL;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace swrenderer
|
|||
|
||||
private:
|
||||
FWallCoords wallc;
|
||||
uint32_t Translation = 0;
|
||||
FTranslationID Translation = NO_TRANSLATION;
|
||||
uint32_t FillColor = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ namespace swrenderer
|
|||
}
|
||||
}
|
||||
|
||||
bool SpriteDrawerArgs::SetStyle(RenderViewport *viewport, FRenderStyle style, fixed_t alpha, int translation, uint32_t color, const ColormapLight &light)
|
||||
bool SpriteDrawerArgs::SetStyle(RenderViewport *viewport, FRenderStyle style, fixed_t alpha, FTranslationID translation, uint32_t color, const ColormapLight &light)
|
||||
{
|
||||
if (light.BaseColormap)
|
||||
SetLight(light);
|
||||
|
@ -466,19 +466,16 @@ namespace swrenderer
|
|||
alpha = clamp<fixed_t>(alpha, 0, OPAQUE);
|
||||
}
|
||||
|
||||
if (translation != -1)
|
||||
SetTranslationMap(nullptr);
|
||||
if (translation != NO_TRANSLATION)
|
||||
{
|
||||
SetTranslationMap(nullptr);
|
||||
if (translation != 0)
|
||||
FRemapTable *table = GPalette.TranslationToTable(translation.index());
|
||||
if (table != NULL)
|
||||
{
|
||||
FRemapTable *table = GPalette.TranslationToTable(translation);
|
||||
if (table != NULL && !table->Inactive)
|
||||
{
|
||||
if (viewport->RenderTarget->IsBgra())
|
||||
SetTranslationMap((uint8_t*)table->Palette);
|
||||
else
|
||||
SetTranslationMap(table->Remap);
|
||||
}
|
||||
if (viewport->RenderTarget->IsBgra())
|
||||
SetTranslationMap((uint8_t*)table->Palette);
|
||||
else
|
||||
SetTranslationMap(table->Remap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,7 +544,7 @@ namespace swrenderer
|
|||
return SpriteDrawerArgs::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags);
|
||||
}
|
||||
|
||||
bool SpriteDrawerArgs::SetStyle(RenderViewport *viewport, FRenderStyle style, float alpha, int translation, uint32_t color, const ColormapLight &light)
|
||||
bool SpriteDrawerArgs::SetStyle(RenderViewport *viewport, FRenderStyle style, float alpha, FTranslationID translation, uint32_t color, const ColormapLight &light)
|
||||
{
|
||||
return SetStyle(viewport, style, FLOAT2FIXED(alpha), translation, color, light);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace swrenderer
|
|||
public:
|
||||
SpriteDrawerArgs();
|
||||
|
||||
bool SetStyle(RenderViewport *viewport, FRenderStyle style, fixed_t alpha, int translation, uint32_t color, const ColormapLight &light);
|
||||
bool SetStyle(RenderViewport *viewport, FRenderStyle style, float alpha, int translation, uint32_t color, const ColormapLight &light);
|
||||
bool SetStyle(RenderViewport *viewport, FRenderStyle style, fixed_t alpha, FTranslationID translation, uint32_t color, const ColormapLight &light);
|
||||
bool SetStyle(RenderViewport *viewport, FRenderStyle style, float alpha, FTranslationID translation, uint32_t color, const ColormapLight &light);
|
||||
void SetSolidColor(int color) { dc_color = color; dc_color_bgra = GPalette.BaseColors[color]; }
|
||||
void SetDynamicLight(uint32_t color) { dynlightcolor = color; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue