You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
2.7 KiB
114 lines
2.7 KiB
dnl----------------------------------------------------------------------------
|
|
dnl
|
|
dnl rtexread.mh
|
|
dnl
|
|
dnl Ramp texel reading macros.
|
|
dnl
|
|
dnl Copyright (C) Microsoft Corporation, 1997.
|
|
dnl
|
|
dnl----------------------------------------------------------------------------
|
|
dnl
|
|
pushdef(`d_BeadMacrosOnly', `')dnl
|
|
include(`rampbead.mh')dnl
|
|
popdef(`d_BeadMacrosOnly')dnl
|
|
dnl
|
|
dnl d_RampTexelRead
|
|
dnl
|
|
dnl Generates a texel read function body.
|
|
dnl Assumes pTex is the texture.
|
|
dnl
|
|
dnl $1 is a combination of:
|
|
dnl Palette8 Palette4
|
|
dnl NoTrans MaybeTrans ColorKey
|
|
dnl Modulate Copy
|
|
dnl $2 is the U coordinate, $3 is the V coordinate,
|
|
dnl $4 is a pointer to the texture bits, $5 is the U shift.
|
|
dnl
|
|
define(`d_RampTexelRead', `
|
|
ifelse(eval(d_index($1, `Palette8') >= 0), `1', `
|
|
INT32 iTexel;
|
|
iTexel = $4[$2 | ($3 << $5)];
|
|
', `
|
|
ifelse(eval(d_index($1, `Palette4') >= 0), `1', `
|
|
INT32 iIndex;
|
|
iIndex = $2 | ($3 << $5);
|
|
INT32 iTexel;
|
|
iTexel = $4[iIndex >> 1];
|
|
if ((iIndex & 1) == 0)
|
|
{
|
|
iTexel &= 0xf;
|
|
}
|
|
else
|
|
{
|
|
iTexel >>= 4;
|
|
}', `
|
|
INT32 iTexel;
|
|
iTexel = ((PUINT16)$4)[$2 | ($3 << $5)];
|
|
')dnl
|
|
')dnl
|
|
D3DCOLOR Color;
|
|
ifelse(eval(d_index($1, `Modulate') >= 0), `1', `
|
|
Color = pTex->pRampmap[iTexel];
|
|
', `
|
|
Color = (D3DCOLOR)iTexel;
|
|
')dnl
|
|
ifelse(eval(d_index($1, `NoColorKey') >= 0), `1', `
|
|
// if going into alpha blend code, must set alpha so textured objects
|
|
// dont disappear
|
|
Color |= 0xff000000;
|
|
', `
|
|
if (iTexel == (INT32)pTex->TransparentColor)
|
|
{
|
|
Color &= 0x00ffffff;
|
|
}
|
|
else
|
|
{
|
|
Color |= 0xff000000;
|
|
}
|
|
')dnl
|
|
')dnl
|
|
dnl
|
|
dnl d_RampTexelReadNoPixel
|
|
dnl
|
|
dnl Generates a texel read function body.
|
|
dnl Handles colorkeying by directly going to a label on failures.
|
|
dnl
|
|
dnl $1 is a combination of:
|
|
dnl Palette8 Palette4
|
|
dnl NoTrans MaybeTrans ColorKey
|
|
dnl Modulate Copy
|
|
dnl $2 is the U coordinate, $3 is the V coordinate,
|
|
dnl $4 is a pointer to the texture bits, $5 is the U shift.
|
|
dnl $6 is the no-pixel label to jump to.
|
|
dnl
|
|
define(`d_RampTexelReadNoPixel', `
|
|
ifelse(eval(d_index($1, `Palette8') >= 0), `1', `
|
|
INT32 iTexel;
|
|
iTexel = $4[$2 | ($3 << $5)];
|
|
', `
|
|
INT32 iIndex;
|
|
iIndex = $2 | ($3 << $5);
|
|
INT32 iTexel;
|
|
iTexel = $4[iIndex >> 1];
|
|
if ((iIndex & 1) == 0)
|
|
{
|
|
iTexel &= 0xf;
|
|
}
|
|
else
|
|
{
|
|
iTexel >>= 4;
|
|
}
|
|
')dnl
|
|
D3DCOLOR Color;
|
|
ifelse(eval(d_index($1, `Modulate') >= 0), `1', `
|
|
Color = pTex->pRampmap[iTexel];
|
|
', `
|
|
Color = (D3DCOLOR)iTexel;
|
|
')dnl
|
|
ifelse(eval(d_index($1, `NoColorKey') < 0), `1', `
|
|
if (iTexel == (INT32)pTex->TransparentColor)
|
|
{
|
|
goto $6;
|
|
}
|
|
')dnl
|
|
')dnl
|