Don't copy the SkyDrawerArgs members now that drawer args are grouped by drawer family

This commit is contained in:
Magnus Norddahl 2017-02-24 04:03:27 +01:00
parent f76a039a76
commit 218708571e
2 changed files with 30 additions and 47 deletions

View file

@ -547,32 +547,20 @@ namespace swrenderer
/////////////////////////////////////////////////////////////////////////
PalSkyCommand::PalSkyCommand(const SkyDrawerArgs &args)
PalSkyCommand::PalSkyCommand(const SkyDrawerArgs &args) : args(args)
{
_dest = args.Dest();
_dest_y = args.DestY();
_count = args.Count();
_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)
{
uint8_t *dest = _dest;
int count = _count;
uint8_t *dest = args.Dest();
int count = args.Count();
int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
const uint8_t *source0 = _source;
int textureheight0 = _sourceheight[0];
const uint8_t *source0 = args.FrontTexturePixels();
int textureheight0 = args.FrontTextureHeight();
int32_t frac = _texturefrac;
int32_t fracstep = _iscale;
int32_t frac = args.TextureVPos();
int32_t fracstep = args.TextureVStep();
// Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color:
int start_fade = 2; // How fast it should fade out
@ -587,15 +575,15 @@ namespace swrenderer
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
int num_cores = thread->num_cores;
int skipped = thread->skipped_by_thread(_dest_y);
dest = thread->dest_for_thread(_dest_y, pitch, dest);
int skipped = thread->skipped_by_thread(args.DestY());
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * skipped;
fracstep *= num_cores;
pitch *= num_cores;
if (!fadeSky)
if (!args.FadeSky())
{
count = thread->count_for_thread(_dest_y, count);
count = thread->count_for_thread(args.DestY(), count);
for (int index = 0; index < count; index++)
{
@ -608,6 +596,9 @@ namespace swrenderer
return;
}
uint32_t solid_top = args.SolidTopColor();
uint32_t solid_bottom = args.SolidBottomColor();
int solid_top_r = RPART(solid_top);
int solid_top_g = GPART(solid_top);
int solid_top_b = BPART(solid_top);
@ -696,16 +687,16 @@ namespace swrenderer
void DrawDoubleSky1PalCommand::Execute(DrawerThread *thread)
{
uint8_t *dest = _dest;
int count = _count;
uint8_t *dest = args.Dest();
int count = args.Count();
int pitch = RenderViewport::Instance()->RenderTarget->GetPitch();
const uint8_t *source0 = _source;
const uint8_t *source1 = _source2;
int textureheight0 = _sourceheight[0];
uint32_t maxtextureheight1 = _sourceheight[1] - 1;
const uint8_t *source0 = args.FrontTexturePixels();
const uint8_t *source1 = args.BackTexturePixels();
int textureheight0 = args.FrontTextureHeight();
uint32_t maxtextureheight1 = args.BackTextureHeight() - 1;
int32_t frac = _texturefrac;
int32_t fracstep = _iscale;
int32_t frac = args.TextureVPos();
int32_t fracstep = args.TextureVStep();
// Find bands for top solid color, top fade, center textured, bottom fade, bottom solid color:
int start_fade = 2; // How fast it should fade out
@ -720,15 +711,15 @@ namespace swrenderer
end_fadebottom_y = clamp(end_fadebottom_y, 0, count);
int num_cores = thread->num_cores;
int skipped = thread->skipped_by_thread(_dest_y);
dest = thread->dest_for_thread(_dest_y, pitch, dest);
int skipped = thread->skipped_by_thread(args.DestY());
dest = thread->dest_for_thread(args.DestY(), pitch, dest);
frac += fracstep * skipped;
fracstep *= num_cores;
pitch *= num_cores;
if (!fadeSky)
if (!args.FadeSky())
{
count = thread->count_for_thread(_dest_y, count);
count = thread->count_for_thread(args.DestY(), count);
for (int index = 0; index < count; index++)
{
@ -748,6 +739,9 @@ namespace swrenderer
return;
}
uint32_t solid_top = args.SolidTopColor();
uint32_t solid_bottom = args.SolidBottomColor();
int solid_top_r = RPART(solid_top);
int solid_top_g = GPART(solid_top);
int solid_top_b = BPART(solid_top);

View file

@ -37,18 +37,7 @@ namespace swrenderer
FString DebugInfo() override { return "PalSkyCommand"; }
protected:
uint32_t solid_top;
uint32_t solid_bottom;
bool fadeSky;
uint8_t *_dest;
int _dest_y;
int _count;
const uint8_t *_source;
const uint8_t *_source2;
int _sourceheight[2];
uint32_t _iscale;
uint32_t _texturefrac;
SkyDrawerArgs args;
};
class DrawSingleSky1PalCommand : public PalSkyCommand { public: using PalSkyCommand::PalSkyCommand; void Execute(DrawerThread *thread) override; };