Make particle texture slightly higher quality
This commit is contained in:
parent
edd9b6c69c
commit
ca046d26c5
5 changed files with 18 additions and 16 deletions
|
|
@ -65,7 +65,7 @@ namespace swrenderer
|
|||
int fuzzpos;
|
||||
int fuzzviewheight;
|
||||
|
||||
uint32_t particle_texture[16 * 16];
|
||||
uint32_t particle_texture[PARTICLE_TEXTURE_SIZE * PARTICLE_TEXTURE_SIZE];
|
||||
|
||||
short zeroarray[MAXWIDTH];
|
||||
short screenheightarray[MAXWIDTH];
|
||||
|
|
@ -237,16 +237,17 @@ namespace swrenderer
|
|||
|
||||
void R_InitParticleTexture()
|
||||
{
|
||||
for (int y = 0; y < 16; y++)
|
||||
float center = PARTICLE_TEXTURE_SIZE * 0.5f;
|
||||
for (int y = 0; y < PARTICLE_TEXTURE_SIZE; y++)
|
||||
{
|
||||
for (int x = 0; x < 16; x++)
|
||||
for (int x = 0; x < PARTICLE_TEXTURE_SIZE; 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);
|
||||
float dx = (center - x - 0.5f) / center;
|
||||
float dy = (center - y - 0.5f) / center;
|
||||
float dist2 = dx * dx + dy * dy;
|
||||
float alpha = clamp(1.1f - dist2 * 1.1f, 0.0f, 1.0f);
|
||||
|
||||
particle_texture[x + y * 16] = (int)(alpha * 64.0f + 0.5f);
|
||||
particle_texture[x + y * PARTICLE_TEXTURE_SIZE] = (int)(alpha * 128.0f + 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue