version 1.1 | | version 1.2 |
---|
| | |
* Start of conversion to new texture mapper. | | * Start of conversion to new texture mapper. |
* | | * |
* $Log$ | | * $Log$ |
* Revision 1.1 1999/06/14 22:14:06 donut | | * Revision 1.2 1999/07/07 21:31:09 donut |
* Initial revision | | * removed unused vars from ntmap_scanline_lighted and slightly optomized it |
| | * |
| | * Revision 1.1.1.1 1999/06/14 22:14:06 donut |
| | * Import of d1x 1.37 source. |
* | | * |
* Revision 1.52 1995/03/14 15:13:06 john | | * Revision 1.52 1995/03/14 15:13:06 john |
* Increased MAX_Y_Pointers to 480. | | * Increased MAX_Y_Pointers to 480. |
| | |
// ------------------------------------------------------------------------------------- | | // ------------------------------------------------------------------------------------- |
void ntmap_scanline_lighted(grs_bitmap *srcb, int y, fix xleft, fix xright, fix uleft, fix uright, fix vleft, fix vright, fix zleft, fix zright, fix lleft, fix lright) | | void ntmap_scanline_lighted(grs_bitmap *srcb, int y, fix xleft, fix xright, fix uleft, fix uright, fix vleft, fix vright, fix zleft, fix zright, fix lleft, fix lright) |
{ | | { |
fix u,v,l; | | |
fix dx,recip_dx; | | fix dx,recip_dx; |
| | |
fix du_dx,dv_dx,dz_dx,z; | | |
| | |
u = uleft; | | |
v = vleft; | | |
l = lleft; | | |
| | |
fx_xright = f2i(xright); | | fx_xright = f2i(xright); |
| | //edited 06/27/99 Matt Mueller - moved these tests up from within the switch so as not to do a bunch of needless calculations when we are just gonna return anyway. Slight fps boost? |
| | if (fx_xright < Window_clip_left) |
| | return; |
fx_xleft = f2i(xleft); | | fx_xleft = f2i(xleft); |
| | if (fx_xleft > Window_clip_right) |
| | return; |
| | //end edit -MM |
| | |
dx = fx_xright - fx_xleft; | | dx = fx_xright - fx_xleft; |
if ((dx < 0) || (xright < 0) || (xleft > xright)) // the (xleft > xright) term is not redundant with (dx < 0) because dx is computed using integers | | if ((dx < 0) || (xright < 0) || (xleft > xright)) // the (xleft > xright) term is not redundant with (dx < 0) because dx is computed using integers |
| | |
else | | else |
recip_dx = F1_0/dx; | | recip_dx = F1_0/dx; |
| | |
du_dx = fixmul(uright - uleft,recip_dx); | | |
dv_dx = fixmul(vright - vleft,recip_dx); | | |
dz_dx = fixmul(zright - zleft,recip_dx); | | |
| | |
z = zleft; | | |
| | |
fx_u = uleft; | | fx_u = uleft; |
fx_v = vleft; | | fx_v = vleft; |
fx_z = zleft; | | fx_z = zleft; |
fx_du_dx = du_dx; | | |
fx_dv_dx = dv_dx; | | fx_du_dx = fixmul(uright - uleft,recip_dx); |
fx_dz_dx = dz_dx; | | fx_dv_dx = fixmul(vright - vleft,recip_dx); |
| | fx_dz_dx = fixmul(zright - zleft,recip_dx); |
fx_y = y; | | fx_y = y; |
pixptr = srcb->bm_data; | | pixptr = srcb->bm_data; |
| | |
switch (Lighting_enabled) { | | switch (Lighting_enabled) { |
case 0: | | case 0: |
if (fx_xleft > Window_clip_right) | | |
return; | | |
if (fx_xright < Window_clip_left) | | |
return; | | |
//added 05/17/99 Matt Mueller - prevent writing before the buffer | | //added 05/17/99 Matt Mueller - prevent writing before the buffer |
if ((fx_y == 0) && (fx_xleft < 0)) | | if ((fx_y == 0) && (fx_xleft < 0)) |
fx_xleft = 0; | | fx_xleft = 0; |
| | |
else if (lleft + mul_thing > (NUM_LIGHTING_LEVELS*F1_0-F1_0/2)) | | else if (lleft + mul_thing > (NUM_LIGHTING_LEVELS*F1_0-F1_0/2)) |
fx_dl_dx -= 12; | | fx_dl_dx -= 12; |
| | |
if (fx_xleft > Window_clip_right) | | |
return; | | |
if (fx_xright < Window_clip_left) | | |
return; | | |
//added 05/17/99 Matt Mueller - prevent writing before the buffer | | //added 05/17/99 Matt Mueller - prevent writing before the buffer |
if ((fx_y == 0) && (fx_xleft < 0)) | | if ((fx_y == 0) && (fx_xleft < 0)) |
fx_xleft = 0; | | fx_xleft = 0; |