mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 13:31:07 +00:00
- Modify TriBlendMode enum to match the render styles
This commit is contained in:
parent
9fb34fd8e6
commit
190b673890
12 changed files with 93 additions and 122 deletions
|
@ -152,59 +152,61 @@ void PolyDrawArgs::DrawElements(const DrawerCommandQueuePtr &queue, const TriVer
|
||||||
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
|
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
|
||||||
{
|
{
|
||||||
SetTexture(tex, translationID, renderstyle);
|
SetTexture(tex, translationID, renderstyle);
|
||||||
|
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
||||||
|
|
||||||
if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 1.0, 0.0);
|
SetStyle(Translation() ? TriBlendMode::NormalTranslated : TriBlendMode::Normal, alpha);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Add] && fullbright && alpha == 1.0 && !Translation())
|
else if (renderstyle == LegacyRenderStyles[STYLE_Add] && fullbright && alpha == 1.0 && !Translation())
|
||||||
{
|
{
|
||||||
SetStyle(TriBlendMode::TextureAddSrcColor, 1.0, 1.0);
|
SetStyle(TriBlendMode::SrcColor, alpha);
|
||||||
}
|
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Add])
|
|
||||||
{
|
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, alpha, 1.0);
|
|
||||||
}
|
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Subtract])
|
|
||||||
{
|
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedRevSub : TriBlendMode::TextureRevSub, alpha, 1.0);
|
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_SoulTrans])
|
else if (renderstyle == LegacyRenderStyles[STYLE_SoulTrans])
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, transsouls, 1.0 - transsouls);
|
SetStyle(Translation() ? TriBlendMode::AddTranslated : TriBlendMode::Add, transsouls);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||||
{
|
{
|
||||||
SetColor(0xff000000, 0);
|
SetColor(0xff000000, 0);
|
||||||
SetStyle(TriBlendMode::Fuzz);
|
SetStyle(TriBlendMode::Fuzzy);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 0.0, 160 / 255.0);
|
SetColor(0xff000000, 0);
|
||||||
|
SetStyle(Translation() ? TriBlendMode::TranslucentStencilTranslated : TriBlendMode::TranslucentStencil, 1.0 - 160 / 255.0);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_TranslucentStencil])
|
else if (renderstyle == LegacyRenderStyles[STYLE_Stencil])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetStyle(Translation() ? TriBlendMode::StencilTranslated : TriBlendMode::Stencil, alpha);
|
||||||
SetStyle(TriBlendMode::Stencil, alpha, 1.0 - alpha);
|
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_AddStencil])
|
else if (renderstyle == LegacyRenderStyles[STYLE_Translucent])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetStyle(Translation() ? TriBlendMode::TranslucentTranslated : TriBlendMode::Translucent, alpha);
|
||||||
SetStyle(TriBlendMode::AddStencil, alpha, 1.0);
|
}
|
||||||
|
else if (renderstyle == LegacyRenderStyles[STYLE_Add])
|
||||||
|
{
|
||||||
|
SetStyle(Translation() ? TriBlendMode::AddTranslated : TriBlendMode::Add, alpha);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Shaded])
|
else if (renderstyle == LegacyRenderStyles[STYLE_Shaded])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetStyle(Translation() ? TriBlendMode::ShadedTranslated : TriBlendMode::Shaded, alpha);
|
||||||
SetStyle(TriBlendMode::Shaded, alpha, 1.0 - alpha);
|
}
|
||||||
|
else if (renderstyle == LegacyRenderStyles[STYLE_TranslucentStencil])
|
||||||
|
{
|
||||||
|
SetStyle(Translation() ? TriBlendMode::TranslucentStencilTranslated : TriBlendMode::TranslucentStencil, alpha);
|
||||||
|
}
|
||||||
|
else if (renderstyle == LegacyRenderStyles[STYLE_Subtract])
|
||||||
|
{
|
||||||
|
SetStyle(Translation() ? TriBlendMode::SubtractTranslated : TriBlendMode::Subtract, alpha);
|
||||||
|
}
|
||||||
|
else if (renderstyle == LegacyRenderStyles[STYLE_AddStencil])
|
||||||
|
{
|
||||||
|
SetStyle(Translation() ? TriBlendMode::AddStencilTranslated : TriBlendMode::AddStencil, alpha);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_AddShaded])
|
else if (renderstyle == LegacyRenderStyles[STYLE_AddShaded])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetStyle(Translation() ? TriBlendMode::AddShadedTranslated : TriBlendMode::AddShaded, alpha);
|
||||||
SetStyle(TriBlendMode::AddShaded, alpha, 1.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, alpha, 1.0 - alpha);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,55 +305,55 @@ void RectDrawArgs::SetStyle(FRenderStyle renderstyle, double alpha, uint32_t fil
|
||||||
|
|
||||||
if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 1.0, 0.0);
|
SetStyle(Translation() ? RectBlendMode::TranslatedAdd : RectBlendMode::TextureAdd, 1.0, 0.0);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Add] && fullbright && alpha == 1.0 && !Translation())
|
else if (renderstyle == LegacyRenderStyles[STYLE_Add] && fullbright && alpha == 1.0 && !Translation())
|
||||||
{
|
{
|
||||||
SetStyle(TriBlendMode::TextureAddSrcColor, 1.0, 1.0);
|
SetStyle(RectBlendMode::TextureAddSrcColor, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Add])
|
else if (renderstyle == LegacyRenderStyles[STYLE_Add])
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, alpha, 1.0);
|
SetStyle(Translation() ? RectBlendMode::TranslatedAdd : RectBlendMode::TextureAdd, alpha, 1.0);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Subtract])
|
else if (renderstyle == LegacyRenderStyles[STYLE_Subtract])
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedRevSub : TriBlendMode::TextureRevSub, alpha, 1.0);
|
SetStyle(Translation() ? RectBlendMode::TranslatedRevSub : RectBlendMode::TextureRevSub, alpha, 1.0);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_SoulTrans])
|
else if (renderstyle == LegacyRenderStyles[STYLE_SoulTrans])
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, transsouls, 1.0 - transsouls);
|
SetStyle(Translation() ? RectBlendMode::TranslatedAdd : RectBlendMode::TextureAdd, transsouls, 1.0 - transsouls);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||||
{
|
{
|
||||||
SetColor(0xff000000, 0);
|
SetColor(0xff000000, 0);
|
||||||
SetStyle(TriBlendMode::Fuzz);
|
SetStyle(RectBlendMode::Fuzz);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 0.0, 160 / 255.0);
|
SetStyle(Translation() ? RectBlendMode::TranslatedAdd : RectBlendMode::TextureAdd, 0.0, 160 / 255.0);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_TranslucentStencil])
|
else if (renderstyle == LegacyRenderStyles[STYLE_TranslucentStencil])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
||||||
SetStyle(TriBlendMode::Stencil, alpha, 1.0 - alpha);
|
SetStyle(RectBlendMode::Stencil, alpha, 1.0 - alpha);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_AddStencil])
|
else if (renderstyle == LegacyRenderStyles[STYLE_AddStencil])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
||||||
SetStyle(TriBlendMode::AddStencil, alpha, 1.0);
|
SetStyle(RectBlendMode::AddStencil, alpha, 1.0);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_Shaded])
|
else if (renderstyle == LegacyRenderStyles[STYLE_Shaded])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
||||||
SetStyle(TriBlendMode::Shaded, alpha, 1.0 - alpha);
|
SetStyle(RectBlendMode::Shaded, alpha, 1.0 - alpha);
|
||||||
}
|
}
|
||||||
else if (renderstyle == LegacyRenderStyles[STYLE_AddShaded])
|
else if (renderstyle == LegacyRenderStyles[STYLE_AddShaded])
|
||||||
{
|
{
|
||||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
||||||
SetStyle(TriBlendMode::AddShaded, alpha, 1.0);
|
SetStyle(RectBlendMode::AddShaded, alpha, 1.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, alpha, 1.0 - alpha);
|
SetStyle(Translation() ? RectBlendMode::TranslatedAdd : RectBlendMode::TextureAdd, alpha, 1.0 - alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
void SetWriteColor(bool enable) { mWriteColor = enable; }
|
void SetWriteColor(bool enable) { mWriteColor = enable; }
|
||||||
void SetWriteStencil(bool enable, uint8_t stencilWriteValue = 0) { mWriteStencil = enable; mStencilWriteValue = stencilWriteValue; }
|
void SetWriteStencil(bool enable, uint8_t stencilWriteValue = 0) { mWriteStencil = enable; mStencilWriteValue = stencilWriteValue; }
|
||||||
void SetWriteDepth(bool enable) { mWriteDepth = enable; }
|
void SetWriteDepth(bool enable) { mWriteDepth = enable; }
|
||||||
void SetStyle(TriBlendMode blendmode, double srcalpha = 1.0, double destalpha = 1.0) { mBlendMode = blendmode; mSrcAlpha = (uint32_t)(srcalpha * 256.0 + 0.5); mDestAlpha = (uint32_t)(destalpha * 256.0 + 0.5); }
|
void SetStyle(TriBlendMode blendmode, double alpha = 1.0) { mBlendMode = blendmode; mSrcAlpha = (uint32_t)(alpha * 256.0 + 0.5); }
|
||||||
void SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
|
void SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
|
||||||
void SetColor(uint32_t bgra, uint8_t palindex);
|
void SetColor(uint32_t bgra, uint8_t palindex);
|
||||||
void SetLights(PolyLight *lights, int numLights) { mLights = lights; mNumLights = numLights; }
|
void SetLights(PolyLight *lights, int numLights) { mLights = lights; mNumLights = numLights; }
|
||||||
|
@ -108,7 +108,7 @@ public:
|
||||||
TriBlendMode BlendMode() const { return mBlendMode; }
|
TriBlendMode BlendMode() const { return mBlendMode; }
|
||||||
uint32_t Color() const { return mColor; }
|
uint32_t Color() const { return mColor; }
|
||||||
uint32_t SrcAlpha() const { return mSrcAlpha; }
|
uint32_t SrcAlpha() const { return mSrcAlpha; }
|
||||||
uint32_t DestAlpha() const { return mDestAlpha; }
|
uint32_t DestAlpha() const { return 256 - mSrcAlpha; }
|
||||||
|
|
||||||
float GlobVis() const { return mGlobVis; }
|
float GlobVis() const { return mGlobVis; }
|
||||||
uint32_t Light() const { return mLight; }
|
uint32_t Light() const { return mLight; }
|
||||||
|
@ -152,11 +152,10 @@ private:
|
||||||
uint8_t mStencilWriteValue = 0;
|
uint8_t mStencilWriteValue = 0;
|
||||||
const uint8_t *mColormaps = nullptr;
|
const uint8_t *mColormaps = nullptr;
|
||||||
PolyClipPlane mClipPlane[3];
|
PolyClipPlane mClipPlane[3];
|
||||||
TriBlendMode mBlendMode = TriBlendMode::FillOpaque;
|
TriBlendMode mBlendMode = TriBlendMode::Fill;
|
||||||
uint32_t mLight = 0;
|
uint32_t mLight = 0;
|
||||||
uint32_t mColor = 0;
|
uint32_t mColor = 0;
|
||||||
uint32_t mSrcAlpha = 0;
|
uint32_t mSrcAlpha = 0;
|
||||||
uint32_t mDestAlpha = 0;
|
|
||||||
uint16_t mLightAlpha = 0;
|
uint16_t mLightAlpha = 0;
|
||||||
uint16_t mLightRed = 0;
|
uint16_t mLightRed = 0;
|
||||||
uint16_t mLightGreen = 0;
|
uint16_t mLightGreen = 0;
|
||||||
|
@ -182,7 +181,7 @@ public:
|
||||||
void SetTexture(FTexture *texture, FRenderStyle style);
|
void SetTexture(FTexture *texture, FRenderStyle style);
|
||||||
void SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style);
|
void SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style);
|
||||||
void SetLight(FSWColormap *basecolormap, uint32_t lightlevel);
|
void SetLight(FSWColormap *basecolormap, uint32_t lightlevel);
|
||||||
void SetStyle(TriBlendMode blendmode, double srcalpha = 1.0, double destalpha = 1.0) { mBlendMode = blendmode; mSrcAlpha = (uint32_t)(srcalpha * 256.0 + 0.5); mDestAlpha = (uint32_t)(destalpha * 256.0 + 0.5); }
|
void SetStyle(RectBlendMode blendmode, double srcalpha = 1.0, double destalpha = 1.0) { mBlendMode = blendmode; mSrcAlpha = (uint32_t)(srcalpha * 256.0 + 0.5); mDestAlpha = (uint32_t)(destalpha * 256.0 + 0.5); }
|
||||||
void SetStyle(FRenderStyle renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
|
void SetStyle(FRenderStyle renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
|
||||||
void SetColor(uint32_t bgra, uint8_t palindex);
|
void SetColor(uint32_t bgra, uint8_t palindex);
|
||||||
void Draw(PolyRenderThread *thread, double x0, double x1, double y0, double y1, double u0, double u1, double v0, double v1);
|
void Draw(PolyRenderThread *thread, double x0, double x1, double y0, double y1, double u0, double u1, double v0, double v1);
|
||||||
|
@ -193,7 +192,7 @@ public:
|
||||||
int TextureHeight() const { return mTextureHeight; }
|
int TextureHeight() const { return mTextureHeight; }
|
||||||
const uint8_t *Translation() const { return mTranslation; }
|
const uint8_t *Translation() const { return mTranslation; }
|
||||||
|
|
||||||
TriBlendMode BlendMode() const { return mBlendMode; }
|
RectBlendMode BlendMode() const { return mBlendMode; }
|
||||||
uint32_t Color() const { return mColor; }
|
uint32_t Color() const { return mColor; }
|
||||||
uint32_t SrcAlpha() const { return mSrcAlpha; }
|
uint32_t SrcAlpha() const { return mSrcAlpha; }
|
||||||
uint32_t DestAlpha() const { return mDestAlpha; }
|
uint32_t DestAlpha() const { return mDestAlpha; }
|
||||||
|
@ -227,7 +226,7 @@ private:
|
||||||
int mTextureHeight = 0;
|
int mTextureHeight = 0;
|
||||||
const uint8_t *mTranslation = nullptr;
|
const uint8_t *mTranslation = nullptr;
|
||||||
const uint8_t *mColormaps = nullptr;
|
const uint8_t *mColormaps = nullptr;
|
||||||
TriBlendMode mBlendMode = TriBlendMode::FillOpaque;
|
RectBlendMode mBlendMode = RectBlendMode::FillOpaque;
|
||||||
uint32_t mLight = 0;
|
uint32_t mLight = 0;
|
||||||
uint32_t mColor = 0;
|
uint32_t mColor = 0;
|
||||||
uint32_t mSrcAlpha = 0;
|
uint32_t mSrcAlpha = 0;
|
||||||
|
|
|
@ -1961,62 +1961,6 @@ void(*ScreenTriangle::SpanDrawers32[])(int, int, int, const TriDrawTriangleArgs
|
||||||
&DrawSpan32<TriScreenDrawerModes::StyleAddShadedTranslated>
|
&DrawSpan32<TriScreenDrawerModes::StyleAddShadedTranslated>
|
||||||
};
|
};
|
||||||
|
|
||||||
void(*ScreenTriangle::TriDrawers8[])(int, int, uint32_t, uint32_t, const TriDrawTriangleArgs *) =
|
|
||||||
{
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureOpaque
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::MaskedBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureMasked
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddClampBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureAdd
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureSub
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureRevSub
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureAddSrcColor
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedOpaque
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::MaskedBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedMasked
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddClampBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedAdd
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedSub
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedRevSub
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedAddSrcColor
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::ShadedSampler>::Execute, // Shaded
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddClampShadedBlend, TriScreenDrawerModes::ShadedSampler>::Execute, // AddShaded
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::StencilSampler>::Execute, // Stencil
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddClampShadedBlend, TriScreenDrawerModes::StencilSampler>::Execute, // AddStencil
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillOpaque
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillAdd
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillSub
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillRevSub
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillAddSrcColor
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute, // Skycap
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::FuzzSampler>::Execute, // Fuzz
|
|
||||||
&TriScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::FogBoundarySampler>::Execute, // FogBoundary
|
|
||||||
};
|
|
||||||
|
|
||||||
void(*ScreenTriangle::TriDrawers32[])(int, int, uint32_t, uint32_t, const TriDrawTriangleArgs *) =
|
|
||||||
{
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureOpaque
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::MaskedBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureMasked
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddClampBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureAdd
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureSub
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureRevSub
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureAddSrcColor
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedOpaque
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::MaskedBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedMasked
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddClampBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedAdd
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedSub
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedRevSub
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::TranslatedSampler>::Execute, // TranslatedAddSrcColor
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::ShadedSampler>::Execute, // Shaded
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddClampShadedBlend, TriScreenDrawerModes::ShadedSampler>::Execute, // AddShaded
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::StencilSampler>::Execute, // Stencil
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddClampShadedBlend, TriScreenDrawerModes::StencilSampler>::Execute, // AddStencil
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillOpaque
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillAdd
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillSub
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillRevSub
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillAddSrcColor
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute, // Skycap
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::FuzzSampler>::Execute, // Fuzz
|
|
||||||
&TriScreenDrawer32<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::FogBoundarySampler>::Execute // FogBoundary
|
|
||||||
};
|
|
||||||
|
|
||||||
void(*ScreenTriangle::RectDrawers8[])(const void *, int, int, int, const RectDrawArgs *, PolyTriangleThreadData *) =
|
void(*ScreenTriangle::RectDrawers8[])(const void *, int, int, int, const RectDrawArgs *, PolyTriangleThreadData *) =
|
||||||
{
|
{
|
||||||
&RectScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureOpaque
|
&RectScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::TextureSampler>::Execute, // TextureOpaque
|
||||||
|
|
|
@ -107,6 +107,38 @@ private:
|
||||||
class RectDrawArgs;
|
class RectDrawArgs;
|
||||||
|
|
||||||
enum class TriBlendMode
|
enum class TriBlendMode
|
||||||
|
{
|
||||||
|
Opaque,
|
||||||
|
Skycap,
|
||||||
|
FogBoundary,
|
||||||
|
SrcColor,
|
||||||
|
Fill,
|
||||||
|
Normal,
|
||||||
|
Fuzzy,
|
||||||
|
Stencil,
|
||||||
|
Translucent,
|
||||||
|
Add,
|
||||||
|
Shaded,
|
||||||
|
TranslucentStencil,
|
||||||
|
Shadow,
|
||||||
|
Subtract,
|
||||||
|
AddStencil,
|
||||||
|
AddShaded,
|
||||||
|
OpaqueTranslated,
|
||||||
|
SrcColorTranslated,
|
||||||
|
NormalTranslated,
|
||||||
|
StencilTranslated,
|
||||||
|
TranslucentTranslated,
|
||||||
|
AddTranslated,
|
||||||
|
ShadedTranslated,
|
||||||
|
TranslucentStencilTranslated,
|
||||||
|
ShadowTranslated,
|
||||||
|
SubtractTranslated,
|
||||||
|
AddStencilTranslated,
|
||||||
|
AddShadedTranslated
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class RectBlendMode
|
||||||
{
|
{
|
||||||
TextureOpaque,
|
TextureOpaque,
|
||||||
TextureMasked,
|
TextureMasked,
|
||||||
|
@ -142,8 +174,6 @@ public:
|
||||||
|
|
||||||
static void(*SpanDrawers8[])(int y, int x0, int x1, const TriDrawTriangleArgs *args);
|
static void(*SpanDrawers8[])(int y, int x0, int x1, const TriDrawTriangleArgs *args);
|
||||||
static void(*SpanDrawers32[])(int y, int x0, int x1, const TriDrawTriangleArgs *args);
|
static void(*SpanDrawers32[])(int y, int x0, int x1, const TriDrawTriangleArgs *args);
|
||||||
static void(*TriDrawers8[])(int, int, uint32_t, uint32_t, const TriDrawTriangleArgs *);
|
|
||||||
static void(*TriDrawers32[])(int, int, uint32_t, uint32_t, const TriDrawTriangleArgs *);
|
|
||||||
static void(*RectDrawers8[])(const void *, int, int, int, const RectDrawArgs *, PolyTriangleThreadData *);
|
static void(*RectDrawers8[])(const void *, int, int, int, const RectDrawArgs *, PolyTriangleThreadData *);
|
||||||
static void(*RectDrawers32[])(const void *, int, int, int, const RectDrawArgs *, PolyTriangleThreadData *);
|
static void(*RectDrawers32[])(const void *, int, int, int, const RectDrawArgs *, PolyTriangleThreadData *);
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ void PolyModelRenderer::DrawArrays(int start, int count)
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
|
||||||
args.SetStencilTestValue(StencilValue);
|
args.SetStencilTestValue(StencilValue);
|
||||||
args.SetClipPlane(0, PolyClipPlane());
|
args.SetClipPlane(0, PolyClipPlane());
|
||||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
args.SetTexture(SkinTexture, DefaultRenderStyle());
|
args.SetTexture(SkinTexture, DefaultRenderStyle());
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
|
@ -169,7 +169,7 @@ void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
|
||||||
args.SetStencilTestValue(StencilValue);
|
args.SetStencilTestValue(StencilValue);
|
||||||
args.SetClipPlane(0, PolyClipPlane());
|
args.SetClipPlane(0, PolyClipPlane());
|
||||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
args.SetTexture(SkinTexture, DefaultRenderStyle());
|
args.SetTexture(SkinTexture, DefaultRenderStyle());
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
|
|
|
@ -81,7 +81,7 @@ void RenderPolyParticle::Render(PolyRenderThread *thread, particle_t *particle,
|
||||||
args.SetLight(GetColorTable(sub->sector->Colormap), lightlevel, PolyRenderer::Instance()->Light.ParticleGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sub->sector->Colormap), lightlevel, PolyRenderer::Instance()->Light.ParticleGlobVis(foggy), fullbrightSprite);
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetColor(particle->color | 0xff000000, particle->color >> 24);
|
args.SetColor(particle->color | 0xff000000, particle->color >> 24);
|
||||||
args.SetStyle(TriBlendMode::Shaded, particle->alpha, 1.0 - particle->alpha);
|
args.SetStyle(TriBlendMode::Shaded, particle->alpha);
|
||||||
args.SetStencilTestValue(stencilValue);
|
args.SetStencilTestValue(stencilValue);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
|
|
|
@ -79,7 +79,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyTransferH
|
||||||
args.SetStencilTestValue(stencilValue);
|
args.SetStencilTestValue(stencilValue);
|
||||||
args.SetWriteStencil(true, stencilValue + 1);
|
args.SetWriteStencil(true, stencilValue + 1);
|
||||||
args.SetTexture(tex, DefaultRenderStyle());
|
args.SetTexture(tex, DefaultRenderStyle());
|
||||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
args.DrawArray(thread->DrawQueue, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -546,13 +546,11 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread)
|
||||||
args.SetLight(GetColorTable(sub->sector->Colormap), lightlevel, PolyRenderer::Instance()->Light.WallGlobVis(foggy), false);
|
args.SetLight(GetColorTable(sub->sector->Colormap), lightlevel, PolyRenderer::Instance()->Light.WallGlobVis(foggy), false);
|
||||||
if (!Masked)
|
if (!Masked)
|
||||||
{
|
{
|
||||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double srcalpha = MIN(Alpha, 1.0);
|
args.SetStyle(Additive ? TriBlendMode::Add : TriBlendMode::Normal, MIN(Alpha, 1.0));
|
||||||
double destalpha = Additive ? 1.0 : 1.0 - srcalpha;
|
|
||||||
args.SetStyle(TriBlendMode::TextureAdd, srcalpha, destalpha);
|
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ void RenderPolyScene::RenderPortals()
|
||||||
{
|
{
|
||||||
bool foggy = false;
|
bool foggy = false;
|
||||||
args.SetLight(&NormalLight, 255, PolyRenderer::Instance()->Light.WallGlobVis(foggy), true);
|
args.SetLight(&NormalLight, 255, PolyRenderer::Instance()->Light.WallGlobVis(foggy), true);
|
||||||
args.SetStyle(TriBlendMode::FillOpaque);
|
args.SetStyle(TriBlendMode::Fill);
|
||||||
args.SetColor(0, 0);
|
args.SetColor(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ void PolySkyDome::RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args
|
||||||
uint8_t palsolid = RGB32k.RGB[(RPART(solid) >> 3)][(GPART(solid) >> 3)][(BPART(solid) >> 3)];
|
uint8_t palsolid = RGB32k.RGB[(RPART(solid) >> 3)][(GPART(solid) >> 3)][(BPART(solid) >> 3)];
|
||||||
|
|
||||||
args.SetColor(solid, palsolid);
|
args.SetColor(solid, palsolid);
|
||||||
args.SetStyle(TriBlendMode::FillOpaque);
|
args.SetStyle(TriBlendMode::Fill);
|
||||||
args.DrawArray(thread->DrawQueue, &mVertices[mPrimStart[row]], mPrimStart[row + 1] - mPrimStart[row], PolyDrawMode::TriangleFan);
|
args.DrawArray(thread->DrawQueue, &mVertices[mPrimStart[row]], mPrimStart[row + 1] - mPrimStart[row], PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -349,14 +349,12 @@ void RenderPolyWall::Render(PolyRenderThread *thread)
|
||||||
{
|
{
|
||||||
args.SetStencilTestValue(StencilValue);
|
args.SetStencilTestValue(StencilValue);
|
||||||
args.SetWriteStencil(true, StencilValue + 1);
|
args.SetWriteStencil(true, StencilValue + 1);
|
||||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
DrawStripes(thread, args, vertices);
|
DrawStripes(thread, args, vertices);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double srcalpha = MIN(Alpha, 1.0);
|
args.SetStyle(Additive ? TriBlendMode::Add : TriBlendMode::Normal, MIN(Alpha, 1.0));
|
||||||
double destalpha = Additive ? 1.0 : 1.0 - srcalpha;
|
|
||||||
args.SetStyle(TriBlendMode::TextureAdd, srcalpha, destalpha);
|
|
||||||
args.SetStencilTestValue(StencilValue + 1);
|
args.SetStencilTestValue(StencilValue + 1);
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
|
|
|
@ -107,6 +107,6 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, AActor *thing, subse
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.SetStyle(TriBlendMode::TextureMasked);
|
args.SetStyle(TriBlendMode::Normal);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ namespace swrenderer
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, Thread->Light->SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, Thread->Light->SpriteGlobVis(foggy), fullbrightSprite);
|
||||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
|
|
||||||
if (Thread->Viewport->RenderTarget->IsBgra())
|
if (Thread->Viewport->RenderTarget->IsBgra())
|
||||||
args.SetTexture((const uint8_t *)SkinTexture->GetPixelsBgra(), SkinTexture->GetWidth(), SkinTexture->GetHeight());
|
args.SetTexture((const uint8_t *)SkinTexture->GetPixelsBgra(), SkinTexture->GetWidth(), SkinTexture->GetHeight());
|
||||||
|
@ -259,7 +259,7 @@ namespace swrenderer
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, Thread->Light->SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, Thread->Light->SpriteGlobVis(foggy), fullbrightSprite);
|
||||||
args.SetStyle(TriBlendMode::TextureOpaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
|
|
||||||
if (Thread->Viewport->RenderTarget->IsBgra())
|
if (Thread->Viewport->RenderTarget->IsBgra())
|
||||||
args.SetTexture((const uint8_t *)SkinTexture->GetPixelsBgra(), SkinTexture->GetWidth(), SkinTexture->GetHeight());
|
args.SetTexture((const uint8_t *)SkinTexture->GetPixelsBgra(), SkinTexture->GetWidth(), SkinTexture->GetHeight());
|
||||||
|
|
Loading…
Reference in a new issue