mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-18 23:52:02 +00:00
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,8 @@ namespace swrenderer
|
|||
extern int fuzzpos;
|
||||
extern int fuzzviewheight;
|
||||
|
||||
extern uint32_t particle_texture[16 * 16];
|
||||
#define PARTICLE_TEXTURE_SIZE 64
|
||||
extern uint32_t particle_texture[PARTICLE_TEXTURE_SIZE * PARTICLE_TEXTURE_SIZE];
|
||||
|
||||
extern bool r_swtruecolor;
|
||||
|
||||
|
|
|
@ -2788,10 +2788,10 @@ namespace swrenderer
|
|||
uint8_t *dest = thread->dest_for_thread(_dest_y, _pitch, _dest);
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
|
||||
const uint32_t *source = &particle_texture[(_fracposx >> FRACBITS) * 16];
|
||||
const uint32_t *source = &particle_texture[(_fracposx >> FRACBITS) * PARTICLE_TEXTURE_SIZE];
|
||||
uint32_t particle_alpha = _alpha;
|
||||
|
||||
uint32_t fracstep = 16 * FRACUNIT / _count;
|
||||
uint32_t fracstep = PARTICLE_TEXTURE_SIZE * FRACUNIT / _count;
|
||||
uint32_t fracpos = fracstep * thread->skipped_by_thread(_dest_y) + fracstep / 2;
|
||||
fracstep *= thread->num_cores;
|
||||
|
||||
|
@ -2801,7 +2801,7 @@ namespace swrenderer
|
|||
|
||||
for (int y = 0; y < count; y++)
|
||||
{
|
||||
uint32_t alpha = (source[fracpos >> FRACBITS] * particle_alpha) >> 6;
|
||||
uint32_t alpha = (source[fracpos >> FRACBITS] * particle_alpha) >> 7;
|
||||
uint32_t inv_alpha = 256 - alpha;
|
||||
|
||||
int bg = *dest;
|
||||
|
|
|
@ -962,10 +962,10 @@ namespace swrenderer
|
|||
uint32_t *dest = thread->dest_for_thread(_dest_y, _pitch, _dest);
|
||||
int pitch = _pitch * thread->num_cores;
|
||||
|
||||
const uint32_t *source = &particle_texture[(_fracposx >> FRACBITS) * 16];
|
||||
const uint32_t *source = &particle_texture[(_fracposx >> FRACBITS) * PARTICLE_TEXTURE_SIZE];
|
||||
uint32_t particle_alpha = _alpha;
|
||||
|
||||
uint32_t fracstep = 16 * FRACUNIT / _count;
|
||||
uint32_t fracstep = PARTICLE_TEXTURE_SIZE * FRACUNIT / _count;
|
||||
uint32_t fracpos = fracstep * thread->skipped_by_thread(_dest_y) + fracstep / 2;
|
||||
fracstep *= thread->num_cores;
|
||||
|
||||
|
@ -975,7 +975,7 @@ namespace swrenderer
|
|||
|
||||
for (int y = 0; y < count; y++)
|
||||
{
|
||||
uint32_t alpha = (source[fracpos >> FRACBITS] * particle_alpha) >> 6;
|
||||
uint32_t alpha = (source[fracpos >> FRACBITS] * particle_alpha) >> 7;
|
||||
uint32_t inv_alpha = 256 - alpha;
|
||||
|
||||
uint32_t bg_red = (*dest >> 16) & 0xff;
|
||||
|
|
|
@ -249,7 +249,7 @@ namespace swrenderer
|
|||
|
||||
spacing = RenderTarget->GetPitch();
|
||||
|
||||
uint32_t fracstepx = 16 * FRACUNIT / countbase;
|
||||
uint32_t fracstepx = PARTICLE_TEXTURE_SIZE * FRACUNIT / countbase;
|
||||
uint32_t fracposx = fracstepx / 2;
|
||||
|
||||
if (r_swtruecolor)
|
||||
|
|
Loading…
Reference in a new issue