DrawWallAdd1Pal cannot do dynamic lights

This commit is contained in:
Magnus Norddahl 2016-12-25 07:56:09 +01:00
parent a76cd35333
commit 6f86c11058
2 changed files with 5 additions and 11 deletions

View file

@ -669,8 +669,10 @@ namespace swrenderer
{ {
if (r_swtruecolor) if (r_swtruecolor)
DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>();
else else if (drawerargs::dc_num_lights == 0)
DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAdd1PalCommand>();
else
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1PalCommand>();
} }
void R_DrawWallAddCol4() void R_DrawWallAddCol4()

View file

@ -387,10 +387,6 @@ namespace swrenderer
uint8_t *dest = _dest; uint8_t *dest = _dest;
int bits = _fracbits; int bits = _fracbits;
int pitch = _pitch; int pitch = _pitch;
TriLight *dynlights = _dynlights;
int num_dynlights = _num_dynlights;
float viewpos_z = _viewpos_z;
float step_viewpos_z = _step_viewpos_z;
uint32_t *fg2rgb = _srcblend; uint32_t *fg2rgb = _srcblend;
uint32_t *bg2rgb = _destblend; uint32_t *bg2rgb = _destblend;
@ -403,8 +399,6 @@ namespace swrenderer
frac += fracstep * thread->skipped_by_thread(_dest_y); frac += fracstep * thread->skipped_by_thread(_dest_y);
fracstep *= thread->num_cores; fracstep *= thread->num_cores;
pitch *= thread->num_cores; pitch *= thread->num_cores;
viewpos_z += step_viewpos_z * thread->skipped_by_thread(_dest_y);
step_viewpos_z *= thread->num_cores;
if (!r_blendmethod) if (!r_blendmethod)
{ {
@ -413,14 +407,13 @@ namespace swrenderer
uint8_t pix = source[frac >> bits]; uint8_t pix = source[frac >> bits];
if (pix != 0) if (pix != 0)
{ {
uint8_t lit = num_dynlights != 0 ? AddLights(dynlights, num_dynlights, viewpos_z, colormap[pix], pix) : colormap[pix]; uint8_t lit = colormap[pix];
uint32_t fg = fg2rgb[lit]; uint32_t fg = fg2rgb[lit];
uint32_t bg = bg2rgb[*dest]; uint32_t bg = bg2rgb[*dest];
fg = (fg + bg) | 0x1f07c1f; fg = (fg + bg) | 0x1f07c1f;
*dest = RGB32k.All[fg & (fg >> 15)]; *dest = RGB32k.All[fg & (fg >> 15)];
} }
viewpos_z += step_viewpos_z;
frac += fracstep; frac += fracstep;
dest += pitch; dest += pitch;
} while (--count); } while (--count);
@ -433,14 +426,13 @@ namespace swrenderer
uint8_t pix = source[frac >> bits]; uint8_t pix = source[frac >> bits];
if (pix != 0) if (pix != 0)
{ {
uint8_t lit = num_dynlights != 0 ? AddLights(dynlights, num_dynlights, viewpos_z, colormap[pix], pix) : colormap[pix]; uint8_t lit = colormap[pix];
uint32_t r = MIN(GPalette.BaseColors[lit].r + GPalette.BaseColors[*dest].r, 255); uint32_t r = MIN(GPalette.BaseColors[lit].r + GPalette.BaseColors[*dest].r, 255);
uint32_t g = MIN(GPalette.BaseColors[lit].g + GPalette.BaseColors[*dest].g, 255); uint32_t g = MIN(GPalette.BaseColors[lit].g + GPalette.BaseColors[*dest].g, 255);
uint32_t b = MIN(GPalette.BaseColors[lit].b + GPalette.BaseColors[*dest].b, 255); uint32_t b = MIN(GPalette.BaseColors[lit].b + GPalette.BaseColors[*dest].b, 255);
*dest = RGB256k.RGB[r>>2][g>>2][b>>2]; *dest = RGB256k.RGB[r>>2][g>>2][b>>2];
} }
viewpos_z += step_viewpos_z;
frac += fracstep; frac += fracstep;
dest += pitch; dest += pitch;
} while (--count); } while (--count);