mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 04:29:34 -04:00
voxels: support brightmaps and colored blood (#1361)
* voxels: support brightmaps and colored blood * translation table caching
This commit is contained in:
parent
801c93872b
commit
78c1fccebd
@ -30,6 +30,9 @@
|
||||
#include "z_zone.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "r_bmaps.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#include "doomstat.h"
|
||||
|
||||
|
||||
@ -705,6 +708,9 @@ boolean VX_ProjectVoxel (mobj_t * thing)
|
||||
vis->colormap[1] = fullcolormap;
|
||||
}
|
||||
|
||||
vis->brightmap = R_BrightmapForSprite(thing->sprite);
|
||||
vis->color = thing->bloodcolor;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -904,7 +910,8 @@ static void VX_DrawColumn (vissprite_t * spr, int x, int y)
|
||||
if (uy < clip_y1)
|
||||
uy = clip_y1;
|
||||
|
||||
byte pix = spr->colormap[0][slab[0]];
|
||||
byte src = slab[0];
|
||||
byte pix = spr->colormap[spr->brightmap[src]][src];
|
||||
|
||||
for (; uy < uy1 ; uy += FRACUNIT)
|
||||
{
|
||||
@ -918,7 +925,8 @@ static void VX_DrawColumn (vissprite_t * spr, int x, int y)
|
||||
if (uy > clip_y2)
|
||||
uy = clip_y2;
|
||||
|
||||
byte pix = spr->colormap[0][slab[len - 1]];
|
||||
byte src = slab[len - 1];
|
||||
byte pix = spr->colormap[spr->brightmap[src]][src];
|
||||
|
||||
for (; uy > uy2 ; uy -= FRACUNIT)
|
||||
{
|
||||
@ -937,7 +945,8 @@ static void VX_DrawColumn (vissprite_t * spr, int x, int y)
|
||||
if (i < 0) i = 0;
|
||||
if (i >= len) i = len - 1;
|
||||
|
||||
byte pix = spr->colormap[0][slab[i]];
|
||||
byte src = slab[i];
|
||||
byte pix = spr->colormap[spr->brightmap[src]][src];
|
||||
|
||||
dest[(uy >> FRACBITS) * linesize + (ux >> FRACBITS)] = pix;
|
||||
}
|
||||
@ -1026,6 +1035,25 @@ void VX_DrawVoxel (vissprite_t * spr)
|
||||
spr->colormap[0] = new_colormap;
|
||||
}
|
||||
|
||||
if ((spr->mobjflags2 & MF2_COLOREDBLOOD) && (spr->colormap[0] != NULL))
|
||||
{
|
||||
static const byte * prev_trans = NULL;
|
||||
const byte * trans = (byte *)red2col[spr->color];
|
||||
|
||||
static byte new_colormap[256];
|
||||
|
||||
if (prev_trans != trans)
|
||||
{
|
||||
int i;
|
||||
for (i = 0 ; i < 256 ; i++)
|
||||
new_colormap[i] = spr->colormap[0][trans[i]];
|
||||
|
||||
prev_trans = trans;
|
||||
}
|
||||
|
||||
spr->colormap[0] = new_colormap;
|
||||
}
|
||||
|
||||
// perform reverse transform, place camera in relation to model
|
||||
|
||||
unsigned int ang = (vv->angle + ANG90) >> ANGLETOFINESHIFT;
|
||||
|
Loading…
x
Reference in New Issue
Block a user