Convert r_wallsprite to a class

This commit is contained in:
Magnus Norddahl 2017-01-11 18:28:19 +01:00
parent 7bed0ffeb6
commit ee2811450d
4 changed files with 15 additions and 9 deletions

View file

@ -867,7 +867,7 @@ namespace swrenderer
{ {
if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE) if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
{ {
R_ProjectWallSprite(thing, sprite.pos, sprite.picnum, sprite.spriteScale, sprite.renderflags, spriteshade); RenderWallSprite::Project(thing, sprite.pos, sprite.picnum, sprite.spriteScale, sprite.renderflags, spriteshade);
} }
else if (sprite.voxel) else if (sprite.voxel)
{ {

View file

@ -599,7 +599,7 @@ namespace swrenderer
} }
else else
{ {
R_DrawWallSprite(spr, clipbot, cliptop); RenderWallSprite::Render(spr, clipbot, cliptop);
} }
} }
else else

View file

@ -59,7 +59,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
namespace swrenderer namespace swrenderer
{ {
void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade) void RenderWallSprite::Project(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade)
{ {
FWallCoords wallc; FWallCoords wallc;
double x1, x2; double x1, x2;
@ -135,7 +135,7 @@ namespace swrenderer
vis->wallc = wallc; vis->wallc = wallc;
} }
void R_DrawWallSprite(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip) void RenderWallSprite::Render(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip)
{ {
int x1, x2; int x1, x2;
double iyscale; double iyscale;
@ -223,7 +223,7 @@ namespace swrenderer
R_SetColorMapLight(usecolormap, light, shade); R_SetColorMapLight(usecolormap, light, shade);
} }
if (!R_ClipSpriteColumnWithPortals(x, spr)) if (!R_ClipSpriteColumnWithPortals(x, spr))
R_WallSpriteColumn(x, WallSpriteTile, maskedScaleY, sprflipvert, mfloorclip, mceilingclip); DrawColumn(x, WallSpriteTile, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
light += lightstep; light += lightstep;
x++; x++;
} }
@ -231,7 +231,7 @@ namespace swrenderer
R_FinishSetPatchStyle(); R_FinishSetPatchStyle();
} }
void R_WallSpriteColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip) void RenderWallSprite::DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip)
{ {
float iscale = swall[x] * maskedScaleY; float iscale = swall[x] * maskedScaleY;
double spryscale = 1 / iscale; double spryscale = 1 / iscale;

View file

@ -17,7 +17,13 @@
namespace swrenderer namespace swrenderer
{ {
void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade); class RenderWallSprite
void R_DrawWallSprite(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip); {
void R_WallSpriteColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip); public:
static void Project(AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade);
static void Render(vissprite_t *spr, const short *mfloorclip, const short *mceilingclip);
private:
static void DrawColumn(int x, FTexture *WallSpriteTile, float maskedScaleY, bool sprflipvert, const short *mfloorclip, const short *mceilingclip);
};
} }