Change the shape of the particle texture

This commit is contained in:
Magnus Norddahl 2017-01-13 15:43:06 +01:00
parent e1506df8a6
commit edd9b6c69c
5 changed files with 23 additions and 46 deletions

View file

@ -65,6 +65,8 @@ namespace swrenderer
int fuzzpos;
int fuzzviewheight;
uint32_t particle_texture[16 * 16];
short zeroarray[MAXWIDTH];
short screenheightarray[MAXWIDTH];
@ -233,6 +235,22 @@ namespace swrenderer
}
}
void R_InitParticleTexture()
{
for (int y = 0; y < 16; y++)
{
for (int x = 0; x < 16; x++)
{
float dx = (8 - x) / 8.0f;
float dy = (8 - y) / 8.0f;
float dist = sqrt(dx * dx + dy * dy);
float alpha = clamp(3.0f - dist * 3.0f, 0.0f, 1.0f);
particle_texture[x + y * 16] = (int)(alpha * 64.0f + 0.5f);
}
}
}
namespace
{
bool R_SetBlendFunc(int op, fixed_t fglevel, fixed_t bglevel, int flags)

View file

@ -121,6 +121,8 @@ namespace swrenderer
extern int fuzzpos;
extern int fuzzviewheight;
extern uint32_t particle_texture[16 * 16];
extern bool r_swtruecolor;
class SWPixelFormatDrawers
@ -171,6 +173,7 @@ namespace swrenderer
void R_InitColumnDrawers();
void R_InitShadeMaps();
void R_InitFuzzTable(int fuzzoff);
void R_InitParticleTexture();
bool R_SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap);
bool R_SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap);

View file

@ -2768,29 +2768,6 @@ namespace swrenderer
/////////////////////////////////////////////////////////////////////////////
namespace
{
static uint32_t particle_texture[16 * 16] =
{
1 * 1, 2 * 1, 3 * 1, 4 * 1, 5 * 1, 6 * 1, 7 * 1, 8 * 1, 8 * 1, 7 * 1, 6 * 1, 5 * 1, 4 * 1, 3 * 1, 2 * 1, 1 * 1,
1 * 2, 2 * 2, 3 * 2, 4 * 2, 5 * 2, 6 * 2, 7 * 2, 8 * 2, 8 * 2, 7 * 2, 6 * 2, 5 * 2, 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* 6, 1 * 6,
1 * 5, 2 * 5, 3 * 5, 4 * 5, 5 * 5, 6 * 5, 7 * 5, 8 * 5, 8 * 5, 7 * 5, 6 * 5, 5 * 5, 4 * 5, 3 * 5, 2 * 5, 1 * 5,
1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4, 7 * 4, 8 * 4, 8 * 4, 7 * 4, 6 * 4, 5 * 4, 4 * 4, 3 * 4, 2 * 4, 1 * 4,
1 * 3, 2 * 3, 3 * 3, 4 * 3, 5 * 3, 6 * 3, 7 * 3, 8 * 3, 8 * 3, 7 * 3, 6 * 3, 5 * 3, 4 * 3, 3 * 3, 2 * 3, 1 * 3,
1 * 2, 2 * 2, 3 * 2, 4 * 2, 5 * 2, 6 * 2, 7 * 2, 8 * 2, 8 * 2, 7 * 2, 6 * 2, 5 * 2, 4 * 2, 3 * 2, 2 * 2, 1 * 2,
1 * 1, 2 * 1, 3 * 1, 4 * 1, 5 * 1, 6 * 1, 7 * 1, 8 * 1, 8 * 1, 7 * 1, 6 * 1, 5 * 1, 4 * 1, 3 * 1, 2 * 1, 1 * 1
};
}
DrawParticleColumnPalCommand::DrawParticleColumnPalCommand(uint8_t *dest, int dest_y, int pitch, int count, uint32_t fg, uint32_t alpha, uint32_t fracposx)
{
_dest = dest;

View file

@ -942,29 +942,6 @@ namespace swrenderer
/////////////////////////////////////////////////////////////////////////////
namespace
{
static uint32_t particle_texture[16 * 16] =
{
1 * 1, 2 * 1, 3 * 1, 4 * 1, 5 * 1, 6 * 1, 7 * 1, 8 * 1, 8 * 1, 7 * 1, 6 * 1, 5 * 1, 4 * 1, 3 * 1, 2 * 1, 1 * 1,
1 * 2, 2 * 2, 3 * 2, 4 * 2, 5 * 2, 6 * 2, 7 * 2, 8 * 2, 8 * 2, 7 * 2, 6 * 2, 5 * 2, 4 * 2, 3 * 2, 2 * 2, 1 * 2,
1 * 3, 2 * 3, 3 * 3, 4 * 3, 5 * 3, 6 * 3, 7 * 3, 8 * 3, 8 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5, 5 * 5, 4 * 5, 3 * 5, 2 * 5, 1 * 5,
1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4, 7 * 4, 8 * 4, 8 * 4, 7 * 4, 6 * 4, 5 * 4, 4 * 4, 3 * 4, 2 * 4, 1 * 4,
1 * 3, 2 * 3, 3 * 3, 4 * 3, 5 * 3, 6 * 3, 7 * 3, 8 * 3, 8 * 3, 7 * 3, 6 * 3, 5 * 3, 4 * 3, 3 * 3, 2 * 3, 1 * 3,
1 * 2, 2 * 2, 3 * 2, 4 * 2, 5 * 2, 6 * 2, 7 * 2, 8 * 2, 8 * 2, 7 * 2, 6 * 2, 5 * 2, 4 * 2, 3 * 2, 2 * 2, 1 * 2,
1 * 1, 2 * 1, 3 * 1, 4 * 1, 5 * 1, 6 * 1, 7 * 1, 8 * 1, 8 * 1, 7 * 1, 6 * 1, 5 * 1, 4 * 1, 3 * 1, 2 * 1, 1 * 1
};
}
DrawParticleColumnRGBACommand::DrawParticleColumnRGBACommand(uint32_t *dest, int dest_y, int pitch, int count, uint32_t fg, uint32_t alpha, uint32_t fracposx)
{
_dest = dest;

View file

@ -163,6 +163,8 @@ namespace swrenderer
ylookup[i] = i * pitch;
}
}
R_InitParticleTexture();
}
void R_InitTextureMapping()