mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 23:41:48 +00:00
Added missing TranslateAlphaBlend and created a helper function for specifying the translation
This commit is contained in:
parent
17ed585c1f
commit
114fda1ed5
4 changed files with 36 additions and 2 deletions
|
@ -514,6 +514,10 @@ void DrawTriangleCodegen::ProcessPixel(SSAUBytePtr buffer, SSAIntPtr subsectorbu
|
||||||
fg = TranslateSample(uvoffset);
|
fg = TranslateSample(uvoffset);
|
||||||
output = blend_copy(shade_bgra_simple(fg, currentlight));
|
output = blend_copy(shade_bgra_simple(fg, currentlight));
|
||||||
break;
|
break;
|
||||||
|
case TriBlendMode::TranslateAlphaBlend:
|
||||||
|
fg = TranslateSample(uvoffset);
|
||||||
|
output = blend_alpha_blend(shade_bgra_simple(fg, currentlight), bg); break;
|
||||||
|
break;
|
||||||
case TriBlendMode::TranslateAdd:
|
case TriBlendMode::TranslateAdd:
|
||||||
fg = TranslateSample(uvoffset);
|
fg = TranslateSample(uvoffset);
|
||||||
output = blend_add(shade_bgra_simple(fg, currentlight), bg, srcalpha, calc_blend_bgalpha(fg, destalpha));
|
output = blend_add(shade_bgra_simple(fg, currentlight), bg, srcalpha, calc_blend_bgalpha(fg, destalpha));
|
||||||
|
|
|
@ -282,6 +282,7 @@ enum class TriBlendMode
|
||||||
RevSub, // blend_revsub(shade(fg), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
RevSub, // blend_revsub(shade(fg), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
||||||
Shaded, // blend_add(color, bg, fg.a, 1 - fg.a)
|
Shaded, // blend_add(color, bg, fg.a, 1 - fg.a)
|
||||||
TranslateCopy, // blend_copy(shade(translate(fg)))
|
TranslateCopy, // blend_copy(shade(translate(fg)))
|
||||||
|
TranslateAlphaBlend, // blend_alpha_blend(shade(translate(fg)), bg)
|
||||||
TranslateAdd, // blend_add(shade(translate(fg)), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
TranslateAdd, // blend_add(shade(translate(fg)), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
||||||
TranslateSub, // blend_sub(shade(translate(fg)), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
TranslateSub, // blend_sub(shade(translate(fg)), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
||||||
TranslateRevSub // blend_revsub(shade(translate(fg)), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
TranslateRevSub // blend_revsub(shade(translate(fg)), bg, srcalpha, calc_blend_bgalpha(fg, destalpha))
|
||||||
|
|
|
@ -135,8 +135,13 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, AActor *thing, subse
|
||||||
args.ccw = true;
|
args.ccw = true;
|
||||||
args.stenciltestvalue = 0;
|
args.stenciltestvalue = 0;
|
||||||
args.stencilwritevalue = 1;
|
args.stencilwritevalue = 1;
|
||||||
args.SetTexture(tex);
|
args.translation = nullptr;
|
||||||
PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::AlphaBlend);
|
args.SetTexture(tex, thing->Translation);
|
||||||
|
|
||||||
|
if (args.translation)
|
||||||
|
PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::TranslateAlphaBlend);
|
||||||
|
else
|
||||||
|
PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::AlphaBlend);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderPolySprite::IsThingCulled(AActor *thing)
|
bool RenderPolySprite::IsThingCulled(AActor *thing)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define __R_POLY_TRIANGLE__
|
#define __R_POLY_TRIANGLE__
|
||||||
|
|
||||||
#include "r_triangle.h"
|
#include "r_triangle.h"
|
||||||
|
#include "r_data/r_translate.h"
|
||||||
|
|
||||||
struct TriDrawTriangleArgs;
|
struct TriDrawTriangleArgs;
|
||||||
|
|
||||||
|
@ -51,6 +52,29 @@ public:
|
||||||
texturePixels = (const uint8_t *)texture->GetPixelsBgra();
|
texturePixels = (const uint8_t *)texture->GetPixelsBgra();
|
||||||
else
|
else
|
||||||
texturePixels = texture->GetPixels();
|
texturePixels = texture->GetPixels();
|
||||||
|
translation = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTexture(FTexture *texture, uint32_t translationID)
|
||||||
|
{
|
||||||
|
if (translationID != -1 && translationID != 0)
|
||||||
|
{
|
||||||
|
FRemapTable *table = TranslationToTable(translationID);
|
||||||
|
if (table != nullptr && !table->Inactive)
|
||||||
|
{
|
||||||
|
if (r_swtruecolor)
|
||||||
|
translation = (uint8_t*)table->Palette;
|
||||||
|
else
|
||||||
|
translation = table->Remap;
|
||||||
|
|
||||||
|
textureWidth = texture->GetWidth();
|
||||||
|
textureHeight = texture->GetHeight();
|
||||||
|
texturePixels = texture->GetPixels();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTexture(texture);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue