|
|
1.1 ! root 1: // d_part.c: software driver module for drawing particles ! 2: ! 3: #include "quakedef.h" ! 4: #include "d_local.h" ! 5: ! 6: ! 7: /* ! 8: ============== ! 9: D_EndParticles ! 10: ============== ! 11: */ ! 12: void D_EndParticles (void) ! 13: { ! 14: // not used by software driver ! 15: } ! 16: ! 17: ! 18: /* ! 19: ============== ! 20: D_StartParticles ! 21: ============== ! 22: */ ! 23: void D_StartParticles (void) ! 24: { ! 25: // not used by software driver ! 26: } ! 27: ! 28: ! 29: #if !id386 ! 30: ! 31: /* ! 32: ============== ! 33: D_DrawParticle ! 34: ============== ! 35: */ ! 36: void D_DrawParticle (particle_t *pparticle) ! 37: { ! 38: vec3_t local, transformed; ! 39: float zi; ! 40: byte *pdest; ! 41: short *pz; ! 42: int i, izi, pix, count, u, v; ! 43: ! 44: // transform point ! 45: VectorSubtract (pparticle->org, r_origin, local); ! 46: ! 47: transformed[0] = DotProduct(local, r_pright); ! 48: transformed[1] = DotProduct(local, r_pup); ! 49: transformed[2] = DotProduct(local, r_ppn); ! 50: ! 51: if (transformed[2] < PARTICLE_Z_CLIP) ! 52: return; ! 53: ! 54: // project the point ! 55: // FIXME: preadjust xcenter and ycenter ! 56: zi = 1.0 / transformed[2]; ! 57: u = (int)(xcenter + zi * transformed[0] + 0.5); ! 58: v = (int)(ycenter - zi * transformed[1] + 0.5); ! 59: ! 60: if ((v > d_vrectbottom_particle) || ! 61: (u > d_vrectright_particle) || ! 62: (v < d_vrecty) || ! 63: (u < d_vrectx)) ! 64: { ! 65: return; ! 66: } ! 67: ! 68: pz = d_pzbuffer + (d_zwidth * v) + u; ! 69: pdest = d_viewbuffer + d_scantable[v] + u; ! 70: izi = (int)(zi * 0x8000); ! 71: ! 72: pix = izi >> d_pix_shift; ! 73: ! 74: if (pix < d_pix_min) ! 75: pix = d_pix_min; ! 76: else if (pix > d_pix_max) ! 77: pix = d_pix_max; ! 78: ! 79: switch (pix) ! 80: { ! 81: case 1: ! 82: count = 1 << d_y_aspect_shift; ! 83: ! 84: for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) ! 85: { ! 86: if (pz[0] <= izi) ! 87: { ! 88: pz[0] = izi; ! 89: pdest[0] = pparticle->color; ! 90: } ! 91: } ! 92: break; ! 93: ! 94: case 2: ! 95: count = 2 << d_y_aspect_shift; ! 96: ! 97: for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) ! 98: { ! 99: if (pz[0] <= izi) ! 100: { ! 101: pz[0] = izi; ! 102: pdest[0] = pparticle->color; ! 103: } ! 104: ! 105: if (pz[1] <= izi) ! 106: { ! 107: pz[1] = izi; ! 108: pdest[1] = pparticle->color; ! 109: } ! 110: } ! 111: break; ! 112: ! 113: case 3: ! 114: count = 3 << d_y_aspect_shift; ! 115: ! 116: for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) ! 117: { ! 118: if (pz[0] <= izi) ! 119: { ! 120: pz[0] = izi; ! 121: pdest[0] = pparticle->color; ! 122: } ! 123: ! 124: if (pz[1] <= izi) ! 125: { ! 126: pz[1] = izi; ! 127: pdest[1] = pparticle->color; ! 128: } ! 129: ! 130: if (pz[2] <= izi) ! 131: { ! 132: pz[2] = izi; ! 133: pdest[2] = pparticle->color; ! 134: } ! 135: } ! 136: break; ! 137: ! 138: case 4: ! 139: count = 4 << d_y_aspect_shift; ! 140: ! 141: for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) ! 142: { ! 143: if (pz[0] <= izi) ! 144: { ! 145: pz[0] = izi; ! 146: pdest[0] = pparticle->color; ! 147: } ! 148: ! 149: if (pz[1] <= izi) ! 150: { ! 151: pz[1] = izi; ! 152: pdest[1] = pparticle->color; ! 153: } ! 154: ! 155: if (pz[2] <= izi) ! 156: { ! 157: pz[2] = izi; ! 158: pdest[2] = pparticle->color; ! 159: } ! 160: ! 161: if (pz[3] <= izi) ! 162: { ! 163: pz[3] = izi; ! 164: pdest[3] = pparticle->color; ! 165: } ! 166: } ! 167: break; ! 168: ! 169: default: ! 170: count = pix << d_y_aspect_shift; ! 171: ! 172: for ( ; count ; count--, pz += d_zwidth, pdest += screenwidth) ! 173: { ! 174: for (i=0 ; i<pix ; i++) ! 175: { ! 176: if (pz[i] <= izi) ! 177: { ! 178: pz[i] = izi; ! 179: pdest[i] = pparticle->color; ! 180: } ! 181: } ! 182: } ! 183: break; ! 184: } ! 185: } ! 186: ! 187: #endif // !id386 ! 188:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.