mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Clean up SkyDrawerArgs interface
This commit is contained in:
parent
98fa2976fa
commit
0c61b56655
8 changed files with 110 additions and 65 deletions
|
@ -56,8 +56,8 @@ namespace swrenderer
|
|||
virtual void DrawWallAddClampColumn(const WallDrawerArgs &args) = 0;
|
||||
virtual void DrawWallSubClampColumn(const WallDrawerArgs &args) = 0;
|
||||
virtual void DrawWallRevSubClampColumn(const WallDrawerArgs &args) = 0;
|
||||
virtual void DrawSingleSkyColumn(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) = 0;
|
||||
virtual void DrawDoubleSkyColumn(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) = 0;
|
||||
virtual void DrawSingleSkyColumn(const SkyDrawerArgs &args) = 0;
|
||||
virtual void DrawDoubleSkyColumn(const SkyDrawerArgs &args) = 0;
|
||||
virtual void DrawColumn(const SpriteDrawerArgs &args) = 0;
|
||||
virtual void FillColumn(const SpriteDrawerArgs &args) = 0;
|
||||
virtual void FillAddColumn(const SpriteDrawerArgs &args) = 0;
|
||||
|
|
|
@ -559,18 +559,21 @@ namespace swrenderer
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PalSkyCommand::PalSkyCommand(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) : solid_top(solid_top), solid_bottom(solid_bottom), fadeSky(fadeSky)
|
||||
PalSkyCommand::PalSkyCommand(const SkyDrawerArgs &args)
|
||||
{
|
||||
_dest = args.Dest();
|
||||
_dest_y = args.DestY();
|
||||
_count = args.dc_count;
|
||||
_count = args.Count();
|
||||
_pitch = dc_pitch;
|
||||
_source = args.dc_wall_source;
|
||||
_source2 = args.dc_wall_source2;
|
||||
_sourceheight[0] = args.dc_wall_sourceheight[0];
|
||||
_sourceheight[1] = args.dc_wall_sourceheight[1];
|
||||
_iscale = args.dc_wall_iscale;
|
||||
_texturefrac = args.dc_wall_texturefrac;
|
||||
_source = args.FrontTexturePixels();
|
||||
_source2 = args.BackTexturePixels();
|
||||
_sourceheight[0] = args.FrontTextureHeight();
|
||||
_sourceheight[1] = args.BackTextureHeight();
|
||||
_iscale = args.TextureVStep();
|
||||
_texturefrac = args.TextureVPos();
|
||||
solid_top = args.SolidTopColor();
|
||||
solid_bottom = args.SolidBottomColor();
|
||||
fadeSky = args.FadeSky();
|
||||
}
|
||||
|
||||
void DrawSingleSky1PalCommand::Execute(DrawerThread *thread)
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace swrenderer
|
|||
class PalSkyCommand : public DrawerCommand
|
||||
{
|
||||
public:
|
||||
PalSkyCommand(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
PalSkyCommand(const SkyDrawerArgs &args);
|
||||
FString DebugInfo() override { return "PalSkyCommand"; }
|
||||
|
||||
protected:
|
||||
|
@ -255,8 +255,8 @@ namespace swrenderer
|
|||
void DrawWallAddClampColumn(const WallDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>(args); }
|
||||
void DrawWallSubClampColumn(const WallDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallSubClamp1PalCommand>(args); }
|
||||
void DrawWallRevSubClampColumn(const WallDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1PalCommand>(args); }
|
||||
void DrawSingleSkyColumn(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1PalCommand>(args, solid_top, solid_bottom, fadeSky); }
|
||||
void DrawDoubleSkyColumn(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1PalCommand>(args, solid_top, solid_bottom, fadeSky); }
|
||||
void DrawSingleSkyColumn(const SkyDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1PalCommand>(args); }
|
||||
void DrawDoubleSkyColumn(const SkyDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1PalCommand>(args); }
|
||||
void DrawColumn(const SpriteDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnPalCommand>(args); }
|
||||
void FillColumn(const SpriteDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnPalCommand>(args); }
|
||||
void FillAddColumn(const SpriteDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnAddPalCommand>(args); }
|
||||
|
|
|
@ -302,21 +302,21 @@ namespace swrenderer
|
|||
return d;
|
||||
}
|
||||
|
||||
DrawSkyLLVMCommand::DrawSkyLLVMCommand(const SkyDrawerArgs &drawerargs, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||
DrawSkyLLVMCommand::DrawSkyLLVMCommand(const SkyDrawerArgs &drawerargs)
|
||||
{
|
||||
args.dest = (uint32_t*)drawerargs.Dest();
|
||||
args.dest_y = drawerargs.DestY();
|
||||
args.count = drawerargs.dc_count;
|
||||
args.count = drawerargs.Count();
|
||||
args.pitch = dc_pitch;
|
||||
args.texturefrac[0] = drawerargs.dc_wall_texturefrac;
|
||||
args.iscale[0] = drawerargs.dc_wall_iscale;
|
||||
args.source0[0] = (const uint32_t *)drawerargs.dc_wall_source;
|
||||
args.source1[0] = (const uint32_t *)drawerargs.dc_wall_source2;
|
||||
args.textureheight0 = drawerargs.dc_wall_sourceheight[0];
|
||||
args.textureheight1 = drawerargs.dc_wall_sourceheight[1];
|
||||
args.top_color = solid_top;
|
||||
args.bottom_color = solid_bottom;
|
||||
args.flags = fadeSky ? DrawSkyArgs::fade_sky : 0;
|
||||
args.texturefrac[0] = drawerargs.TextureVPos();
|
||||
args.iscale[0] = drawerargs.TextureVStep();
|
||||
args.source0[0] = (const uint32_t *)drawerargs.FrontTexturePixels();
|
||||
args.source1[0] = (const uint32_t *)drawerargs.BackTexturePixels();
|
||||
args.textureheight0 = drawerargs.FrontTextureHeight();
|
||||
args.textureheight1 = drawerargs.BackTextureHeight();
|
||||
args.top_color = drawerargs.SolidTopColor();
|
||||
args.bottom_color = drawerargs.SolidBottomColor();
|
||||
args.flags = drawerargs.FadeSky() ? DrawSkyArgs::fade_sky : 0;
|
||||
}
|
||||
|
||||
FString DrawSkyLLVMCommand::DebugInfo()
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace swrenderer
|
|||
WorkerThreadData ThreadData(DrawerThread *thread);
|
||||
|
||||
public:
|
||||
DrawSkyLLVMCommand(const SkyDrawerArgs &drawerargs, uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
DrawSkyLLVMCommand(const SkyDrawerArgs &drawerargs);
|
||||
FString DebugInfo() override;
|
||||
};
|
||||
|
||||
|
@ -360,8 +360,8 @@ namespace swrenderer
|
|||
void DrawWallAddClampColumn(const WallDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>(args); }
|
||||
void DrawWallSubClampColumn(const WallDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>(args); }
|
||||
void DrawWallRevSubClampColumn(const WallDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>(args); }
|
||||
void DrawSingleSkyColumn(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool skyFade) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1LLVMCommand>(args, solid_top, solid_bottom, skyFade); }
|
||||
void DrawDoubleSkyColumn(const SkyDrawerArgs &args, uint32_t solid_top, uint32_t solid_bottom, bool skyFade) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1LLVMCommand>(args, solid_top, solid_bottom, skyFade); }
|
||||
void DrawSingleSkyColumn(const SkyDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawSingleSky1LLVMCommand>(args); }
|
||||
void DrawDoubleSkyColumn(const SkyDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawDoubleSky1LLVMCommand>(args); }
|
||||
void DrawColumn(const SpriteDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<DrawColumnLLVMCommand>(args); }
|
||||
void FillColumn(const SpriteDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnLLVMCommand>(args); }
|
||||
void FillAddColumn(const SpriteDrawerArgs &args) override { DrawerCommandQueue::QueueCommand<FillColumnAddLLVMCommand>(args); }
|
||||
|
|
|
@ -708,14 +708,14 @@ namespace swrenderer
|
|||
Drawers()->DrawColoredSpan(*this, y, x1, x2);
|
||||
}
|
||||
|
||||
void SkyDrawerArgs::DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||
void SkyDrawerArgs::DrawSingleSkyColumn()
|
||||
{
|
||||
Drawers()->DrawSingleSkyColumn(*this, solid_top, solid_bottom, fadeSky);
|
||||
Drawers()->DrawSingleSkyColumn(*this);
|
||||
}
|
||||
|
||||
void SkyDrawerArgs::DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky)
|
||||
void SkyDrawerArgs::DrawDoubleSkyColumn()
|
||||
{
|
||||
Drawers()->DrawDoubleSkyColumn(*this, solid_top, solid_bottom, fadeSky);
|
||||
Drawers()->DrawDoubleSkyColumn(*this);
|
||||
}
|
||||
|
||||
void SkyDrawerArgs::SetDest(int x, int y)
|
||||
|
@ -725,6 +725,39 @@ namespace swrenderer
|
|||
dc_dest_y = y;
|
||||
}
|
||||
|
||||
void SkyDrawerArgs::SetFrontTexture(FTexture *texture, uint32_t column)
|
||||
{
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
dc_source = (const uint8_t *)texture->GetColumnBgra(column, nullptr);
|
||||
dc_sourceheight = texture->GetHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_source = texture->GetColumn(column, nullptr);
|
||||
dc_sourceheight = texture->GetHeight();
|
||||
}
|
||||
}
|
||||
|
||||
void SkyDrawerArgs::SetBackTexture(FTexture *texture, uint32_t column)
|
||||
{
|
||||
if (texture == nullptr)
|
||||
{
|
||||
dc_source2 = nullptr;
|
||||
dc_sourceheight2 = 1;
|
||||
}
|
||||
else if (r_swtruecolor)
|
||||
{
|
||||
dc_source2 = (const uint8_t *)texture->GetColumnBgra(column, nullptr);
|
||||
dc_sourceheight2 = texture->GetHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
dc_source2 = texture->GetColumn(column, nullptr);
|
||||
dc_sourceheight2 = texture->GetHeight();
|
||||
}
|
||||
}
|
||||
|
||||
void SpriteDrawerArgs::FillColumn()
|
||||
{
|
||||
Drawers()->FillColumn(*this);
|
||||
|
|
|
@ -46,24 +46,48 @@ namespace swrenderer
|
|||
class SkyDrawerArgs : public DrawerArgs
|
||||
{
|
||||
public:
|
||||
const uint8_t *dc_wall_source;
|
||||
const uint8_t *dc_wall_source2;
|
||||
uint32_t dc_wall_sourceheight[2];
|
||||
uint32_t dc_wall_texturefrac;
|
||||
uint32_t dc_wall_iscale;
|
||||
int dc_count;
|
||||
|
||||
void SetDest(int x, int y);
|
||||
void SetCount(int count) { dc_count = count; }
|
||||
void SetFrontTexture(FTexture *texture, uint32_t column);
|
||||
void SetBackTexture(FTexture *texture, uint32_t column);
|
||||
void SetTextureVPos(uint32_t texturefrac) { dc_texturefrac = texturefrac; }
|
||||
void SetTextureVStep(uint32_t iscale) { dc_iscale = iscale; }
|
||||
void SetSolidTop(uint32_t color) { solid_top = color; }
|
||||
void SetSolidBottom(uint32_t color) { solid_bottom = color; }
|
||||
void SetFadeSky(bool enable) { fadeSky = enable; }
|
||||
|
||||
uint8_t *Dest() const { return dc_dest; }
|
||||
int DestY() const { return dc_dest_y; }
|
||||
int Count() const { return dc_count; }
|
||||
|
||||
void DrawSingleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
void DrawDoubleSkyColumn(uint32_t solid_top, uint32_t solid_bottom, bool fadeSky);
|
||||
uint32_t TextureVPos() const { return dc_texturefrac; }
|
||||
uint32_t TextureVStep() const { return dc_iscale; }
|
||||
|
||||
uint32_t SolidTopColor() const { return solid_top; }
|
||||
uint32_t SolidBottomColor() const { return solid_bottom; }
|
||||
bool FadeSky() const { return fadeSky; }
|
||||
|
||||
const uint8_t *FrontTexturePixels() const { return dc_source; }
|
||||
const uint8_t *BackTexturePixels() const { return dc_source2; }
|
||||
int FrontTextureHeight() const { return dc_sourceheight; }
|
||||
int BackTextureHeight() const { return dc_sourceheight; }
|
||||
|
||||
void DrawSingleSkyColumn();
|
||||
void DrawDoubleSkyColumn();
|
||||
|
||||
private:
|
||||
uint8_t *dc_dest = nullptr;
|
||||
int dc_dest_y = 0;
|
||||
int dc_count = 0;
|
||||
const uint8_t *dc_source;
|
||||
const uint8_t *dc_source2;
|
||||
uint32_t dc_sourceheight;
|
||||
uint32_t dc_sourceheight2;
|
||||
uint32_t dc_texturefrac;
|
||||
uint32_t dc_iscale;
|
||||
uint32_t solid_top;
|
||||
uint32_t solid_bottom;
|
||||
bool fadeSky;
|
||||
};
|
||||
|
||||
class SpanDrawerArgs : public DrawerArgs
|
||||
|
|
|
@ -197,35 +197,20 @@ namespace swrenderer
|
|||
angle1 = (uint32_t)((UMulScale16(ang, frontcyl) + frontpos) >> FRACBITS);
|
||||
angle2 = (uint32_t)((UMulScale16(ang, backcyl) + backpos) >> FRACBITS);
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
drawerargs.dc_wall_source = (const uint8_t *)frontskytex->GetColumnBgra(angle1, nullptr);
|
||||
drawerargs.dc_wall_source2 = backskytex ? (const uint8_t *)backskytex->GetColumnBgra(angle2, nullptr) : nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawerargs.dc_wall_source = (const uint8_t *)frontskytex->GetColumn(angle1, nullptr);
|
||||
drawerargs.dc_wall_source2 = backskytex ? (const uint8_t *)backskytex->GetColumn(angle2, nullptr) : nullptr;
|
||||
}
|
||||
|
||||
drawerargs.dc_wall_iscale = uv_step;
|
||||
drawerargs.dc_wall_texturefrac = uv_pos;
|
||||
|
||||
drawerargs.dc_wall_sourceheight[0] = height;
|
||||
drawerargs.dc_wall_sourceheight[1] = backskytex ? backskytex->GetHeight() : height;
|
||||
int pixelsize = r_swtruecolor ? 4 : 1;
|
||||
drawerargs.SetFrontTexture(frontskytex, angle1);
|
||||
drawerargs.SetBackTexture(backskytex, angle2);
|
||||
drawerargs.SetTextureVStep(uv_step);
|
||||
drawerargs.SetTextureVPos(uv_pos);
|
||||
drawerargs.SetDest(start_x, y1);
|
||||
drawerargs.dc_count = y2 - y1;
|
||||
|
||||
uint32_t solid_top = frontskytex->GetSkyCapColor(false);
|
||||
uint32_t solid_bottom = frontskytex->GetSkyCapColor(true);
|
||||
|
||||
bool fadeSky = (r_skymode == 2 && !(level.flags & LEVEL_FORCETILEDSKY));
|
||||
drawerargs.SetCount(y2 - y1);
|
||||
drawerargs.SetFadeSky(r_skymode == 2 && !(level.flags & LEVEL_FORCETILEDSKY));
|
||||
drawerargs.SetSolidTop(frontskytex->GetSkyCapColor(false));
|
||||
drawerargs.SetSolidBottom(frontskytex->GetSkyCapColor(true));
|
||||
|
||||
if (!backskytex)
|
||||
drawerargs.DrawSingleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
drawerargs.DrawSingleSkyColumn();
|
||||
else
|
||||
drawerargs.DrawDoubleSkyColumn(solid_top, solid_bottom, fadeSky);
|
||||
drawerargs.DrawDoubleSkyColumn();
|
||||
}
|
||||
|
||||
void RenderSkyPlane::DrawSkyColumn(int start_x, int y1, int y2)
|
||||
|
|
Loading…
Reference in a new issue