From: havoc Date: Sat, 15 Jan 2005 02:11:53 +0000 (+0000) Subject: fixed a bug in texture generator that made all the particles too large in the particl... X-Git-Tag: xonotic-v0.1.0preview~5212 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dc6e9d0eb1f32abe3aecb9350ce29d26dd596209;p=xonotic%2Fdarkplaces.git fixed a bug in texture generator that made all the particles too large in the particle font by one pixel (now they're smaller than their frame, like they were supposed to be), this fixes all the sharp edges on particles changed nexbeam to be quite a bit brighter in the center than the sides (as I really wanted it all along) nexbeam no longer scrolls its texture (looked odd) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4937 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_particles.c b/cl_particles.c index 2278100a..d4c68ae8 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -1629,10 +1629,10 @@ static void R_InitParticleTexture (void) m = 0; for (y = 0;y < PARTICLETEXTURESIZE;y++) { - dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); for (x = 0;x < PARTICLETEXTURESIZE;x++) { - dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); d = (noise2[y][x] - 128) * 3 + 192; if (d > 0) d = d * (1-(dx*dx+dy*dy)); @@ -1656,10 +1656,10 @@ static void R_InitParticleTexture (void) f2 = 255.0f * ((15.0f - i) / 15.0f); for (y = 0;y < PARTICLETEXTURESIZE;y++) { - dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); for (x = 0;x < PARTICLETEXTURESIZE;x++) { - dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); f = f2 * (1.0 - 4.0f * fabs(radius - sqrt(dx*dx+dy*dy))); data[y][x][3] = (int) (bound(0.0f, f, 255.0f)); } @@ -1671,10 +1671,10 @@ static void R_InitParticleTexture (void) memset(&data[0][0][0], 255, sizeof(data)); for (y = 0;y < PARTICLETEXTURESIZE;y++) { - dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); for (x = 0;x < PARTICLETEXTURESIZE;x++) { - dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); d = 256 * (1 - (dx*dx+dy*dy)); d = bound(0, d, 255); data[y][x][3] = (qbyte) d; @@ -1688,7 +1688,7 @@ static void R_InitParticleTexture (void) VectorNormalize(light); for (y = 0;y < PARTICLETEXTURESIZE;y++) { - dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); // stretch upper half of bubble by +50% and shrink lower half by -50% // (this gives an elongated teardrop shape) if (dy > 0.5f) @@ -1697,7 +1697,7 @@ static void R_InitParticleTexture (void) dy = (dy - 0.5f) / 1.5f; for (x = 0;x < PARTICLETEXTURESIZE;x++) { - dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); // shrink bubble width to half dx *= 2.0f; data[y][x][3] = shadebubble(dx, dy, light); @@ -1711,10 +1711,10 @@ static void R_InitParticleTexture (void) VectorNormalize(light); for (y = 0;y < PARTICLETEXTURESIZE;y++) { - dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dy = (y - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); for (x = 0;x < PARTICLETEXTURESIZE;x++) { - dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f+1); + dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); data[y][x][3] = shadebubble(dx, dy, light); } } @@ -1778,11 +1778,11 @@ static void R_InitParticleTexture (void) m = 0; for (y = 0;y < 64;y++) { - dy = (y - 0.5f*64) / (64*0.5f+1); + dy = (y - 0.5f*64) / (64*0.5f-1); for (x = 0;x < 16;x++) { - dx = (x - 0.5f*16) / (16*0.5f+1); - d = (1 - (dx*dx)) * noise3[y][x]; + dx = (x - 0.5f*16) / (16*0.5f-2); + d = (1 - sqrt(fabs(dx))) * noise3[y][x]; data2[y][x][0] = data2[y][x][1] = data2[y][x][2] = (qbyte) bound(0, d, 255); data2[y][x][3] = 255; } @@ -1954,8 +1954,8 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2) R_CalcBeam_Vertex3f(particle_vertex3f, p->org, p->vel2, p->scalex); VectorSubtract(p->vel2, p->org, up); VectorNormalizeFast(up); - v[0] = DotProduct(p->org, up) * (1.0f / 64.0f) - cl.time * 0.25; - v[1] = DotProduct(p->vel2, up) * (1.0f / 64.0f) - cl.time * 0.25; + v[0] = DotProduct(p->org, up) * (1.0f / 64.0f); + v[1] = DotProduct(p->vel2, up) * (1.0f / 64.0f); particle_texcoord2f[0] = 1;particle_texcoord2f[1] = v[0]; particle_texcoord2f[2] = 0;particle_texcoord2f[3] = v[0]; particle_texcoord2f[4] = 0;particle_texcoord2f[5] = v[1];