mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
This commit is contained in:
commit
5851408803
11 changed files with 184 additions and 43 deletions
|
@ -789,7 +789,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
{
|
||||
DAngle sprangle;
|
||||
int rot;
|
||||
if (!(thing->renderflags & RF_FLATSPRITE))
|
||||
if (!(thing->renderflags & RF_FLATSPRITE) || thing->flags7 & MF7_SPRITEANGLE)
|
||||
{
|
||||
sprangle = thing->GetSpriteAngle(ang, r_viewpoint.TicFrac);
|
||||
rot = -1;
|
||||
|
|
|
@ -166,11 +166,12 @@ void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint3
|
|||
{
|
||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, transsouls, 1.0 - transsouls);
|
||||
}
|
||||
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||
{ // NYI - Fuzzy - for now, just a copy of "Shadow"
|
||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 0.0, 160 / 255.0);
|
||||
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||
{
|
||||
SetColor(0xff000000, 0);
|
||||
SetStyle(TriBlendMode::Fuzz);
|
||||
}
|
||||
else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 1 && 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);
|
||||
}
|
||||
|
@ -318,11 +319,12 @@ void RectDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint3
|
|||
{
|
||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, transsouls, 1.0 - transsouls);
|
||||
}
|
||||
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||
{ // NYI - Fuzzy - for now, just a copy of "Shadow"
|
||||
SetStyle(Translation() ? TriBlendMode::TranslatedAdd : TriBlendMode::TextureAdd, 0.0, 160 / 255.0);
|
||||
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
|
||||
{
|
||||
SetColor(0xff000000, 0);
|
||||
SetStyle(TriBlendMode::Fuzz);
|
||||
}
|
||||
else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 1 && 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);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace TriScreenDrawerModes
|
|||
FORCEINLINE unsigned int VECTORCALL Sample32(int32_t u, int32_t v, const uint32_t *texPixels, int texWidth, int texHeight, uint32_t oneU, uint32_t oneV, uint32_t color, const uint32_t *translation)
|
||||
{
|
||||
uint32_t texel;
|
||||
if (SamplerT::Mode == (int)Samplers::Shaded || SamplerT::Mode == (int)Samplers::Stencil || SamplerT::Mode == (int)Samplers::Fill)
|
||||
if (SamplerT::Mode == (int)Samplers::Shaded || SamplerT::Mode == (int)Samplers::Stencil || SamplerT::Mode == (int)Samplers::Fill || SamplerT::Mode == (int)Samplers::Fuzz)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ namespace TriScreenDrawerModes
|
|||
}
|
||||
|
||||
template<typename SamplerT>
|
||||
FORCEINLINE unsigned int VECTORCALL SampleShade32(int32_t u, int32_t v, const uint32_t *texPixels, int texWidth, int texHeight)
|
||||
FORCEINLINE unsigned int VECTORCALL SampleShade32(int32_t u, int32_t v, const uint32_t *texPixels, int texWidth, int texHeight, int &fuzzpos)
|
||||
{
|
||||
if (SamplerT::Mode == (int)Samplers::Shaded)
|
||||
{
|
||||
|
@ -126,6 +126,16 @@ namespace TriScreenDrawerModes
|
|||
sampleshadeout += sampleshadeout >> 7; // 255 -> 256
|
||||
return sampleshadeout;
|
||||
}
|
||||
else if (SamplerT::Mode == (int)Samplers::Fuzz)
|
||||
{
|
||||
uint32_t texelX = ((((uint32_t)u << 8) >> 16) * texWidth) >> 16;
|
||||
uint32_t texelY = ((((uint32_t)v << 8) >> 16) * texHeight) >> 16;
|
||||
unsigned int sampleshadeout = APART(texPixels[texelX * texHeight + texelY]);
|
||||
sampleshadeout += sampleshadeout >> 7; // 255 -> 256
|
||||
sampleshadeout = (sampleshadeout * fuzzcolormap[fuzzpos++]) >> 5;
|
||||
if (fuzzpos >= FUZZTABLE) fuzzpos = 0;
|
||||
return sampleshadeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
|
@ -139,7 +149,7 @@ namespace TriScreenDrawerModes
|
|||
{
|
||||
fgcolor = _mm_srli_epi16(_mm_mullo_epi16(fgcolor, mlight), 8);
|
||||
}
|
||||
else
|
||||
else if (ShadeModeT::Mode == (int)ShadeMode::Advanced)
|
||||
{
|
||||
int blue0 = BPART(ifgcolor0);
|
||||
int green0 = GPART(ifgcolor0);
|
||||
|
@ -293,6 +303,10 @@ public:
|
|||
DrawBlock<AdvancedShade, LinearFilter>(x, y, mask0, mask1, args);
|
||||
}
|
||||
}
|
||||
else if (SamplerT::Mode == (int)Samplers::Fuzz)
|
||||
{
|
||||
DrawBlock<NoShade, NearestFilter>(x, y, mask0, mask1, args);
|
||||
}
|
||||
else // no linear filtering for translated, shaded, stencil, fill or skycap
|
||||
{
|
||||
if (is_simple_shade)
|
||||
|
@ -317,6 +331,8 @@ private:
|
|||
uint32_t srcalpha = args->uniforms->SrcAlpha();
|
||||
uint32_t destalpha = args->uniforms->DestAlpha();
|
||||
|
||||
int fuzzpos = (ScreenTriangle::FuzzStart + destX * 123 + destY) % FUZZTABLE;
|
||||
|
||||
// Calculate gradients
|
||||
const TriVertex &v1 = *args->v1;
|
||||
ScreenTriangleStepVariables gradientX = args->gradientX;
|
||||
|
@ -415,12 +431,12 @@ private:
|
|||
// Sample fgcolor
|
||||
unsigned int ifgcolor[2], ifgshade[2];
|
||||
ifgcolor[0] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
posV += stepV;
|
||||
|
||||
ifgcolor[1] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
posV += stepV;
|
||||
|
||||
|
@ -501,12 +517,12 @@ private:
|
|||
// Sample fgcolor
|
||||
unsigned int ifgcolor[2], ifgshade[2];
|
||||
ifgcolor[0] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
posV += stepV;
|
||||
|
||||
ifgcolor[1] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
posV += stepV;
|
||||
|
||||
|
@ -589,12 +605,12 @@ private:
|
|||
// Sample fgcolor
|
||||
unsigned int ifgcolor[2], ifgshade[2];
|
||||
ifgcolor[0] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
posV += stepV;
|
||||
|
||||
ifgcolor[1] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
posV += stepV;
|
||||
|
||||
|
@ -736,12 +752,17 @@ private:
|
|||
int count = x1 - x0;
|
||||
int sseCount = count / 2;
|
||||
|
||||
int fuzzpos = (ScreenTriangle::FuzzStart + x0 * 123 + y0) % FUZZTABLE;
|
||||
|
||||
uint32_t posV = startV;
|
||||
for (int y = y0; y < y1; y++, posV += stepV)
|
||||
{
|
||||
int coreBlock = y / 8;
|
||||
if (coreBlock % thread->num_cores != thread->core)
|
||||
{
|
||||
fuzzpos = (fuzzpos + count) % FUZZTABLE;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t *dest = ((uint32_t*)destOrg) + y * destPitch + x0;
|
||||
|
||||
|
@ -758,11 +779,11 @@ private:
|
|||
// Sample fgcolor
|
||||
unsigned int ifgcolor[2], ifgshade[2];
|
||||
ifgcolor[0] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
|
||||
ifgcolor[1] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[1] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
posU += stepU;
|
||||
|
||||
// Shade and blend
|
||||
|
@ -787,7 +808,7 @@ private:
|
|||
// Sample fgcolor
|
||||
unsigned int ifgcolor[2], ifgshade[2];
|
||||
ifgcolor[0] = Sample32<SamplerT, FilterModeT>(posU, posV, texPixels, texWidth, texHeight, oneU, oneV, color, translation);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
ifgshade[0] = SampleShade32<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
ifgcolor[1] = 0;
|
||||
ifgshade[1] = 0;
|
||||
posU += stepU;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace TriScreenDrawerModes
|
|||
FORCEINLINE unsigned int Sample8(int32_t u, int32_t v, const uint8_t *texPixels, int texWidth, int texHeight, uint32_t color, const uint8_t *translation)
|
||||
{
|
||||
uint8_t texel;
|
||||
if (SamplerT::Mode == (int)Samplers::Shaded || SamplerT::Mode == (int)Samplers::Stencil || SamplerT::Mode == (int)Samplers::Fill)
|
||||
if (SamplerT::Mode == (int)Samplers::Shaded || SamplerT::Mode == (int)Samplers::Stencil || SamplerT::Mode == (int)Samplers::Fill || SamplerT::Mode == (int)Samplers::Fuzz)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace TriScreenDrawerModes
|
|||
}
|
||||
|
||||
template<typename SamplerT>
|
||||
FORCEINLINE unsigned int SampleShade8(int32_t u, int32_t v, const uint8_t *texPixels, int texWidth, int texHeight)
|
||||
FORCEINLINE unsigned int SampleShade8(int32_t u, int32_t v, const uint8_t *texPixels, int texWidth, int texHeight, int &fuzzpos)
|
||||
{
|
||||
if (SamplerT::Mode == (int)Samplers::Shaded)
|
||||
{
|
||||
|
@ -95,6 +95,15 @@ namespace TriScreenDrawerModes
|
|||
uint32_t texelY = ((((uint32_t)v << 8) >> 16) * texHeight) >> 16;
|
||||
return texPixels[texelX * texHeight + texelY] != 0 ? 256 : 0;
|
||||
}
|
||||
else if (SamplerT::Mode == (int)Samplers::Fuzz)
|
||||
{
|
||||
uint32_t texelX = ((((uint32_t)u << 8) >> 16) * texWidth) >> 16;
|
||||
uint32_t texelY = ((((uint32_t)v << 8) >> 16) * texHeight) >> 16;
|
||||
unsigned int sampleshadeout = (texPixels[texelX * texHeight + texelY] != 0) ? 256 : 0;
|
||||
sampleshadeout = (sampleshadeout * fuzzcolormap[fuzzpos++]) >> 5;
|
||||
if (fuzzpos >= FUZZTABLE) fuzzpos = 0;
|
||||
return sampleshadeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
|
@ -219,6 +228,8 @@ public:
|
|||
uint32_t srcalpha = args->uniforms->SrcAlpha();
|
||||
uint32_t destalpha = args->uniforms->DestAlpha();
|
||||
|
||||
int fuzzpos = (ScreenTriangle::FuzzStart + destX * 123 + destY) % FUZZTABLE;
|
||||
|
||||
// Calculate gradients
|
||||
const TriVertex &v1 = *args->v1;
|
||||
ScreenTriangleStepVariables gradientX = args->gradientX;
|
||||
|
@ -280,7 +291,8 @@ public:
|
|||
int lightshade = lightpos >> 8;
|
||||
uint8_t bgcolor = dest[ix];
|
||||
uint8_t fgcolor = Sample8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, color, translation);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
if (SamplerT::Mode == (int)Samplers::Fuzz) lightshade = 256;
|
||||
dest[ix] = ShadeAndBlend8<BlendT>(fgcolor, bgcolor, fgshade, lightshade, colormaps, srcalpha, destalpha);
|
||||
posU += stepU;
|
||||
posV += stepV;
|
||||
|
@ -328,7 +340,8 @@ public:
|
|||
int lightshade = lightpos >> 8;
|
||||
uint8_t bgcolor = dest[x];
|
||||
uint8_t fgcolor = Sample8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, color, translation);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
if (SamplerT::Mode == (int)Samplers::Fuzz) lightshade = 256;
|
||||
dest[x] = ShadeAndBlend8<BlendT>(fgcolor, bgcolor, fgshade, lightshade, colormaps, srcalpha, destalpha);
|
||||
}
|
||||
|
||||
|
@ -378,7 +391,8 @@ public:
|
|||
int lightshade = lightpos >> 8;
|
||||
uint8_t bgcolor = dest[x];
|
||||
uint8_t fgcolor = Sample8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, color, translation);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
if (SamplerT::Mode == (int)Samplers::Fuzz) lightshade = 256;
|
||||
dest[x] = ShadeAndBlend8<BlendT>(fgcolor, bgcolor, fgshade, lightshade, colormaps, srcalpha, destalpha);
|
||||
}
|
||||
|
||||
|
@ -437,15 +451,21 @@ public:
|
|||
// Setup light
|
||||
uint32_t lightshade = args->Light();
|
||||
lightshade += lightshade >> 7; // 255 -> 256
|
||||
if (SamplerT::Mode == (int)Samplers::Fuzz) lightshade = 256;
|
||||
|
||||
int count = x1 - x0;
|
||||
|
||||
int fuzzpos = (ScreenTriangle::FuzzStart + x0 * 123 + y0) % FUZZTABLE;
|
||||
|
||||
uint32_t posV = startV;
|
||||
for (int y = y0; y < y1; y++, posV += stepV)
|
||||
{
|
||||
int coreBlock = y / 8;
|
||||
if (coreBlock % thread->num_cores != thread->core)
|
||||
{
|
||||
fuzzpos = (fuzzpos + count) % FUZZTABLE;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t *dest = ((uint8_t*)destOrg) + y * destPitch + x0;
|
||||
|
||||
|
@ -454,7 +474,7 @@ public:
|
|||
{
|
||||
uint8_t bgcolor = *dest;
|
||||
uint8_t fgcolor = Sample8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, color, translation);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight);
|
||||
uint32_t fgshade = SampleShade8<SamplerT>(posU, posV, texPixels, texWidth, texHeight, fuzzpos);
|
||||
*dest = ShadeAndBlend8<BlendT>(fgcolor, bgcolor, fgshade, lightshade, colormaps, srcalpha, destalpha);
|
||||
|
||||
posU += stepU;
|
||||
|
|
|
@ -914,7 +914,8 @@ void(*ScreenTriangle::TriDrawers8[])(int, int, uint32_t, uint32_t, const TriDraw
|
|||
&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::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute, // Skycap
|
||||
&TriScreenDrawer8<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::FuzzSampler>::Execute // Fuzz
|
||||
};
|
||||
|
||||
#ifdef NO_SSE
|
||||
|
@ -949,7 +950,8 @@ void(*ScreenTriangle::TriDrawers32[])(int, int, uint32_t, uint32_t, const TriDra
|
|||
&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::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute, // Skycap
|
||||
&TriScreenDrawer32<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::FuzzSampler>::Execute // Fuzz
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -977,7 +979,8 @@ void(*ScreenTriangle::RectDrawers8[])(const void *, int, int, int, const RectDra
|
|||
&RectScreenDrawer8<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillSub
|
||||
&RectScreenDrawer8<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillRevSub
|
||||
&RectScreenDrawer8<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillAddSrcColor
|
||||
&RectScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute // Skycap
|
||||
&RectScreenDrawer8<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute, // Skycap
|
||||
&RectScreenDrawer8<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::FuzzSampler>::Execute // Fuzz
|
||||
};
|
||||
|
||||
#ifdef NO_SSE
|
||||
|
@ -1012,7 +1015,10 @@ void(*ScreenTriangle::RectDrawers32[])(const void *, int, int, int, const RectDr
|
|||
&RectScreenDrawer32<TriScreenDrawerModes::SubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillSub
|
||||
&RectScreenDrawer32<TriScreenDrawerModes::RevSubClampBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillRevSub
|
||||
&RectScreenDrawer32<TriScreenDrawerModes::AddSrcColorBlend, TriScreenDrawerModes::FillSampler>::Execute, // FillAddSrcColor
|
||||
&RectScreenDrawer32<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute // Skycap
|
||||
&RectScreenDrawer32<TriScreenDrawerModes::OpaqueBlend, TriScreenDrawerModes::SkycapSampler>::Execute, // Skycap
|
||||
&RectScreenDrawer32<TriScreenDrawerModes::ShadedBlend, TriScreenDrawerModes::FuzzSampler>::Execute // Fuzz
|
||||
};
|
||||
|
||||
int ScreenTriangle::FuzzStart = 0;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -117,7 +117,8 @@ enum class TriBlendMode
|
|||
FillSub,
|
||||
FillRevSub,
|
||||
FillAddSrcColor,
|
||||
Skycap
|
||||
Skycap,
|
||||
Fuzz
|
||||
};
|
||||
|
||||
class ScreenTriangle
|
||||
|
@ -129,6 +130,8 @@ public:
|
|||
static void(*TriDrawers32[])(int, int, uint32_t, uint32_t, const TriDrawTriangleArgs *);
|
||||
static void(*RectDrawers8[])(const void *, int, int, int, const RectDrawArgs *, WorkerThreadData *);
|
||||
static void(*RectDrawers32[])(const void *, int, int, int, const RectDrawArgs *, WorkerThreadData *);
|
||||
|
||||
static int FuzzStart;
|
||||
};
|
||||
|
||||
namespace TriScreenDrawerModes
|
||||
|
@ -147,15 +150,26 @@ namespace TriScreenDrawerModes
|
|||
struct NearestFilter { static const int Mode = (int)FilterModes::Nearest; };
|
||||
struct LinearFilter { static const int Mode = (int)FilterModes::Linear; };
|
||||
|
||||
enum class ShadeMode { Simple, Advanced };
|
||||
enum class ShadeMode { None, Simple, Advanced };
|
||||
struct NoShade { static const int Mode = (int)ShadeMode::None; };
|
||||
struct SimpleShade { static const int Mode = (int)ShadeMode::Simple; };
|
||||
struct AdvancedShade { static const int Mode = (int)ShadeMode::Advanced; };
|
||||
|
||||
enum class Samplers { Texture, Fill, Shaded, Stencil, Translated, Skycap };
|
||||
enum class Samplers { Texture, Fill, Shaded, Stencil, Translated, Skycap, Fuzz };
|
||||
struct TextureSampler { static const int Mode = (int)Samplers::Texture; };
|
||||
struct FillSampler { static const int Mode = (int)Samplers::Fill; };
|
||||
struct ShadedSampler { static const int Mode = (int)Samplers::Shaded; };
|
||||
struct StencilSampler { static const int Mode = (int)Samplers::Stencil; };
|
||||
struct TranslatedSampler { static const int Mode = (int)Samplers::Translated; };
|
||||
struct SkycapSampler { static const int Mode = (int)Samplers::Skycap; };
|
||||
struct FuzzSampler { static const int Mode = (int)Samplers::Fuzz; };
|
||||
|
||||
static const int fuzzcolormap[FUZZTABLE] =
|
||||
{
|
||||
6, 11, 6, 11, 6, 6, 11, 6, 6, 11,
|
||||
6, 6, 6, 11, 6, 6, 6, 11, 15, 18,
|
||||
21, 6, 11, 15, 6, 6, 6, 6, 11, 6,
|
||||
11, 6, 6, 11, 15, 6, 6, 11, 15, 18,
|
||||
21, 6, 6, 6, 6, 11, 6, 6, 11, 6,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -131,6 +131,8 @@ void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines)
|
|||
if (!Viewpoint.showviewer)
|
||||
Viewpoint.camera->renderflags |= RF_INVISIBLE;
|
||||
|
||||
ScreenTriangle::FuzzStart = (ScreenTriangle::FuzzStart + 14) % FUZZTABLE;
|
||||
|
||||
ClearBuffers();
|
||||
SetSceneViewport();
|
||||
SetupPerspectiveMatrix();
|
||||
|
|
|
@ -131,10 +131,27 @@ namespace swrenderer
|
|||
1, 1,-1, 1, 1,-1, 1
|
||||
};
|
||||
|
||||
#ifdef ORIGINAL_FUZZ
|
||||
for (int i = 0; i < FUZZTABLE; i++)
|
||||
{
|
||||
fuzzoffset[i] = fuzzinit[i] * fuzzoff;
|
||||
}
|
||||
#else
|
||||
int8_t fuzzcount[FUZZTABLE + 1];
|
||||
for (int i = 0; i < FUZZTABLE + 1; i++) fuzzcount[i] = 0;
|
||||
fuzzcount[0] = 1;
|
||||
for (int i = 1; i < FUZZTABLE; i++)
|
||||
fuzzcount[i] = fuzzcount[i + fuzzinit[i]] + 1;
|
||||
|
||||
for (int i = 0; i < FUZZTABLE; i++)
|
||||
{
|
||||
float shade = 1.0f - 6.0f / NUMCOLORMAPS;
|
||||
float resultshade = 1.0;
|
||||
for (int j = 0; j < fuzzcount[i]; j++)
|
||||
resultshade *= shade;
|
||||
fuzzoffset[i] = clamp((int)((1.0f - resultshade) * NUMCOLORMAPS + 0.5f), 0, NUMCOLORMAPS - 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void R_InitParticleTexture()
|
||||
|
|
|
@ -1858,8 +1858,6 @@ namespace swrenderer
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
uint8_t *map = &NormalLight.Maps[6 * 256];
|
||||
|
||||
int pitch = _pitch;
|
||||
uint8_t *dest = thread->dest_for_thread(yl, pitch, yl * pitch + _x + _destorg);
|
||||
|
||||
|
@ -1867,6 +1865,35 @@ namespace swrenderer
|
|||
int fuzzstep = thread->num_cores;
|
||||
int fuzz = (_fuzzpos + thread->skipped_by_thread(yl)) % FUZZTABLE;
|
||||
|
||||
#ifndef ORIGINAL_FUZZ
|
||||
|
||||
uint8_t *map = NormalLight.Maps;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
int available = (FUZZTABLE - fuzz);
|
||||
int next_wrap = available / fuzzstep;
|
||||
if (available % fuzzstep != 0)
|
||||
next_wrap++;
|
||||
|
||||
int cnt = MIN(count, next_wrap);
|
||||
count -= cnt;
|
||||
do
|
||||
{
|
||||
int offset = fuzzoffset[fuzz] << 8;
|
||||
|
||||
*dest = map[offset + *dest];
|
||||
dest += pitch;
|
||||
fuzz += fuzzstep;
|
||||
} while (--cnt);
|
||||
|
||||
fuzz %= FUZZTABLE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t *map = &NormalLight.Maps[6 * 256];
|
||||
|
||||
yl += thread->skipped_by_thread(yl);
|
||||
|
||||
// Handle the case where we would go out of bounds at the top:
|
||||
|
@ -1920,6 +1947,7 @@ namespace swrenderer
|
|||
|
||||
*dest = map[*srcdest];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -255,11 +255,41 @@ namespace swrenderer
|
|||
return;
|
||||
|
||||
uint32_t *dest = thread->dest_for_thread(yl, _pitch, _pitch * yl + _x + (uint32_t*)_destorg);
|
||||
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
|
||||
int fuzzstep = thread->num_cores;
|
||||
int fuzz = (_fuzzpos + thread->skipped_by_thread(yl)) % FUZZTABLE;
|
||||
|
||||
#ifndef ORIGINAL_FUZZ
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
int available = (FUZZTABLE - fuzz);
|
||||
int next_wrap = available / fuzzstep;
|
||||
if (available % fuzzstep != 0)
|
||||
next_wrap++;
|
||||
|
||||
int cnt = MIN(count, next_wrap);
|
||||
count -= cnt;
|
||||
do
|
||||
{
|
||||
int alpha = 32 - fuzzoffset[fuzz];
|
||||
|
||||
uint32_t bg = *dest;
|
||||
uint32_t red = (RPART(bg) * alpha) >> 5;
|
||||
uint32_t green = (GPART(bg) * alpha) >> 5;
|
||||
uint32_t blue = (BPART(bg) * alpha) >> 5;
|
||||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
dest += pitch;
|
||||
fuzz += fuzzstep;
|
||||
} while (--cnt);
|
||||
|
||||
fuzz %= FUZZTABLE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
yl += thread->skipped_by_thread(yl);
|
||||
|
||||
// Handle the case where we would go out of bounds at the top:
|
||||
|
@ -331,6 +361,7 @@ namespace swrenderer
|
|||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
FString DrawFuzzColumnRGBACommand::DebugInfo()
|
||||
|
|
|
@ -98,12 +98,12 @@ class DoomStatusBar : BaseStatusBar
|
|||
else
|
||||
{
|
||||
DrawImage("STARMS", (104, 168), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(2)? "STYSNUM2" : "STGNUM2", (111, 171), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(3)? "STYSNUM3" : "STGNUM3", (123, 171), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(4)? "STYSNUM4" : "STGNUM4", (135, 171), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(5)? "STYSNUM5" : "STGNUM5", (111, 181), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(6)? "STYSNUM6" : "STGNUM6", (123, 181), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(7)? "STYSNUM7" : "STGNUM7", (135, 181), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(2)? "STYSNUM2" : "STGNUM2", (111, 172), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(3)? "STYSNUM3" : "STGNUM3", (123, 172), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(4)? "STYSNUM4" : "STGNUM4", (135, 172), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(5)? "STYSNUM5" : "STGNUM5", (111, 182), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(6)? "STYSNUM6" : "STGNUM6", (123, 182), DI_ITEM_OFFSETS);
|
||||
DrawImage(CPlayer.HasWeaponsInSlot(7)? "STYSNUM7" : "STGNUM7", (135, 182), DI_ITEM_OFFSETS);
|
||||
}
|
||||
|
||||
if (multiplayer)
|
||||
|
|
Loading…
Reference in a new issue