- Added new patch style "Overlay" for TEXTURES. This is the same as CopyAlpha, except it only

copies the patch's alpha channel where it has a higher alpha than what's underneath.

SVN r3638 (trunk)
This commit is contained in:
Randy Heit 2012-05-11 02:26:50 +00:00
parent b9c3f8db4f
commit 37001d3640
3 changed files with 11 additions and 1 deletions

View File

@ -206,6 +206,7 @@ static const CopyFunc copyfuncs[][9]={
COPY_FUNCS(bModulate),
COPY_FUNCS(bCopyAlpha),
COPY_FUNCS(bCopyNewAlpha),
COPY_FUNCS(bOverlay),
COPY_FUNCS(bOverwrite)
};
#undef COPY_FUNCS
@ -422,6 +423,7 @@ static const CopyPalettedFunc copypalettedfuncs[]=
iCopyPaletted<cBGRA, bModulate>,
iCopyPaletted<cBGRA, bCopyAlpha>,
iCopyPaletted<cBGRA, bCopyNewAlpha>,
iCopyPaletted<cBGRA, bOverlay>,
iCopyPaletted<cBGRA, bOverwrite>
};

View File

@ -319,6 +319,7 @@ enum ECopyOp
OP_MODULATE,
OP_COPYALPHA,
OP_COPYNEWALPHA,
OP_OVERLAY,
OP_OVERWRITE
};
@ -359,6 +360,13 @@ struct bCopyAlpha
static __forceinline bool ProcessAlpha0() { return false; }
};
struct bOverlay
{
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; }
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = MAX(s,d); }
static __forceinline bool ProcessAlpha0() { return false; }
};
struct bBlend
{
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (d*i->invalpha + s*i->alpha) >> FRACBITS; }

View File

@ -1180,7 +1180,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, bool silent, i
}
else if (sc.Compare("style"))
{
static const char *styles[] = {"copy", "translucent", "add", "subtract", "reversesubtract", "modulate", "copyalpha", "copynewalpha", NULL };
static const char *styles[] = {"copy", "translucent", "add", "subtract", "reversesubtract", "modulate", "copyalpha", "copynewalpha", "overlay", NULL };
sc.MustGetString();
part.op = sc.MustMatchString(styles);
bComplex |= (part.op != OP_COPY);