mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
More psprite stuff
This commit is contained in:
parent
ecebeed296
commit
6e8174d9b4
1 changed files with 130 additions and 2 deletions
|
@ -32,6 +32,8 @@
|
||||||
EXTERN_CVAR(Bool, r_drawplayersprites)
|
EXTERN_CVAR(Bool, r_drawplayersprites)
|
||||||
EXTERN_CVAR(Bool, r_deathcamera)
|
EXTERN_CVAR(Bool, r_deathcamera)
|
||||||
EXTERN_CVAR(Bool, st_scale)
|
EXTERN_CVAR(Bool, st_scale)
|
||||||
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||||
|
EXTERN_CVAR(Bool, r_shadercolormaps)
|
||||||
|
|
||||||
void RenderPolyPlayerSprites::Render()
|
void RenderPolyPlayerSprites::Render()
|
||||||
{
|
{
|
||||||
|
@ -219,7 +221,113 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
|
|
||||||
if (sprite->GetID() < PSP_TARGETCENTER)
|
if (sprite->GetID() < PSP_TARGETCENTER)
|
||||||
{
|
{
|
||||||
// Lots of complicated style and noaccel stuff
|
visstyle.Alpha = float(owner->Alpha);
|
||||||
|
visstyle.RenderStyle = owner->RenderStyle;
|
||||||
|
|
||||||
|
// The software renderer cannot invert the source without inverting the overlay
|
||||||
|
// too. That means if the source is inverted, we need to do the reverse of what
|
||||||
|
// the invert overlay flag says to do.
|
||||||
|
INTBOOL invertcolormap = (visstyle.RenderStyle.Flags & STYLEF_InvertOverlay);
|
||||||
|
|
||||||
|
if (visstyle.RenderStyle.Flags & STYLEF_InvertSource)
|
||||||
|
{
|
||||||
|
invertcolormap = !invertcolormap;
|
||||||
|
}
|
||||||
|
|
||||||
|
FDynamicColormap *mybasecolormap = basecolormap;
|
||||||
|
|
||||||
|
if (visstyle.RenderStyle.Flags & STYLEF_FadeToBlack)
|
||||||
|
{
|
||||||
|
if (invertcolormap)
|
||||||
|
{ // Fade to white
|
||||||
|
mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(255, 255, 255), mybasecolormap->Desaturate);
|
||||||
|
invertcolormap = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Fade to black
|
||||||
|
mybasecolormap = GetSpecialLights(mybasecolormap->Color, MAKERGB(0, 0, 0), mybasecolormap->Desaturate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (swrenderer::realfixedcolormap != nullptr && (!swrenderer::r_swtruecolor || (r_shadercolormaps && screen->Accel2D)))
|
||||||
|
{ // fixed color
|
||||||
|
visstyle.BaseColormap = swrenderer::realfixedcolormap;
|
||||||
|
visstyle.ColormapNum = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (invertcolormap)
|
||||||
|
{
|
||||||
|
mybasecolormap = GetSpecialLights(mybasecolormap->Color, mybasecolormap->Fade.InverseColor(), mybasecolormap->Desaturate);
|
||||||
|
}
|
||||||
|
if (swrenderer::fixedlightlev >= 0)
|
||||||
|
{
|
||||||
|
visstyle.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap;
|
||||||
|
visstyle.ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT;
|
||||||
|
}
|
||||||
|
else if (!foggy && sprite->GetState()->GetFullbright())
|
||||||
|
{ // full bright
|
||||||
|
visstyle.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap
|
||||||
|
visstyle.ColormapNum = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // local light
|
||||||
|
visstyle.BaseColormap = mybasecolormap;
|
||||||
|
visstyle.ColormapNum = GETPALOOKUP(0, spriteshade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (camera->Inventory != nullptr)
|
||||||
|
{
|
||||||
|
BYTE oldcolormapnum = visstyle.ColormapNum;
|
||||||
|
FSWColormap *oldcolormap = visstyle.BaseColormap;
|
||||||
|
camera->Inventory->AlterWeaponSprite(&visstyle);
|
||||||
|
if (visstyle.BaseColormap != oldcolormap || visstyle.ColormapNum != oldcolormapnum)
|
||||||
|
{
|
||||||
|
// The colormap has changed. Is it one we can easily identify?
|
||||||
|
// If not, then don't bother trying to identify it for
|
||||||
|
// hardware accelerated drawing.
|
||||||
|
if (visstyle.BaseColormap < &SpecialColormaps[0] ||
|
||||||
|
visstyle.BaseColormap > &SpecialColormaps.Last())
|
||||||
|
{
|
||||||
|
noaccel = true;
|
||||||
|
}
|
||||||
|
// Has the basecolormap changed? If so, we can't hardware accelerate it,
|
||||||
|
// since we don't know what it is anymore.
|
||||||
|
else if (visstyle.BaseColormap != mybasecolormap)
|
||||||
|
{
|
||||||
|
noaccel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If we're drawing with a special colormap, but shaders for them are disabled, do
|
||||||
|
// not accelerate.
|
||||||
|
if (!r_shadercolormaps && (visstyle.BaseColormap >= &SpecialColormaps[0] &&
|
||||||
|
visstyle.BaseColormap <= &SpecialColormaps.Last()))
|
||||||
|
{
|
||||||
|
noaccel = true;
|
||||||
|
}
|
||||||
|
// If drawing with a BOOM colormap, disable acceleration.
|
||||||
|
if (mybasecolormap == &NormalLight && NormalLight.Maps != realcolormaps.Maps)
|
||||||
|
{
|
||||||
|
noaccel = true;
|
||||||
|
}
|
||||||
|
// If the main colormap has fixed lights, and this sprite is being drawn with that
|
||||||
|
// colormap, disable acceleration so that the lights can remain fixed.
|
||||||
|
if (!noaccel && swrenderer::realfixedcolormap == nullptr &&
|
||||||
|
NormalLightHasFixedLights && mybasecolormap == &NormalLight &&
|
||||||
|
tex->UseBasePalette())
|
||||||
|
{
|
||||||
|
noaccel = true;
|
||||||
|
}
|
||||||
|
// [SP] If emulating GZDoom fullbright, disable acceleration
|
||||||
|
if (r_fullbrightignoresectorcolor && swrenderer::fixedlightlev >= 0)
|
||||||
|
mybasecolormap = &FullNormalLight;
|
||||||
|
if (r_fullbrightignoresectorcolor && !foggy && sprite->GetState()->GetFullbright())
|
||||||
|
mybasecolormap = &FullNormalLight;
|
||||||
|
colormap_to_use = mybasecolormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for hardware-assisted 2D. If it's available, and this sprite is not
|
// Check for hardware-assisted 2D. If it's available, and this sprite is not
|
||||||
|
@ -245,7 +353,27 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//R_DrawVisSprite(vis);
|
// To do: draw sprite same way as R_DrawVisSprite(vis) here
|
||||||
|
|
||||||
|
// Draw the fuzzy weapon:
|
||||||
|
FRenderStyle style = visstyle.RenderStyle;
|
||||||
|
style.CheckFuzz();
|
||||||
|
if (style.BlendOp == STYLEOP_Fuzz)
|
||||||
|
{
|
||||||
|
visstyle.RenderStyle = LegacyRenderStyles[STYLE_Shadow];
|
||||||
|
|
||||||
|
PolyScreenSprite screenSprite;
|
||||||
|
screenSprite.Pic = tex;
|
||||||
|
screenSprite.X1 = viewwindowx + x1;
|
||||||
|
screenSprite.Y1 = viewwindowy + viewheight / 2 - texturemid * yscale - 0.5;
|
||||||
|
screenSprite.Width = tex->GetWidth() * xscale;
|
||||||
|
screenSprite.Height = tex->GetHeight() * yscale;
|
||||||
|
screenSprite.Translation = TranslationToTable(translation);
|
||||||
|
screenSprite.Flip = xiscale < 0;
|
||||||
|
screenSprite.visstyle = visstyle;
|
||||||
|
screenSprite.Colormap = colormap_to_use;
|
||||||
|
ScreenSprites.push_back(screenSprite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyScreenSprite::Render()
|
void PolyScreenSprite::Render()
|
||||||
|
|
Loading…
Reference in a new issue