Convert r_particle to a class

This commit is contained in:
Magnus Norddahl 2017-01-11 18:14:04 +01:00
parent 7dfb46b8d9
commit deae5bb1a6
4 changed files with 15 additions and 9 deletions

View file

@ -710,7 +710,7 @@ namespace swrenderer
int shade = LIGHT2SHADE((floorlightlevel + ceilinglightlevel) / 2 + r_actualextralight);
for (WORD i = ParticlesInSubsec[(unsigned int)(sub - subsectors)]; i != NO_PARTICLE; i = Particles[i].snext)
{
R_ProjectParticle(Particles + i, subsectors[sub - subsectors].sector, shade, FakeSide);
RenderParticle::Project(Particles + i, subsectors[sub - subsectors].sector, shade, FakeSide);
}
}

View file

@ -57,7 +57,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
namespace swrenderer
{
void R_ProjectParticle(particle_t *particle, const sector_t *sector, int shade, WaterFakeSide fakeside)
void RenderParticle::Project(particle_t *particle, const sector_t *sector, int shade, WaterFakeSide fakeside)
{
double tr_x, tr_y;
double tx, ty;
@ -222,7 +222,7 @@ namespace swrenderer
}
}
void R_DrawParticle(vissprite_t *vis)
void RenderParticle::Render(vissprite_t *vis)
{
using namespace drawerargs;
@ -236,7 +236,7 @@ namespace swrenderer
if (ycount <= 0 || countbase <= 0)
return;
R_DrawMaskedSegsBehindParticle(vis);
DrawMaskedSegsBehindParticle(vis);
uint32_t fg = LightBgra::shade_pal_index_simple(color, LightBgra::calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS)));
@ -271,7 +271,7 @@ namespace swrenderer
}
}
void R_DrawMaskedSegsBehindParticle(const vissprite_t *vis)
void RenderParticle::DrawMaskedSegsBehindParticle(const vissprite_t *vis)
{
const int x1 = vis->x1;
const int x2 = vis->x2;

View file

@ -18,7 +18,13 @@
namespace swrenderer
{
void R_ProjectParticle(particle_t *, const sector_t *sector, int shade, WaterFakeSide fakeside);
void R_DrawParticle(vissprite_t *);
void R_DrawMaskedSegsBehindParticle(const vissprite_t *vis);
class RenderParticle
{
public:
static void Project(particle_t *, const sector_t *sector, int shade, WaterFakeSide fakeside);
static void Render(vissprite_t *);
private:
static void DrawMaskedSegsBehindParticle(const vissprite_t *vis);
};
}

View file

@ -257,7 +257,7 @@ namespace swrenderer
// kg3D - reject invisible parts
if ((clip3d->fake3D & FAKE3D_CLIPBOTTOM) && spr->gpos.Z <= clip3d->sclipBottom) return;
if ((clip3d->fake3D & FAKE3D_CLIPTOP) && spr->gpos.Z >= clip3d->sclipTop) return;
R_DrawParticle(spr);
RenderParticle::Render(spr);
return;
}