mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
Added FDynamicColormap support to true color mode
This commit is contained in:
parent
af02bafdeb
commit
0c8c9e0aea
16 changed files with 937 additions and 457 deletions
|
@ -1307,7 +1307,7 @@ void G_InitLevelLocals ()
|
|||
level_info_t *info;
|
||||
|
||||
BaseBlendA = 0.0f; // Remove underwater blend effect, if any
|
||||
NormalLight.Maps = realcolormaps;
|
||||
NormalLight.Maps = realcolormaps.Maps;
|
||||
|
||||
// [BB] Instead of just setting the color, we also have to reset Desaturate and build the lights.
|
||||
NormalLight.ChangeColor (PalEntry (255, 255, 255), 0);
|
||||
|
|
|
@ -737,7 +737,7 @@ int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis)
|
|||
if ((vis->Alpha < 0.25f && special1 > 0) || (vis->Alpha == 0))
|
||||
{
|
||||
vis->Alpha = clamp((1.f - float(Strength/100)), 0.f, 1.f);
|
||||
vis->BaseColormap = SpecialColormaps[INVERSECOLORMAP].Colormap;
|
||||
vis->BaseColormap = &SpecialColormaps[INVERSECOLORMAP];
|
||||
vis->ColormapNum = 0;
|
||||
}
|
||||
return -1; // This item is valid so another one shouldn't reset the translucency
|
||||
|
|
|
@ -71,7 +71,7 @@ struct FakeCmap
|
|||
};
|
||||
|
||||
TArray<FakeCmap> fakecmaps;
|
||||
BYTE *realcolormaps;
|
||||
FColormap realcolormaps;
|
||||
size_t numfakecmaps;
|
||||
|
||||
|
||||
|
@ -408,7 +408,7 @@ void R_SetDefaultColormap (const char *name)
|
|||
|
||||
foo.Color = 0xFFFFFF;
|
||||
foo.Fade = 0;
|
||||
foo.Maps = realcolormaps;
|
||||
foo.Maps = realcolormaps.Maps;
|
||||
foo.Desaturate = 0;
|
||||
foo.Next = NULL;
|
||||
foo.BuildLights ();
|
||||
|
@ -430,7 +430,7 @@ void R_SetDefaultColormap (const char *name)
|
|||
remap[0] = 0;
|
||||
for (i = 0; i < NUMCOLORMAPS; ++i)
|
||||
{
|
||||
BYTE *map2 = &realcolormaps[i*256];
|
||||
BYTE *map2 = &realcolormaps.Maps[i*256];
|
||||
lumpr.Read (map, 256);
|
||||
for (j = 0; j < 256; ++j)
|
||||
{
|
||||
|
@ -454,11 +454,7 @@ void R_DeinitColormaps ()
|
|||
{
|
||||
SpecialColormaps.Clear();
|
||||
fakecmaps.Clear();
|
||||
if (realcolormaps != NULL)
|
||||
{
|
||||
delete[] realcolormaps;
|
||||
realcolormaps = NULL;
|
||||
}
|
||||
delete[] realcolormaps.Maps;
|
||||
FreeSpecialLights();
|
||||
}
|
||||
|
||||
|
@ -501,7 +497,7 @@ void R_InitColormaps ()
|
|||
}
|
||||
}
|
||||
}
|
||||
realcolormaps = new BYTE[256*NUMCOLORMAPS*fakecmaps.Size()];
|
||||
realcolormaps.Maps = new BYTE[256*NUMCOLORMAPS*fakecmaps.Size()];
|
||||
R_SetDefaultColormap ("COLORMAP");
|
||||
|
||||
if (fakecmaps.Size() > 1)
|
||||
|
@ -523,7 +519,7 @@ void R_InitColormaps ()
|
|||
{
|
||||
int k, r, g, b;
|
||||
FWadLump lump = Wads.OpenLumpNum (fakecmaps[j].lump);
|
||||
BYTE *const map = realcolormaps + NUMCOLORMAPS*256*j;
|
||||
BYTE *const map = realcolormaps.Maps + NUMCOLORMAPS*256*j;
|
||||
|
||||
for (k = 0; k < NUMCOLORMAPS; ++k)
|
||||
{
|
||||
|
@ -550,8 +546,8 @@ void R_InitColormaps ()
|
|||
}
|
||||
NormalLight.Color = PalEntry (255, 255, 255);
|
||||
NormalLight.Fade = 0;
|
||||
NormalLight.Maps = realcolormaps;
|
||||
NormalLightHasFixedLights = R_CheckForFixedLights(realcolormaps);
|
||||
NormalLight.Maps = realcolormaps.Maps;
|
||||
NormalLightHasFixedLights = R_CheckForFixedLights(realcolormaps.Maps);
|
||||
numfakecmaps = fakecmaps.Size();
|
||||
|
||||
// build default special maps (e.g. invulnerability)
|
||||
|
|
|
@ -1,18 +1,26 @@
|
|||
#ifndef __RES_CMAP_H
|
||||
#define __RES_CMAP_H
|
||||
|
||||
struct FColormap;
|
||||
|
||||
void R_InitColormaps ();
|
||||
void R_DeinitColormaps ();
|
||||
|
||||
DWORD R_ColormapNumForName(const char *name); // killough 4/4/98
|
||||
void R_SetDefaultColormap (const char *name); // [RH] change normal fadetable
|
||||
DWORD R_BlendForColormap (DWORD map); // [RH] return calculated blend for a colormap
|
||||
extern BYTE *realcolormaps; // [RH] make the colormaps externally visible
|
||||
extern FColormap realcolormaps; // [RH] make the colormaps externally visible
|
||||
extern size_t numfakecmaps;
|
||||
|
||||
struct FColormap
|
||||
{
|
||||
BYTE *Maps = nullptr;
|
||||
PalEntry Color = 0xffffffff;
|
||||
PalEntry Fade = 0xff000000;
|
||||
int Desaturate = 0;
|
||||
};
|
||||
|
||||
|
||||
struct FDynamicColormap
|
||||
struct FDynamicColormap : FColormap
|
||||
{
|
||||
void ChangeFade (PalEntry fadecolor);
|
||||
void ChangeColor (PalEntry lightcolor, int desaturate);
|
||||
|
@ -20,10 +28,6 @@ struct FDynamicColormap
|
|||
void BuildLights ();
|
||||
static void RebuildAllLights();
|
||||
|
||||
BYTE *Maps;
|
||||
PalEntry Color;
|
||||
PalEntry Fade;
|
||||
int Desaturate;
|
||||
FDynamicColormap *Next;
|
||||
};
|
||||
|
||||
|
@ -43,8 +47,13 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct FSpecialColormap
|
||||
struct FSpecialColormap : FColormap
|
||||
{
|
||||
FSpecialColormap()
|
||||
{
|
||||
Maps = Colormap;
|
||||
}
|
||||
|
||||
float ColorizeStart[3];
|
||||
float ColorizeEnd[3];
|
||||
BYTE Colormap[256];
|
||||
|
|
|
@ -1397,12 +1397,13 @@ struct FMiniBSP
|
|||
//
|
||||
|
||||
typedef BYTE lighttable_t; // This could be wider for >8 bit display.
|
||||
struct FColormap;
|
||||
|
||||
// This encapsulates the fields of vissprite_t that can be altered by AlterWeaponSprite
|
||||
struct visstyle_t
|
||||
{
|
||||
int ColormapNum; // Which colormap is rendered
|
||||
lighttable_t *BaseColormap; // Base colormap used together with ColormapNum
|
||||
FColormap *BaseColormap; // Base colormap used together with ColormapNum
|
||||
float Alpha;
|
||||
FRenderStyle RenderStyle;
|
||||
};
|
||||
|
|
490
src/r_draw.cpp
490
src/r_draw.cpp
File diff suppressed because it is too large
Load diff
19
src/r_draw.h
19
src/r_draw.h
|
@ -25,11 +25,16 @@
|
|||
|
||||
#include "r_defs.h"
|
||||
|
||||
struct FColormap;
|
||||
struct ShadeConstants;
|
||||
|
||||
extern "C" int ylookup[MAXHEIGHT];
|
||||
|
||||
extern "C" int dc_pitch; // [RH] Distance between rows
|
||||
|
||||
extern "C" lighttable_t*dc_colormap;
|
||||
extern "C" FColormap *dc_fcolormap;
|
||||
extern "C" ShadeConstants dc_shade_constants;
|
||||
extern "C" fixed_t dc_light;
|
||||
extern "C" int dc_x;
|
||||
extern "C" int dc_yl;
|
||||
|
@ -93,7 +98,7 @@ extern void (*R_DrawTranslatedColumn)(void);
|
|||
// Span drawing for rows, floor/ceiling. No Spectre effect needed.
|
||||
extern void (*R_DrawSpan)(void);
|
||||
void R_SetupSpanBits(FTexture *tex);
|
||||
void R_SetSpanColormap(BYTE *colormap);
|
||||
void R_SetSpanColormap(FDynamicColormap *colormap, int shade);
|
||||
void R_SetSpanSource(const BYTE *pixels);
|
||||
|
||||
// Span drawing for masked textures.
|
||||
|
@ -321,9 +326,10 @@ extern "C" int ds_y;
|
|||
extern "C" int ds_x1;
|
||||
extern "C" int ds_x2;
|
||||
|
||||
extern "C" FColormap* ds_fcolormap;
|
||||
extern "C" lighttable_t* ds_colormap;
|
||||
//extern "C" dsfixed_t ds_light;
|
||||
#define ds_light dc_light
|
||||
extern "C" ShadeConstants ds_shade_constants;
|
||||
extern "C" dsfixed_t ds_light;
|
||||
|
||||
extern "C" dsfixed_t ds_xfrac;
|
||||
extern "C" dsfixed_t ds_yfrac;
|
||||
|
@ -341,6 +347,7 @@ extern "C" int ds_color; // [RH] For flat color (no texturing)
|
|||
extern BYTE shadetables[/*NUMCOLORMAPS*16*256*/];
|
||||
extern FDynamicColormap ShadeFakeColormap[16];
|
||||
extern BYTE identitymap[256];
|
||||
extern FDynamicColormap identitycolormap;
|
||||
extern BYTE *dc_translation;
|
||||
|
||||
// [RH] Added for muliresolution support
|
||||
|
@ -389,9 +396,11 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_
|
|||
void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int col)=R_GetColumn);
|
||||
|
||||
// Sets dc_colormap and dc_light to their appropriate values depending on the output format (pal vs true color)
|
||||
void R_SetColorMapLight(BYTE *base_colormap, float light, int shade);
|
||||
void R_SetColorMapLight(FColormap *base_colormap, float light, int shade);
|
||||
|
||||
// Same as R_SetColorMapLight, but for ds_colormap and ds_light
|
||||
void R_SetDSColorMapLight(BYTE *base_colormap, float light, int shade);
|
||||
void R_SetDSColorMapLight(FColormap *base_colormap, float light, int shade);
|
||||
|
||||
void R_SetTranslationMap(lighttable_t *translation);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -108,7 +108,6 @@ void rt_copy4cols_RGBA_c (int sx, int yl, int yh)
|
|||
// Maps one span at hx to the screen at sx.
|
||||
void rt_map1col_RGBA_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -120,14 +119,14 @@ void rt_map1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
count++;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
colormap = dc_colormap;
|
||||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
|
||||
if (count & 1) {
|
||||
*dest = shade_pal_index(colormap[*source], light);
|
||||
*dest = shade_pal_index(*source, light, shade_constants);
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
}
|
||||
|
@ -135,8 +134,8 @@ void rt_map1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
return;
|
||||
|
||||
do {
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light);
|
||||
dest[pitch] = shade_pal_index(colormap[source[4]], light);
|
||||
dest[0] = shade_pal_index(source[0], light, shade_constants);
|
||||
dest[pitch] = shade_pal_index(source[4], light, shade_constants);
|
||||
source += 8;
|
||||
dest += pitch*2;
|
||||
} while (--count);
|
||||
|
@ -145,7 +144,6 @@ void rt_map1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
// Maps all four spans to the screen starting at sx.
|
||||
void rt_map4cols_RGBA_c (int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -157,17 +155,17 @@ void rt_map4cols_RGBA_c (int sx, int yl, int yh)
|
|||
count++;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
colormap = dc_colormap;
|
||||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4];
|
||||
pitch = dc_pitch;
|
||||
|
||||
if (count & 1) {
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light);
|
||||
dest[1] = shade_pal_index(colormap[source[1]], light);
|
||||
dest[2] = shade_pal_index(colormap[source[2]], light);
|
||||
dest[3] = shade_pal_index(colormap[source[3]], light);
|
||||
dest[0] = shade_pal_index(source[0], light, shade_constants);
|
||||
dest[1] = shade_pal_index(source[1], light, shade_constants);
|
||||
dest[2] = shade_pal_index(source[2], light, shade_constants);
|
||||
dest[3] = shade_pal_index(source[3], light, shade_constants);
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
}
|
||||
|
@ -175,14 +173,14 @@ void rt_map4cols_RGBA_c (int sx, int yl, int yh)
|
|||
return;
|
||||
|
||||
do {
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light);
|
||||
dest[1] = shade_pal_index(colormap[source[1]], light);
|
||||
dest[2] = shade_pal_index(colormap[source[2]], light);
|
||||
dest[3] = shade_pal_index(colormap[source[3]], light);
|
||||
dest[pitch] = shade_pal_index(colormap[source[4]], light);
|
||||
dest[pitch + 1] = shade_pal_index(colormap[source[5]], light);
|
||||
dest[pitch + 2] = shade_pal_index(colormap[source[6]], light);
|
||||
dest[pitch + 3] = shade_pal_index(colormap[source[7]], light);
|
||||
dest[0] = shade_pal_index(source[0], light, shade_constants);
|
||||
dest[1] = shade_pal_index(source[1], light, shade_constants);
|
||||
dest[2] = shade_pal_index(source[2], light, shade_constants);
|
||||
dest[3] = shade_pal_index(source[3], light, shade_constants);
|
||||
dest[pitch] = shade_pal_index(source[4], light, shade_constants);
|
||||
dest[pitch + 1] = shade_pal_index(source[5], light, shade_constants);
|
||||
dest[pitch + 2] = shade_pal_index(source[6], light, shade_constants);
|
||||
dest[pitch + 3] = shade_pal_index(source[7], light, shade_constants);
|
||||
source += 8;
|
||||
dest += pitch*2;
|
||||
} while (--count);
|
||||
|
@ -191,7 +189,6 @@ void rt_map4cols_RGBA_c (int sx, int yl, int yh)
|
|||
// Maps all four spans to the screen starting at sx.
|
||||
void rt_map4cols_RGBA_SSE(int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -202,32 +199,27 @@ void rt_map4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
return;
|
||||
count++;
|
||||
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
|
||||
colormap = dc_colormap;
|
||||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl * 4];
|
||||
pitch = dc_pitch;
|
||||
|
||||
__m128i mlight = _mm_set_epi16(256, light, light, light, 256, light, light, light);
|
||||
if (shade_constants.simple_shade)
|
||||
{
|
||||
SSE_SHADE_SIMPLE_INIT(light);
|
||||
|
||||
if (count & 1) {
|
||||
uint32_t p0 = colormap[source[0]];
|
||||
uint32_t p1 = colormap[source[1]];
|
||||
uint32_t p2 = colormap[source[2]];
|
||||
uint32_t p3 = colormap[source[3]];
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
// shade_pal_index:
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128());
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128());
|
||||
fg_hi = _mm_mullo_epi16(fg_hi, mlight);
|
||||
fg_hi = _mm_srli_epi16(fg_hi, 8);
|
||||
fg_lo = _mm_mullo_epi16(fg_lo, mlight);
|
||||
fg_lo = _mm_srli_epi16(fg_lo, 8);
|
||||
|
||||
fg = _mm_packus_epi16(fg_lo, fg_hi);
|
||||
SSE_SHADE_SIMPLE(fg);
|
||||
_mm_storeu_si128((__m128i*)dest, fg);
|
||||
|
||||
source += 4;
|
||||
|
@ -239,39 +231,25 @@ void rt_map4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
do {
|
||||
// shade_pal_index 0-3
|
||||
{
|
||||
uint32_t p0 = colormap[source[0]];
|
||||
uint32_t p1 = colormap[source[1]];
|
||||
uint32_t p2 = colormap[source[2]];
|
||||
uint32_t p3 = colormap[source[3]];
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128());
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128());
|
||||
fg_hi = _mm_mullo_epi16(fg_hi, mlight);
|
||||
fg_hi = _mm_srli_epi16(fg_hi, 8);
|
||||
fg_lo = _mm_mullo_epi16(fg_lo, mlight);
|
||||
fg_lo = _mm_srli_epi16(fg_lo, 8);
|
||||
|
||||
fg = _mm_packus_epi16(fg_lo, fg_hi);
|
||||
SSE_SHADE_SIMPLE(fg);
|
||||
_mm_storeu_si128((__m128i*)dest, fg);
|
||||
}
|
||||
|
||||
// shade_pal_index 4-7 (pitch)
|
||||
{
|
||||
uint32_t p0 = colormap[source[4]];
|
||||
uint32_t p1 = colormap[source[5]];
|
||||
uint32_t p2 = colormap[source[6]];
|
||||
uint32_t p3 = colormap[source[7]];
|
||||
uint32_t p0 = source[4];
|
||||
uint32_t p1 = source[5];
|
||||
uint32_t p2 = source[6];
|
||||
uint32_t p3 = source[7];
|
||||
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128());
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128());
|
||||
fg_hi = _mm_mullo_epi16(fg_hi, mlight);
|
||||
fg_hi = _mm_srli_epi16(fg_hi, 8);
|
||||
fg_lo = _mm_mullo_epi16(fg_lo, mlight);
|
||||
fg_lo = _mm_srli_epi16(fg_lo, 8);
|
||||
|
||||
fg = _mm_packus_epi16(fg_lo, fg_hi);
|
||||
SSE_SHADE_SIMPLE(fg);
|
||||
_mm_storeu_si128((__m128i*)(dest + pitch), fg);
|
||||
}
|
||||
|
||||
|
@ -279,6 +257,57 @@ void rt_map4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
dest += pitch * 2;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
SSE_SHADE_INIT(light, shade_constants);
|
||||
|
||||
if (count & 1) {
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
// shade_pal_index:
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
SSE_SHADE(fg, shade_constants);
|
||||
_mm_storeu_si128((__m128i*)dest, fg);
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
}
|
||||
if (!(count >>= 1))
|
||||
return;
|
||||
|
||||
do {
|
||||
// shade_pal_index 0-3
|
||||
{
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
SSE_SHADE(fg, shade_constants);
|
||||
_mm_storeu_si128((__m128i*)dest, fg);
|
||||
}
|
||||
|
||||
// shade_pal_index 4-7 (pitch)
|
||||
{
|
||||
uint32_t p0 = source[4];
|
||||
uint32_t p1 = source[5];
|
||||
uint32_t p2 = source[6];
|
||||
uint32_t p3 = source[7];
|
||||
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
SSE_SHADE(fg, shade_constants);
|
||||
_mm_storeu_si128((__m128i*)(dest + pitch), fg);
|
||||
}
|
||||
|
||||
source += 8;
|
||||
dest += pitch * 2;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
|
||||
void rt_Translate1col_RGBA_c(const BYTE *translation, int hx, int yl, int yh)
|
||||
{
|
||||
|
@ -385,7 +414,6 @@ void rt_tlate4cols_RGBA_c (int sx, int yl, int yh)
|
|||
// Adds one span at hx to the screen at sx without clamping.
|
||||
void rt_add1col_RGBA_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -399,15 +427,15 @@ void rt_add1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg = shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -430,7 +458,6 @@ void rt_add1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
// Adds all four spans to the screen starting at sx without clamping.
|
||||
void rt_add4cols_RGBA_c (int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -444,9 +471,9 @@ void rt_add4cols_RGBA_c (int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
@ -454,7 +481,7 @@ void rt_add4cols_RGBA_c (int sx, int yl, int yh)
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg = shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -479,7 +506,6 @@ void rt_add4cols_RGBA_c (int sx, int yl, int yh)
|
|||
#ifndef NO_SSE
|
||||
void rt_add4cols_RGBA_SSE(int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -493,7 +519,6 @@ void rt_add4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl * 4];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
|
@ -501,24 +526,27 @@ void rt_add4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
||||
__m128i mlight = _mm_set_epi16(256, light, light, light, 256, light, light, light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
if (shade_constants.simple_shade)
|
||||
{
|
||||
SSE_SHADE_SIMPLE_INIT(light);
|
||||
|
||||
__m128i mfg_alpha = _mm_set_epi16(256, fg_alpha, fg_alpha, fg_alpha, 256, fg_alpha, fg_alpha, fg_alpha);
|
||||
__m128i mbg_alpha = _mm_set_epi16(256, bg_alpha, bg_alpha, bg_alpha, 256, bg_alpha, bg_alpha, bg_alpha);
|
||||
|
||||
do {
|
||||
uint32_t p0 = colormap[source[0]];
|
||||
uint32_t p1 = colormap[source[1]];
|
||||
uint32_t p2 = colormap[source[2]];
|
||||
uint32_t p3 = colormap[source[3]];
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
// shade_pal_index:
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
SSE_SHADE_SIMPLE(fg);
|
||||
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128());
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128());
|
||||
fg_hi = _mm_mullo_epi16(fg_hi, mlight);
|
||||
fg_hi = _mm_srli_epi16(fg_hi, 8);
|
||||
fg_lo = _mm_mullo_epi16(fg_lo, mlight);
|
||||
fg_lo = _mm_srli_epi16(fg_lo, 8);
|
||||
|
||||
// unpack bg:
|
||||
__m128i bg = _mm_loadu_si128((const __m128i*)dest);
|
||||
|
@ -536,6 +564,43 @@ void rt_add4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
SSE_SHADE_INIT(light, shade_constants);
|
||||
|
||||
__m128i mfg_alpha = _mm_set_epi16(256, fg_alpha, fg_alpha, fg_alpha, 256, fg_alpha, fg_alpha, fg_alpha);
|
||||
__m128i mbg_alpha = _mm_set_epi16(256, bg_alpha, bg_alpha, bg_alpha, 256, bg_alpha, bg_alpha, bg_alpha);
|
||||
|
||||
do {
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
// shade_pal_index:
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
SSE_SHADE(fg, shade_constants);
|
||||
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128());
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128());
|
||||
|
||||
// unpack bg:
|
||||
__m128i bg = _mm_loadu_si128((const __m128i*)dest);
|
||||
__m128i bg_hi = _mm_unpackhi_epi8(bg, _mm_setzero_si128());
|
||||
__m128i bg_lo = _mm_unpacklo_epi8(bg, _mm_setzero_si128());
|
||||
|
||||
// (fg_red * fg_alpha + bg_red * bg_alpha) / 256:
|
||||
__m128i color_hi = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_hi, mfg_alpha), _mm_mullo_epi16(bg_hi, mbg_alpha)), 8);
|
||||
__m128i color_lo = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_lo, mfg_alpha), _mm_mullo_epi16(bg_lo, mbg_alpha)), 8);
|
||||
|
||||
__m128i color = _mm_packus_epi16(color_lo, color_hi);
|
||||
_mm_storeu_si128((__m128i*)dest, color);
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Translates and adds one span at hx to the screen at sx without clamping.
|
||||
|
@ -571,7 +636,7 @@ void rt_shaded1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
source = &dc_temp_rgba[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
|
||||
uint32_t fg = shade_pal_index(dc_color, calc_light_multiplier(dc_light));
|
||||
uint32_t fg = shade_pal_index_simple(dc_color, calc_light_multiplier(dc_light));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -613,7 +678,7 @@ void rt_shaded4cols_RGBA_c (int sx, int yl, int yh)
|
|||
source = &dc_temp_rgba[yl*4];
|
||||
pitch = dc_pitch;
|
||||
|
||||
uint32_t fg = shade_pal_index(dc_color, calc_light_multiplier(dc_light));
|
||||
uint32_t fg = shade_pal_index_simple(dc_color, calc_light_multiplier(dc_light));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -659,7 +724,7 @@ void rt_shaded4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
source = &dc_temp_rgba[yl * 4];
|
||||
pitch = dc_pitch;
|
||||
|
||||
__m128i fg = _mm_unpackhi_epi8(_mm_set1_epi32(shade_pal_index(dc_color, calc_light_multiplier(dc_light))), _mm_setzero_si128());
|
||||
__m128i fg = _mm_unpackhi_epi8(_mm_set1_epi32(shade_pal_index_simple(dc_color, calc_light_multiplier(dc_light))), _mm_setzero_si128());
|
||||
__m128i alpha_one = _mm_set1_epi16(64);
|
||||
|
||||
do {
|
||||
|
@ -694,7 +759,6 @@ void rt_shaded4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
// Adds one span at hx to the screen at sx with clamping.
|
||||
void rt_addclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -708,15 +772,15 @@ void rt_addclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg = shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -738,7 +802,6 @@ void rt_addclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
// Adds all four spans to the screen starting at sx with clamping.
|
||||
void rt_addclamp4cols_RGBA_c (int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -752,9 +815,9 @@ void rt_addclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
@ -762,7 +825,7 @@ void rt_addclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg = shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -786,7 +849,6 @@ void rt_addclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
#ifndef NO_SSE
|
||||
void rt_addclamp4cols_RGBA_SSE(int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -800,7 +862,6 @@ void rt_addclamp4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl * 4];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
uint32_t *palette = (uint32_t*)GPalette.BaseColors;
|
||||
|
@ -808,24 +869,27 @@ void rt_addclamp4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
||||
__m128i mlight = _mm_set_epi16(256, light, light, light, 256, light, light, light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
if (shade_constants.simple_shade)
|
||||
{
|
||||
SSE_SHADE_SIMPLE_INIT(light);
|
||||
|
||||
__m128i mfg_alpha = _mm_set_epi16(256, fg_alpha, fg_alpha, fg_alpha, 256, fg_alpha, fg_alpha, fg_alpha);
|
||||
__m128i mbg_alpha = _mm_set_epi16(256, bg_alpha, bg_alpha, bg_alpha, 256, bg_alpha, bg_alpha, bg_alpha);
|
||||
|
||||
do {
|
||||
uint32_t p0 = colormap[source[0]];
|
||||
uint32_t p1 = colormap[source[1]];
|
||||
uint32_t p2 = colormap[source[2]];
|
||||
uint32_t p3 = colormap[source[3]];
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
// shade_pal_index:
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
SSE_SHADE_SIMPLE(fg);
|
||||
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128());
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128());
|
||||
fg_hi = _mm_mullo_epi16(fg_hi, mlight);
|
||||
fg_hi = _mm_srli_epi16(fg_hi, 8);
|
||||
fg_lo = _mm_mullo_epi16(fg_lo, mlight);
|
||||
fg_lo = _mm_srli_epi16(fg_lo, 8);
|
||||
|
||||
// unpack bg:
|
||||
__m128i bg = _mm_loadu_si128((const __m128i*)dest);
|
||||
|
@ -843,6 +907,43 @@ void rt_addclamp4cols_RGBA_SSE(int sx, int yl, int yh)
|
|||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
else
|
||||
{
|
||||
SSE_SHADE_INIT(light, shade_constants);
|
||||
|
||||
__m128i mfg_alpha = _mm_set_epi16(256, fg_alpha, fg_alpha, fg_alpha, 256, fg_alpha, fg_alpha, fg_alpha);
|
||||
__m128i mbg_alpha = _mm_set_epi16(256, bg_alpha, bg_alpha, bg_alpha, 256, bg_alpha, bg_alpha, bg_alpha);
|
||||
|
||||
do {
|
||||
uint32_t p0 = source[0];
|
||||
uint32_t p1 = source[1];
|
||||
uint32_t p2 = source[2];
|
||||
uint32_t p3 = source[3];
|
||||
|
||||
// shade_pal_index:
|
||||
__m128i fg = _mm_set_epi32(palette[p3], palette[p2], palette[p1], palette[p0]);
|
||||
SSE_SHADE(fg, shade_constants);
|
||||
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128());
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128());
|
||||
|
||||
// unpack bg:
|
||||
__m128i bg = _mm_loadu_si128((const __m128i*)dest);
|
||||
__m128i bg_hi = _mm_unpackhi_epi8(bg, _mm_setzero_si128());
|
||||
__m128i bg_lo = _mm_unpacklo_epi8(bg, _mm_setzero_si128());
|
||||
|
||||
// (fg_red * fg_alpha + bg_red * bg_alpha) / 256:
|
||||
__m128i color_hi = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_hi, mfg_alpha), _mm_mullo_epi16(bg_hi, mbg_alpha)), 8);
|
||||
__m128i color_lo = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_lo, mfg_alpha), _mm_mullo_epi16(bg_lo, mbg_alpha)), 8);
|
||||
|
||||
__m128i color = _mm_packus_epi16(color_lo, color_hi);
|
||||
_mm_storeu_si128((__m128i*)dest, color);
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Translates and adds one span at hx to the screen at sx with clamping.
|
||||
|
@ -862,7 +963,6 @@ void rt_tlateaddclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
// Subtracts one span at hx to the screen at sx with clamping.
|
||||
void rt_subclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -876,15 +976,15 @@ void rt_subclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg = shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -906,7 +1006,6 @@ void rt_subclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
// Subtracts all four spans to the screen starting at sx with clamping.
|
||||
void rt_subclamp4cols_RGBA_c (int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -920,9 +1019,9 @@ void rt_subclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
@ -930,7 +1029,7 @@ void rt_subclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg = shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -968,7 +1067,6 @@ void rt_tlatesubclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
// Subtracts one span at hx from the screen at sx with clamping.
|
||||
void rt_revsubclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -982,15 +1080,15 @@ void rt_revsubclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg = shade_pal_index(*source, light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -1012,7 +1110,6 @@ void rt_revsubclamp1col_RGBA_c (int hx, int sx, int yl, int yh)
|
|||
// Subtracts all four spans from the screen starting at sx with clamping.
|
||||
void rt_revsubclamp4cols_RGBA_c (int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
uint32_t *source;
|
||||
uint32_t *dest;
|
||||
int count;
|
||||
|
@ -1026,9 +1123,9 @@ void rt_revsubclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
dest = ylookup[yl] + sx + (uint32_t*)dc_destorg;
|
||||
source = &dc_temp_rgba[yl*4];
|
||||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
ShadeConstants shade_constants = dc_shade_constants;
|
||||
|
||||
uint32_t fg_alpha = dc_srcalpha >> (FRACBITS - 8);
|
||||
uint32_t bg_alpha = dc_destalpha >> (FRACBITS - 8);
|
||||
|
@ -1036,7 +1133,7 @@ void rt_revsubclamp4cols_RGBA_c (int sx, int yl, int yh)
|
|||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg = shade_pal_index(source[i], light, shade_constants);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
|
|
@ -119,7 +119,7 @@ double FocalLengthX;
|
|||
double FocalLengthY;
|
||||
FDynamicColormap*basecolormap; // [RH] colormap currently drawing with
|
||||
int fixedlightlev;
|
||||
lighttable_t *fixedcolormap;
|
||||
FColormap *fixedcolormap;
|
||||
FSpecialColormap *realfixedcolormap;
|
||||
double WallTMapScale2;
|
||||
|
||||
|
@ -464,11 +464,11 @@ void R_SetupColormap(player_t *player)
|
|||
// Render everything fullbright. The copy to video memory will
|
||||
// apply the special colormap, so it won't be restricted to the
|
||||
// palette.
|
||||
fixedcolormap = realcolormaps;
|
||||
fixedcolormap = &realcolormaps;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixedcolormap = SpecialColormaps[player->fixedcolormap].Colormap;
|
||||
fixedcolormap = &SpecialColormaps[player->fixedcolormap];
|
||||
}
|
||||
}
|
||||
else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS)
|
||||
|
@ -479,7 +479,7 @@ void R_SetupColormap(player_t *player)
|
|||
// [RH] Inverse light for shooting the Sigil
|
||||
if (fixedcolormap == NULL && extralight == INT_MIN)
|
||||
{
|
||||
fixedcolormap = SpecialColormaps[INVERSECOLORMAP].Colormap;
|
||||
fixedcolormap = &SpecialColormaps[INVERSECOLORMAP];
|
||||
extralight = 0;
|
||||
}
|
||||
}
|
||||
|
|
141
src/r_main.h
141
src/r_main.h
|
@ -90,25 +90,162 @@ extern bool r_dontmaplines;
|
|||
// Converts fixedlightlev into a shade value
|
||||
#define FIXEDLIGHT2SHADE(lightlev) (((lightlev) >> COLORMAPSHIFT) << FRACBITS)
|
||||
|
||||
struct ShadeConstants
|
||||
{
|
||||
uint16_t light_alpha;
|
||||
uint16_t light_red;
|
||||
uint16_t light_green;
|
||||
uint16_t light_blue;
|
||||
uint16_t fade_alpha;
|
||||
uint16_t fade_red;
|
||||
uint16_t fade_green;
|
||||
uint16_t fade_blue;
|
||||
uint16_t desaturate;
|
||||
bool simple_shade;
|
||||
};
|
||||
|
||||
// calculates the light constant passed to the shade_pal_index function
|
||||
inline uint32_t calc_light_multiplier(dsfixed_t light)
|
||||
{
|
||||
return 256 - (light >> (FRACBITS - 8));
|
||||
}
|
||||
|
||||
// Give the compiler a strong hint we want these functions inlined:
|
||||
#ifndef FORCEINLINE
|
||||
#if defined(_MSC_VER)
|
||||
#define FORCEINLINE __forceinline
|
||||
#elif defined(__GNUC__)
|
||||
#define FORCEINLINE __attribute__((always_inline))
|
||||
#else
|
||||
#define FORCEINLINE inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Calculates a ARGB8 color for the given palette index and light multiplier
|
||||
inline uint32_t shade_pal_index(uint32_t index, uint32_t light)
|
||||
FORCEINLINE uint32_t shade_pal_index_simple(uint32_t index, uint32_t light)
|
||||
{
|
||||
const PalEntry &color = GPalette.BaseColors[index];
|
||||
uint32_t red = color.r;
|
||||
uint32_t green = color.g;
|
||||
uint32_t blue = color.b;
|
||||
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
// Calculates a ARGB8 color for the given palette index, light multiplier and dynamic colormap
|
||||
FORCEINLINE uint32_t shade_pal_index(uint32_t index, uint32_t light, const ShadeConstants &constants)
|
||||
{
|
||||
const PalEntry &color = GPalette.BaseColors[index];
|
||||
uint32_t red = color.r;
|
||||
uint32_t green = color.g;
|
||||
uint32_t blue = color.b;
|
||||
if (constants.simple_shade)
|
||||
{
|
||||
red = red * light / 256;
|
||||
green = green * light / 256;
|
||||
blue = blue * light / 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t inv_light = 256 - light;
|
||||
uint32_t inv_desaturate = 256 - constants.desaturate;
|
||||
|
||||
uint32_t intensity = ((red * 77 + green * 143 + blue * 37) >> 8) * constants.desaturate;
|
||||
|
||||
red = (red * inv_desaturate + intensity) / 256;
|
||||
green = (green * inv_desaturate + intensity) / 256;
|
||||
blue = (blue * inv_desaturate + intensity) / 256;
|
||||
|
||||
red = (constants.fade_red * inv_light + red * light) / 256;
|
||||
green = (constants.fade_green * inv_light + green * light) / 256;
|
||||
blue = (constants.fade_blue * inv_light + blue * light) / 256;
|
||||
|
||||
red = (red * constants.light_red) / 256;
|
||||
green = (green * constants.light_green) / 256;
|
||||
blue = (blue * constants.light_blue) / 256;
|
||||
}
|
||||
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
// Calculate constants for a simple shade
|
||||
#define SSE_SHADE_SIMPLE_INIT(light) \
|
||||
__m128i mlight_hi = _mm_set_epi16(256, light, light, light, 256, light, light, light); \
|
||||
__m128i mlight_lo = mlight_hi;
|
||||
|
||||
// Calculate constants for a simple shade with different light levels for each pixel
|
||||
#define SSE_SHADE_SIMPLE_INIT4(light3, light2, light1, light0) \
|
||||
__m128i mlight_hi = _mm_set_epi16(256, light1, light1, light1, 256, light0, light0, light0); \
|
||||
__m128i mlight_lo = _mm_set_epi16(256, light3, light3, light3, 256, light2, light2, light2);
|
||||
|
||||
// Simple shade 4 pixels
|
||||
#define SSE_SHADE_SIMPLE(fg) { \
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128()); \
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128()); \
|
||||
fg_hi = _mm_mullo_epi16(fg_hi, mlight_hi); \
|
||||
fg_hi = _mm_srli_epi16(fg_hi, 8); \
|
||||
fg_lo = _mm_mullo_epi16(fg_lo, mlight_lo); \
|
||||
fg_lo = _mm_srli_epi16(fg_lo, 8); \
|
||||
fg = _mm_packus_epi16(fg_lo, fg_hi); \
|
||||
}
|
||||
|
||||
// Calculate constants for a complex shade
|
||||
#define SSE_SHADE_INIT(light, shade_constants) \
|
||||
__m128i mlight_hi = _mm_set_epi16(256, light, light, light, 256, light, light, light); \
|
||||
__m128i mlight_lo = mlight_hi; \
|
||||
__m128i color = _mm_set_epi16( \
|
||||
shade_constants.light_alpha, shade_constants.light_red, shade_constants.light_green, shade_constants.light_blue, \
|
||||
shade_constants.light_alpha, shade_constants.light_red, shade_constants.light_green, shade_constants.light_blue); \
|
||||
__m128i fade = _mm_set_epi16( \
|
||||
shade_constants.fade_alpha, shade_constants.fade_red, shade_constants.fade_green, shade_constants.fade_blue, \
|
||||
shade_constants.fade_alpha, shade_constants.fade_red, shade_constants.fade_green, shade_constants.fade_blue); \
|
||||
__m128i fade_amount_hi = _mm_mullo_epi16(fade, _mm_subs_epu16(_mm_set1_epi16(256), mlight_hi)); \
|
||||
__m128i fade_amount_lo = fade_amount_hi; \
|
||||
__m128i inv_desaturate = _mm_set1_epi16(256 - shade_constants.desaturate); \
|
||||
|
||||
// Calculate constants for a complex shade with different light levels for each pixel
|
||||
#define SSE_SHADE_INIT4(light3, light2, light1, light0, shade_constants) \
|
||||
__m128i mlight_hi = _mm_set_epi16(256, light1, light1, light1, 256, light0, light0, light0); \
|
||||
__m128i mlight_lo = _mm_set_epi16(256, light3, light3, light3, 256, light2, light2, light2); \
|
||||
__m128i color = _mm_set_epi16( \
|
||||
shade_constants.light_alpha, shade_constants.light_red, shade_constants.light_green, shade_constants.light_blue, \
|
||||
shade_constants.light_alpha, shade_constants.light_red, shade_constants.light_green, shade_constants.light_blue); \
|
||||
__m128i fade = _mm_set_epi16( \
|
||||
shade_constants.fade_alpha, shade_constants.fade_red, shade_constants.fade_green, shade_constants.fade_blue, \
|
||||
shade_constants.fade_alpha, shade_constants.fade_red, shade_constants.fade_green, shade_constants.fade_blue); \
|
||||
__m128i fade_amount_hi = _mm_mullo_epi16(fade, _mm_subs_epu16(_mm_set1_epi16(256), mlight_hi)); \
|
||||
__m128i fade_amount_lo = _mm_mullo_epi16(fade, _mm_subs_epu16(_mm_set1_epi16(256), mlight_lo)); \
|
||||
__m128i inv_desaturate = _mm_set1_epi16(256 - shade_constants.desaturate); \
|
||||
|
||||
// Complex shade 4 pixels
|
||||
#define SSE_SHADE(fg, shade_constants) { \
|
||||
__m128i fg_hi = _mm_unpackhi_epi8(fg, _mm_setzero_si128()); \
|
||||
__m128i fg_lo = _mm_unpacklo_epi8(fg, _mm_setzero_si128()); \
|
||||
\
|
||||
__m128i intensity_hi = _mm_mullo_epi16(fg_hi, _mm_set_epi16(0, 77, 143, 37, 0, 77, 143, 37)); \
|
||||
uint16_t intensity_hi0 = ((intensity_hi.m128i_u16[2] + intensity_hi.m128i_u16[1] + intensity_hi.m128i_u16[0]) >> 8) * shade_constants.desaturate; \
|
||||
uint16_t intensity_hi1 = ((intensity_hi.m128i_u16[6] + intensity_hi.m128i_u16[5] + intensity_hi.m128i_u16[4]) >> 8) * shade_constants.desaturate; \
|
||||
intensity_hi = _mm_set_epi16(intensity_hi1, intensity_hi1, intensity_hi1, intensity_hi1, intensity_hi0, intensity_hi0, intensity_hi0, intensity_hi0); \
|
||||
\
|
||||
fg_hi = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_hi, inv_desaturate), intensity_hi), 8); \
|
||||
fg_hi = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_hi, mlight_hi), fade_amount_hi), 8); \
|
||||
fg_hi = _mm_srli_epi16(_mm_mullo_epi16(fg_hi, color), 8); \
|
||||
\
|
||||
__m128i intensity_lo = _mm_mullo_epi16(fg_lo, _mm_set_epi16(0, 77, 143, 37, 0, 77, 143, 37)); \
|
||||
uint16_t intensity_lo0 = ((intensity_lo.m128i_u16[2] + intensity_lo.m128i_u16[1] + intensity_lo.m128i_u16[0]) >> 8) * shade_constants.desaturate; \
|
||||
uint16_t intensity_lo1 = ((intensity_lo.m128i_u16[6] + intensity_lo.m128i_u16[5] + intensity_lo.m128i_u16[4]) >> 8) * shade_constants.desaturate; \
|
||||
intensity_lo = _mm_set_epi16(intensity_lo1, intensity_lo1, intensity_lo1, intensity_lo1, intensity_lo0, intensity_lo0, intensity_lo0, intensity_lo0); \
|
||||
\
|
||||
fg_lo = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_lo, inv_desaturate), intensity_lo), 8); \
|
||||
fg_lo = _mm_srli_epi16(_mm_adds_epu16(_mm_mullo_epi16(fg_lo, mlight_lo), fade_amount_lo), 8); \
|
||||
fg_lo = _mm_srli_epi16(_mm_mullo_epi16(fg_lo, color), 8); \
|
||||
\
|
||||
fg = _mm_packus_epi16(fg_lo, fg_hi); \
|
||||
}
|
||||
|
||||
extern bool r_swtruecolor;
|
||||
|
||||
extern double GlobVis;
|
||||
|
@ -125,7 +262,7 @@ extern double r_SpriteVisibility;
|
|||
extern int r_actualextralight;
|
||||
extern bool foggy;
|
||||
extern int fixedlightlev;
|
||||
extern lighttable_t* fixedcolormap;
|
||||
extern FColormap* fixedcolormap;
|
||||
extern FSpecialColormap*realfixedcolormap;
|
||||
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ void R_MapPlane (int y, int x1)
|
|||
if (plane_shade)
|
||||
{
|
||||
// Determine lighting based on the span's distance from the viewer.
|
||||
R_SetDSColorMapLight(basecolormap->Maps, GlobVis * fabs(CenterY - y), planeshade);
|
||||
R_SetDSColorMapLight(basecolormap, GlobVis * fabs(CenterY - y), planeshade);
|
||||
}
|
||||
|
||||
#ifdef X86_ASM
|
||||
|
@ -616,7 +616,7 @@ void R_MapColoredPlane_RGBA(int y, int x1)
|
|||
uint32_t *dest = ylookup[y] + x1 + (uint32_t*)dc_destorg;
|
||||
int count = (spanend[y] - x1 + 1);
|
||||
uint32_t light = calc_light_multiplier(ds_light);
|
||||
uint32_t color = shade_pal_index(ds_color, light);
|
||||
uint32_t color = shade_pal_index_simple(ds_color, light);
|
||||
for (int i = 0; i < count; i++)
|
||||
dest[i] = color;
|
||||
}
|
||||
|
@ -1598,7 +1598,7 @@ void R_DrawSkyPlane (visplane_t *pl)
|
|||
else
|
||||
{
|
||||
fakefixed = true;
|
||||
fixedcolormap = NormalLight.Maps;
|
||||
fixedcolormap = &NormalLight;
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ void R_DrawNormalPlane (visplane_t *pl, double _xscale, double _yscale, fixed_t
|
|||
ds_light = 0;
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
R_SetDSColorMapLight(basecolormap->Maps, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
plane_shade = false;
|
||||
}
|
||||
else if (fixedcolormap)
|
||||
|
@ -1860,7 +1860,7 @@ void R_DrawTiltedPlane(visplane_t *pl, double _xscale, double _yscale, fixed_t a
|
|||
ds_light = 0;
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
R_SetDSColorMapLight(basecolormap->Maps, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetDSColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
plane_shade = false;
|
||||
}
|
||||
else if (fixedcolormap)
|
||||
|
@ -1870,7 +1870,7 @@ void R_DrawTiltedPlane(visplane_t *pl, double _xscale, double _yscale, fixed_t a
|
|||
}
|
||||
else
|
||||
{
|
||||
R_SetDSColorMapLight(basecolormap->Maps, 0, 0);
|
||||
R_SetDSColorMapLight(basecolormap, 0, 0);
|
||||
plane_shade = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ static void BlastMaskedColumn (void (*blastfunc)(const BYTE *pixels, const FText
|
|||
// calculate lighting
|
||||
if (fixedcolormap == NULL && fixedlightlev < 0)
|
||||
{
|
||||
R_SetColorMapLight(basecolormap->Maps, rw_light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, rw_light, wallshade);
|
||||
}
|
||||
|
||||
dc_iscale = xs_Fix<16>::ToFix(MaskedSWall[dc_x] * MaskedScaleY);
|
||||
|
@ -313,7 +313,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
|
|||
rw_scalestep = ds->iscalestep;
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(basecolormap->Maps, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
|
@ -630,7 +630,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
|
|||
}
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(basecolormap->Maps, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
|
@ -1126,6 +1126,11 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *l
|
|||
palookuplight[3] = 0;
|
||||
}
|
||||
|
||||
if (fixedcolormap)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else
|
||||
R_SetColorMapLight(basecolormap, 0, 0);
|
||||
|
||||
for(; (x < x2) && (x & 3); ++x)
|
||||
{
|
||||
light += rw_lightstep;
|
||||
|
@ -1137,7 +1142,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *l
|
|||
|
||||
if (!fixed)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(basecolormapdata, light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, light, wallshade);
|
||||
}
|
||||
|
||||
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
||||
|
@ -1241,7 +1246,7 @@ void wallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *l
|
|||
|
||||
if (!fixed)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(basecolormapdata, light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, light, wallshade);
|
||||
}
|
||||
|
||||
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
||||
|
@ -1496,6 +1501,11 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_
|
|||
palookuplight[3] = 0;
|
||||
}
|
||||
|
||||
if (fixedcolormap)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else
|
||||
R_SetColorMapLight(basecolormap, 0, 0);
|
||||
|
||||
for(; (x < x2) && (((size_t)pixel >> pixelshift) & 3); ++x, pixel += pixelsize)
|
||||
{
|
||||
light += rw_lightstep;
|
||||
|
@ -1505,7 +1515,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_
|
|||
|
||||
if (!fixed)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(basecolormapdata, light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, light, wallshade);
|
||||
}
|
||||
|
||||
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
||||
|
@ -1605,7 +1615,7 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_
|
|||
|
||||
if (!fixed)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(basecolormapdata, light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, light, wallshade);
|
||||
}
|
||||
|
||||
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
||||
|
@ -1690,6 +1700,11 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, f
|
|||
palookuplight[3] = 0;
|
||||
}
|
||||
|
||||
if (fixedcolormap)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else
|
||||
R_SetColorMapLight(basecolormap, 0, 0);
|
||||
|
||||
for(; (x < x2) && (((size_t)pixel >> pixelshift) & 3); ++x, pixel += pixelsize)
|
||||
{
|
||||
light += rw_lightstep;
|
||||
|
@ -1699,7 +1714,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, f
|
|||
|
||||
if (!fixed)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(basecolormapdata, light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, light, wallshade);
|
||||
}
|
||||
|
||||
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
||||
|
@ -1801,7 +1816,7 @@ void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, f
|
|||
|
||||
if (!fixed)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(basecolormapdata, light, wallshade);
|
||||
R_SetColorMapLight(basecolormap, light, wallshade);
|
||||
}
|
||||
|
||||
dc_source = getcol (rw_pic, (lwal[x] + xoffset) >> FRACBITS);
|
||||
|
@ -1839,7 +1854,7 @@ void R_RenderSegLoop ()
|
|||
fixed_t xoffset = rw_offset;
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(basecolormap->Maps, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
|
@ -3238,11 +3253,11 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
|||
|
||||
rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep;
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(usecolormap->Maps, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
||||
R_SetColorMapLight(usecolormap->Maps, 0, 0);
|
||||
R_SetColorMapLight(usecolormap, 0, 0);
|
||||
else
|
||||
calclighting = true;
|
||||
|
||||
|
@ -3293,7 +3308,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap->Maps, rw_light, wallshade);
|
||||
R_SetColorMapLight(usecolormap, rw_light, wallshade);
|
||||
}
|
||||
R_WallSpriteColumn (R_DrawMaskedColumn);
|
||||
dc_x++;
|
||||
|
@ -3303,7 +3318,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap->Maps, rw_light, wallshade);
|
||||
R_SetColorMapLight(usecolormap, rw_light, wallshade);
|
||||
}
|
||||
rt_initcols(nullptr);
|
||||
for (int zz = 4; zz; --zz)
|
||||
|
@ -3318,7 +3333,7 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap->Maps, rw_light, wallshade);
|
||||
R_SetColorMapLight(usecolormap, rw_light, wallshade);
|
||||
}
|
||||
R_WallSpriteColumn (R_DrawMaskedColumn);
|
||||
dc_x++;
|
||||
|
|
|
@ -323,7 +323,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
|
|||
|
||||
// curse Doom's overuse of global variables in the renderer.
|
||||
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
|
||||
unsigned char *savecolormap = fixedcolormap;
|
||||
FColormap *savecolormap = fixedcolormap;
|
||||
FSpecialColormap *savecm = realfixedcolormap;
|
||||
|
||||
DAngle savedfov = FieldOfView;
|
||||
|
|
|
@ -416,7 +416,7 @@ void R_DrawVisSprite (vissprite_t *vis)
|
|||
{ // For shaded sprites, R_SetPatchStyle sets a dc_colormap to an alpha table, but
|
||||
// it is the brightest one. We need to get back to the proper light level for
|
||||
// this sprite.
|
||||
R_SetColorMapLight(dc_colormap, 0, vis->Style.ColormapNum << FRACBITS);
|
||||
R_SetColorMapLight(dc_fcolormap, 0, vis->Style.ColormapNum << FRACBITS);
|
||||
}
|
||||
|
||||
if (mode != DontDraw)
|
||||
|
@ -538,11 +538,11 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
rw_lightstep = float((GlobVis / spr->wallc.sz2 - rw_lightleft) / (spr->wallc.sx2 - spr->wallc.sx1));
|
||||
rw_light = rw_lightleft + (x1 - spr->wallc.sx1) * rw_lightstep;
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(usecolormap->Maps, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||
R_SetColorMapLight(usecolormap->Maps, 0, 0);
|
||||
R_SetColorMapLight(usecolormap, 0, 0);
|
||||
else
|
||||
calclighting = true;
|
||||
|
||||
|
@ -593,7 +593,7 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap->Maps, rw_light, shade);
|
||||
R_SetColorMapLight(usecolormap, rw_light, shade);
|
||||
}
|
||||
if (!R_ClipSpriteColumnWithPortals(spr))
|
||||
R_WallSpriteColumn(R_DrawMaskedColumn);
|
||||
|
@ -604,7 +604,7 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap->Maps, rw_light, shade);
|
||||
R_SetColorMapLight(usecolormap, rw_light, shade);
|
||||
}
|
||||
rt_initcols(nullptr);
|
||||
for (int zz = 4; zz; --zz)
|
||||
|
@ -620,7 +620,7 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap->Maps, rw_light, shade);
|
||||
R_SetColorMapLight(usecolormap, rw_light, shade);
|
||||
}
|
||||
if (!R_ClipSpriteColumnWithPortals(spr))
|
||||
R_WallSpriteColumn(R_DrawMaskedColumn);
|
||||
|
@ -680,7 +680,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop
|
|||
|
||||
// Render the voxel, either directly to the screen or offscreen.
|
||||
R_DrawVoxel(spr->pa.vpos, spr->pa.vang, spr->gpos, spr->Angle,
|
||||
spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.BaseColormap + (spr->Style.ColormapNum << COLORMAPSHIFT), cliptop, clipbot,
|
||||
spr->xscale, FLOAT2FIXED(spr->yscale), spr->voxel, spr->Style.BaseColormap->Maps + (spr->Style.ColormapNum << COLORMAPSHIFT), cliptop, clipbot,
|
||||
minslabz, maxslabz, flags);
|
||||
|
||||
// Blend the voxel, if that's what we need to do.
|
||||
|
@ -1121,19 +1121,19 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
}
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
vis->Style.BaseColormap = mybasecolormap->Maps;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (!foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
||||
{ // full bright
|
||||
vis->Style.BaseColormap = mybasecolormap->Maps;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{ // diminished light
|
||||
vis->Style.ColormapNum = GETPALOOKUP(
|
||||
r_SpriteVisibility / MAX(tz, MINZ), spriteshade);
|
||||
vis->Style.BaseColormap = mybasecolormap->Maps;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1208,7 +1208,7 @@ static void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID p
|
|||
vis->bWallSprite = true;
|
||||
vis->Style.ColormapNum = GETPALOOKUP(
|
||||
r_SpriteVisibility / MAX(tz, MINZ), spriteshade);
|
||||
vis->Style.BaseColormap = basecolormap->Maps;
|
||||
vis->Style.BaseColormap = basecolormap;
|
||||
vis->wallc = wallc;
|
||||
}
|
||||
|
||||
|
@ -1428,7 +1428,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
|
|||
|
||||
if (realfixedcolormap != NULL)
|
||||
{ // fixed color
|
||||
vis->Style.BaseColormap = realfixedcolormap->Colormap;
|
||||
vis->Style.BaseColormap = realfixedcolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
|
@ -1439,39 +1439,38 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
|
|||
}
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
vis->Style.BaseColormap = mybasecolormap->Maps;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (!foggy && psp->state->GetFullbright())
|
||||
{ // full bright
|
||||
vis->Style.BaseColormap = mybasecolormap->Maps; // [RH] use basecolormap
|
||||
vis->Style.BaseColormap = mybasecolormap; // [RH] use basecolormap
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{ // local light
|
||||
vis->Style.BaseColormap = mybasecolormap->Maps;
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.ColormapNum = GETPALOOKUP(0, spriteshade);
|
||||
}
|
||||
}
|
||||
if (camera->Inventory != NULL)
|
||||
{
|
||||
BYTE oldcolormapnum = vis->Style.ColormapNum;
|
||||
lighttable_t *oldcolormap = vis->Style.BaseColormap;
|
||||
FColormap *oldcolormap = vis->Style.BaseColormap;
|
||||
camera->Inventory->AlterWeaponSprite (&vis->Style);
|
||||
if (vis->Style.BaseColormap != oldcolormap || vis->Style.ColormapNum != oldcolormapnum)
|
||||
{
|
||||
// The colormap has changed. Is it one we can easily identify?
|
||||
// If not, then don't bother trying to identify it for
|
||||
// hardware accelerated drawing.
|
||||
if (vis->Style.BaseColormap < SpecialColormaps[0].Colormap ||
|
||||
vis->Style.BaseColormap > SpecialColormaps.Last().Colormap)
|
||||
if (vis->Style.BaseColormap < &SpecialColormaps[0] ||
|
||||
vis->Style.BaseColormap > &SpecialColormaps.Last())
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
// Has the basecolormap changed? If so, we can't hardware accelerate it,
|
||||
// since we don't know what it is anymore.
|
||||
else if (vis->Style.BaseColormap < mybasecolormap->Maps ||
|
||||
vis->Style.BaseColormap >= mybasecolormap->Maps + NUMCOLORMAPS*256)
|
||||
else if (vis->Style.BaseColormap != mybasecolormap)
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
|
@ -1479,13 +1478,13 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
|
|||
}
|
||||
// If we're drawing with a special colormap, but shaders for them are disabled, do
|
||||
// not accelerate.
|
||||
if (!r_shadercolormaps && (vis->Style.BaseColormap >= SpecialColormaps[0].Colormap &&
|
||||
vis->Style.BaseColormap <= SpecialColormaps.Last().Colormap))
|
||||
if (!r_shadercolormaps && (vis->Style.BaseColormap >= &SpecialColormaps[0] &&
|
||||
vis->Style.BaseColormap <= &SpecialColormaps.Last()))
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
// If drawing with a BOOM colormap, disable acceleration.
|
||||
if (mybasecolormap == &NormalLight && NormalLight.Maps != realcolormaps)
|
||||
if (mybasecolormap == &NormalLight && NormalLight.Maps != realcolormaps.Maps)
|
||||
{
|
||||
noaccel = true;
|
||||
}
|
||||
|
@ -1502,7 +1501,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, double sx, double
|
|||
else
|
||||
{
|
||||
colormap_to_use = basecolormap;
|
||||
vis->Style.BaseColormap = basecolormap->Maps;
|
||||
vis->Style.BaseColormap = basecolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
vis->Style.RenderStyle = STYLE_Normal;
|
||||
}
|
||||
|
@ -1649,12 +1648,10 @@ void R_DrawRemainingPlayerSprites()
|
|||
FColormapStyle colormapstyle;
|
||||
bool usecolormapstyle = false;
|
||||
|
||||
if (vis->Style.BaseColormap >= SpecialColormaps[0].Colormap &&
|
||||
vis->Style.BaseColormap < SpecialColormaps[SpecialColormaps.Size()].Colormap)
|
||||
if (vis->Style.BaseColormap >= &SpecialColormaps[0] &&
|
||||
vis->Style.BaseColormap < &SpecialColormaps[SpecialColormaps.Size()])
|
||||
{
|
||||
// Yuck! There needs to be a better way to store colormaps in the vissprite... :(
|
||||
ptrdiff_t specialmap = (vis->Style.BaseColormap - SpecialColormaps[0].Colormap) / sizeof(FSpecialColormap) + vis->Style.ColormapNum;
|
||||
special = &SpecialColormaps[specialmap];
|
||||
special = static_cast<FSpecialColormap*>(vis->Style.BaseColormap);
|
||||
}
|
||||
else if (colormap->Color == PalEntry(255,255,255) &&
|
||||
colormap->Desaturate == 0)
|
||||
|
@ -1912,7 +1909,7 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
int r1, r2;
|
||||
short topclip, botclip;
|
||||
short *clip1, *clip2;
|
||||
lighttable_t *colormap = spr->Style.BaseColormap;
|
||||
FColormap *colormap = spr->Style.BaseColormap;
|
||||
int colormapnum = spr->Style.ColormapNum;
|
||||
F3DFloor *rover;
|
||||
FDynamicColormap *mybasecolormap;
|
||||
|
@ -2010,18 +2007,18 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
}
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
spr->Style.BaseColormap = mybasecolormap->Maps;
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||
{ // full bright
|
||||
spr->Style.BaseColormap = mybasecolormap->Maps;
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
{ // diminished light
|
||||
spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight);
|
||||
spr->Style.BaseColormap = mybasecolormap->Maps;
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.ColormapNum = GETPALOOKUP(r_SpriteVisibility / MAX(MINZ, (double)spr->depth), spriteshade);
|
||||
}
|
||||
}
|
||||
|
@ -2438,7 +2435,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
int x1, x2, y1, y2;
|
||||
vissprite_t* vis;
|
||||
sector_t* heightsec = NULL;
|
||||
BYTE* map;
|
||||
FColormap* map;
|
||||
|
||||
// [ZZ] Particle not visible through the portal plane
|
||||
if (CurrentPortal && !!P_PointOnLineSide(particle->Pos, CurrentPortal->dst))
|
||||
|
@ -2511,7 +2508,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = &heightsec->ceilingplane;
|
||||
toppic = sector->GetTexture(sector_t::ceiling);
|
||||
botpic = heightsec->GetTexture(sector_t::ceiling);
|
||||
map = heightsec->ColorMap->Maps;
|
||||
map = heightsec->ColorMap;
|
||||
}
|
||||
else if (fakeside == FAKED_BelowFloor)
|
||||
{
|
||||
|
@ -2519,7 +2516,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = §or->floorplane;
|
||||
toppic = heightsec->GetTexture(sector_t::floor);
|
||||
botpic = sector->GetTexture(sector_t::floor);
|
||||
map = heightsec->ColorMap->Maps;
|
||||
map = heightsec->ColorMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2527,7 +2524,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = &heightsec->floorplane;
|
||||
toppic = heightsec->GetTexture(sector_t::ceiling);
|
||||
botpic = heightsec->GetTexture(sector_t::floor);
|
||||
map = sector->ColorMap->Maps;
|
||||
map = sector->ColorMap;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2536,7 +2533,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
botplane = §or->floorplane;
|
||||
toppic = sector->GetTexture(sector_t::ceiling);
|
||||
botpic = sector->GetTexture(sector_t::floor);
|
||||
map = sector->ColorMap->Maps;
|
||||
map = sector->ColorMap;
|
||||
}
|
||||
|
||||
if (botpic != skyflatnum && particle->Pos.Z < botplane->ZatPoint (particle->Pos))
|
||||
|
@ -2619,7 +2616,7 @@ void R_DrawParticle_C (vissprite_t *vis)
|
|||
{
|
||||
int spacing;
|
||||
BYTE *dest;
|
||||
BYTE color = vis->Style.BaseColormap[(vis->Style.ColormapNum << COLORMAPSHIFT) + vis->startfrac];
|
||||
BYTE color = vis->Style.BaseColormap->Maps[(vis->Style.ColormapNum << COLORMAPSHIFT) + vis->startfrac];
|
||||
int yl = vis->y1;
|
||||
int ycount = vis->y2 - yl + 1;
|
||||
int x1 = vis->x1;
|
||||
|
@ -2685,7 +2682,7 @@ void R_DrawParticle_RGBA(vissprite_t *vis)
|
|||
{
|
||||
int spacing;
|
||||
uint32_t *dest;
|
||||
BYTE color = vis->Style.BaseColormap[vis->startfrac];
|
||||
BYTE color = vis->Style.BaseColormap->Maps[vis->startfrac];
|
||||
int yl = vis->y1;
|
||||
int ycount = vis->y2 - yl + 1;
|
||||
int x1 = vis->x1;
|
||||
|
@ -2693,7 +2690,7 @@ void R_DrawParticle_RGBA(vissprite_t *vis)
|
|||
|
||||
R_DrawMaskedSegsBehindParticle(vis);
|
||||
|
||||
uint32_t fg = shade_pal_index(color, calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS)));
|
||||
uint32_t fg = shade_pal_index_simple(color, calc_light_multiplier(LIGHTSCALE(0, vis->Style.ColormapNum << FRACBITS)));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
|
|
@ -889,11 +889,11 @@ void R_SetupFrame (AActor *actor)
|
|||
BaseBlendG = GPART(newblend);
|
||||
BaseBlendB = BPART(newblend);
|
||||
BaseBlendA = APART(newblend) / 255.f;
|
||||
NormalLight.Maps = realcolormaps;
|
||||
NormalLight.Maps = realcolormaps.Maps;
|
||||
}
|
||||
else
|
||||
{
|
||||
NormalLight.Maps = realcolormaps + NUMCOLORMAPS*256*newblend;
|
||||
NormalLight.Maps = realcolormaps.Maps + NUMCOLORMAPS*256*newblend;
|
||||
BaseBlendR = BaseBlendG = BaseBlendB = 0;
|
||||
BaseBlendA = 0.f;
|
||||
}
|
||||
|
|
|
@ -171,14 +171,14 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
|
||||
if (translation != NULL)
|
||||
{
|
||||
R_SetColorMapLight((lighttable_t *)translation, 0, 0);
|
||||
R_SetTranslationMap((lighttable_t *)translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_SetColorMapLight(identitymap, 0, 0);
|
||||
R_SetTranslationMap(identitymap);
|
||||
}
|
||||
|
||||
fixedcolormap = dc_colormap;
|
||||
fixedcolormap = dc_fcolormap;
|
||||
ESPSResult mode = R_SetPatchStyle (parms.style, parms.Alpha, 0, parms.fillcolor);
|
||||
|
||||
BYTE *destorgsave = dc_destorg;
|
||||
|
@ -1025,7 +1025,7 @@ void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
|||
{
|
||||
uint32_t *spot = (uint32_t*)GetBuffer() + oldyyshifted + xx;
|
||||
|
||||
uint32_t fg = shade_pal_index(basecolor, calc_light_multiplier(0));
|
||||
uint32_t fg = shade_pal_index_simple(basecolor, calc_light_multiplier(0));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
@ -1394,7 +1394,10 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
|||
|
||||
// Setup constant texture mapping parameters.
|
||||
R_SetupSpanBits(tex);
|
||||
R_SetSpanColormap(colormap != NULL ? &colormap->Maps[clamp(shade >> FRACBITS, 0, NUMCOLORMAPS-1) * 256] : identitymap);
|
||||
if (colormap)
|
||||
R_SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
|
||||
else
|
||||
R_SetSpanColormap(&identitycolormap, 0);
|
||||
R_SetSpanSource(tex->GetPixels());
|
||||
scalex = double(1u << (32 - ds_xbits)) / scalex;
|
||||
scaley = double(1u << (32 - ds_ybits)) / scaley;
|
||||
|
|
Loading…
Reference in a new issue