mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 14:41:40 +00:00
- Made translation support for multipatch textures operational.
SVN r919 (trunk)
This commit is contained in:
parent
9450db3cec
commit
d5738e3876
13 changed files with 140 additions and 61 deletions
|
@ -1,3 +1,6 @@
|
|||
April 16, 2008 (Changes by Graf Zahl)
|
||||
- Made translation support for multipatch textures operational.
|
||||
|
||||
April 15, 2008
|
||||
- Added support for the GUS patch format's scale_frequency and scale_factor
|
||||
parameters. These seem to be used primarily to restrict percussion
|
||||
|
|
|
@ -211,7 +211,7 @@ private:
|
|||
void Unload ();
|
||||
~FDoomStatusBarTexture ();
|
||||
void SetPlayerRemap(FRemapTable *remap);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
|
||||
FTextureFormat GetFormat()
|
||||
{
|
||||
|
@ -1093,11 +1093,11 @@ void DDoomStatusBar::FDoomStatusBarTexture::MakeTexture ()
|
|||
if (multiplayer) DrawToBar("STFBANY", 143, 1, STFBRemap? STFBRemap->Remap : NULL);
|
||||
}
|
||||
|
||||
int DDoomStatusBar::FDoomStatusBarTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int DDoomStatusBar::FDoomStatusBarTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
FTexture *tex;
|
||||
|
||||
// rotate is never used here
|
||||
// rotate and inf are never used here
|
||||
BaseTexture->CopyTrueColorPixels(bmp, x, y);
|
||||
if (!deathmatch)
|
||||
{
|
||||
|
|
13
src/r_data.h
13
src/r_data.h
|
@ -94,7 +94,7 @@ public:
|
|||
void Unload ();
|
||||
virtual void SetFrontSkyLayer ();
|
||||
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
int GetSourceLump() { return DefinitionLump; }
|
||||
|
||||
protected:
|
||||
|
@ -112,7 +112,6 @@ protected:
|
|||
FTexture *Texture;
|
||||
|
||||
TexPart();
|
||||
~TexPart();
|
||||
};
|
||||
|
||||
int NumParts;
|
||||
|
@ -263,7 +262,7 @@ public:
|
|||
const BYTE *GetPixels ();
|
||||
void Unload ();
|
||||
FTextureFormat GetFormat ();
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
bool UseBasePalette();
|
||||
int GetSourceLump() { return SourceLump; }
|
||||
|
||||
|
@ -331,7 +330,7 @@ protected:
|
|||
void DecompressDXT3 (FWadLump &lump, bool premultiplied, BYTE *tcbuf = NULL);
|
||||
void DecompressDXT5 (FWadLump &lump, bool premultiplied, BYTE *tcbuf = NULL);
|
||||
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
bool UseBasePalette();
|
||||
|
||||
friend class FTexture;
|
||||
|
@ -347,7 +346,7 @@ public:
|
|||
const BYTE *GetPixels ();
|
||||
void Unload ();
|
||||
FTextureFormat GetFormat ();
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
bool UseBasePalette();
|
||||
int GetSourceLump() { return SourceLump; }
|
||||
|
||||
|
@ -399,7 +398,7 @@ public:
|
|||
void Unload ();
|
||||
FTextureFormat GetFormat ();
|
||||
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
bool UseBasePalette();
|
||||
int GetSourceLump() { return SourceLump; }
|
||||
|
||||
|
@ -456,7 +455,7 @@ public:
|
|||
void Unload ();
|
||||
FTextureFormat GetFormat ();
|
||||
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
bool UseBasePalette();
|
||||
int GetSourceLump() { return SourceLump; }
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ struct line_t;
|
|||
class player_s;
|
||||
class FScanner;
|
||||
class FBitmap;
|
||||
struct FCopyInfo;
|
||||
|
||||
//
|
||||
// The SECTORS record, at runtime.
|
||||
|
@ -795,7 +796,7 @@ public:
|
|||
// Returns the whole texture, stored in column-major order
|
||||
virtual const BYTE *GetPixels () = 0;
|
||||
|
||||
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0);
|
||||
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL);
|
||||
int CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap);
|
||||
virtual bool UseBasePalette();
|
||||
virtual int GetSourceLump() { return -1; }
|
||||
|
|
|
@ -368,14 +368,14 @@ bool ClipCopyPixelRect(int texwidth, int texheight, int &originx, int &originy,
|
|||
//
|
||||
//===========================================================================
|
||||
void FBitmap::CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int srcwidth,
|
||||
int srcheight, int step_x, int step_y, int rotate, int ct)
|
||||
int srcheight, int step_x, int step_y, int rotate, int ct, FCopyInfo *inf)
|
||||
{
|
||||
if (ClipCopyPixelRect(Width, Height, originx, originy, patch, srcwidth, srcheight, step_x, step_y, rotate))
|
||||
{
|
||||
BYTE *buffer = data + 4 * originx + Pitch * originy;
|
||||
for (int y=0;y<srcheight;y++)
|
||||
{
|
||||
copyfuncs[ct](&buffer[y*Pitch], &patch[y*step_y], srcwidth, step_x, NULL);
|
||||
copyfuncs[ct](&buffer[y*Pitch], &patch[y*step_y], srcwidth, step_x, inf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,13 +386,26 @@ void FBitmap::CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int
|
|||
//
|
||||
//===========================================================================
|
||||
void FBitmap::CopyPixelData(int originx, int originy, const BYTE * patch, int srcwidth, int srcheight,
|
||||
int step_x, int step_y, int rotate, PalEntry * palette)
|
||||
int step_x, int step_y, int rotate, PalEntry * palette, FCopyInfo *inf)
|
||||
{
|
||||
int x,y,pos;
|
||||
|
||||
if (ClipCopyPixelRect(Width, Height, originx, originy, patch, srcwidth, srcheight, step_x, step_y, rotate))
|
||||
{
|
||||
BYTE *buffer = data + 4*originx + Pitch*originy;
|
||||
PalEntry penew[256];
|
||||
|
||||
if (inf && inf->blend)
|
||||
{
|
||||
// The palette's alpha is inverted so in order to use the
|
||||
// True Color copy functions it has to be inverted temporarily.
|
||||
memcpy(penew, palette, 4*256);
|
||||
for(int i=0;i<256;i++) penew[i].a = 255-penew[i].a;
|
||||
copyfuncs[CF_PalEntry]((BYTE*)penew, (BYTE*)penew, 256, 4, inf);
|
||||
for(int i=0;i<256;i++) penew[i].a = 255-penew[i].a;
|
||||
palette = penew;
|
||||
}
|
||||
|
||||
|
||||
for (y=0;y<srcheight;y++)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
|
||||
struct FCopyInfo;
|
||||
|
||||
class FBitmap
|
||||
{
|
||||
BYTE *data;
|
||||
|
@ -87,11 +89,31 @@ public:
|
|||
return data != NULL;
|
||||
}
|
||||
|
||||
int GetHeight() const
|
||||
{
|
||||
return Height;
|
||||
}
|
||||
|
||||
int GetWidth() const
|
||||
{
|
||||
return Width;
|
||||
}
|
||||
|
||||
int GetPitch() const
|
||||
{
|
||||
return Pitch;
|
||||
}
|
||||
|
||||
const BYTE *GetPixels() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
virtual void CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int srcwidth,
|
||||
int srcheight, int step_x, int step_y, int rotate, int ct);
|
||||
int srcheight, int step_x, int step_y, int rotate, int ct, FCopyInfo *inf = NULL);
|
||||
virtual void CopyPixelData(int originx, int originy, const BYTE * patch, int srcwidth, int srcheight,
|
||||
int step_x, int step_y, int rotate, PalEntry * palette);
|
||||
int step_x, int step_y, int rotate, PalEntry * palette, FCopyInfo *inf = NULL);
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -743,7 +743,7 @@ void FDDSTexture::DecompressDXT5 (FWadLump &lump, bool premultiplied, BYTE *tcbu
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FDDSTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int FDDSTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
FWadLump lump = Wads.OpenLumpNum (SourceLump);
|
||||
|
||||
|
@ -769,7 +769,7 @@ int FDDSTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
|||
}
|
||||
|
||||
// All formats decompress to RGBA.
|
||||
bmp->CopyPixelDataRGB(x, y, TexBuffer, Width, Height, 4, Width*4, rotate, CF_RGBA);
|
||||
bmp->CopyPixelDataRGB(x, y, TexBuffer, Width, Height, 4, Width*4, rotate, CF_RGBA, inf);
|
||||
delete [] TexBuffer;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ void FJPEGTexture::MakeTexture ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FJPEGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int FJPEGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
PalEntry pe[256];
|
||||
|
||||
|
@ -377,18 +377,18 @@ int FJPEGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
|||
{
|
||||
case JCS_RGB:
|
||||
bmp->CopyPixelDataRGB(x, y, buff, cinfo.output_width, cinfo.output_height,
|
||||
3, cinfo.output_width * cinfo.output_components, rotate, CF_RGB);
|
||||
3, cinfo.output_width * cinfo.output_components, rotate, CF_RGB, inf);
|
||||
break;
|
||||
|
||||
case JCS_GRAYSCALE:
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // default to a gray map
|
||||
bmp->CopyPixelData(x, y, buff, cinfo.output_width, cinfo.output_height,
|
||||
1, cinfo.output_width, rotate, pe);
|
||||
1, cinfo.output_width, rotate, pe, inf);
|
||||
break;
|
||||
|
||||
case JCS_CMYK:
|
||||
bmp->CopyPixelDataRGB(x, y, buff, cinfo.output_width, cinfo.output_height,
|
||||
4, cinfo.output_width * cinfo.output_components, rotate, CF_CMYK);
|
||||
4, cinfo.output_width * cinfo.output_components, rotate, CF_CMYK, inf);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -179,6 +179,11 @@ FMultiPatchTexture::~FMultiPatchTexture ()
|
|||
Unload ();
|
||||
if (Parts != NULL)
|
||||
{
|
||||
for(int i=0; i<NumParts;i++)
|
||||
{
|
||||
if (Parts[i].textureOwned && Parts[i].Texture != NULL) delete Parts[i].Texture;
|
||||
if (Parts[i].Translation != NULL) delete Parts[i].Translation;
|
||||
}
|
||||
delete[] Parts;
|
||||
Parts = NULL;
|
||||
}
|
||||
|
@ -286,7 +291,7 @@ const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spa
|
|||
BYTE * GetBlendMap(PalEntry blend, BYTE *blendwork)
|
||||
{
|
||||
|
||||
switch (blend)
|
||||
switch (blend.a==0 ? blend.r : -1)
|
||||
{
|
||||
case BLEND_INVERSEMAP:
|
||||
return InverseColormap;
|
||||
|
@ -304,7 +309,7 @@ BYTE * GetBlendMap(PalEntry blend, BYTE *blendwork)
|
|||
return TranslationToTable(TRANSLATION(TRANSLATION_Standard, 7))->Remap;
|
||||
|
||||
default:
|
||||
if (blend >= BLEND_DESATURATE1 && blend <= BLEND_DESATURATE31)
|
||||
if (blend.r >= BLEND_DESATURATE1 && blend.r <= BLEND_DESATURATE31)
|
||||
{
|
||||
return DesaturateColormap[blend - BLEND_DESATURATE1];
|
||||
}
|
||||
|
@ -376,16 +381,18 @@ void FMultiPatchTexture::MakeTexture ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
int retv = -1;
|
||||
FCopyInfo info;
|
||||
|
||||
for(int i=0;i<NumParts;i++)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!Parts[i].Texture->bComplex)
|
||||
if (!Parts[i].Texture->bComplex || inf == NULL)
|
||||
{
|
||||
memset (&info, 0, sizeof (info));
|
||||
if (Parts[i].Translation != NULL)
|
||||
{
|
||||
// Using a translation forces downconversion to the base palette
|
||||
|
@ -393,17 +400,49 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rota
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Parts[i].Blend != BLEND_NONE)
|
||||
PalEntry b = Parts[i].Blend;
|
||||
if (b.a == 0 && b.r != BLEND_NONE)
|
||||
{
|
||||
info.blend = EBlend(b.r);
|
||||
inf = &info;
|
||||
}
|
||||
ret = Parts[i].Texture->CopyTrueColorPixels(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate);
|
||||
else if (b.a != 0)
|
||||
{
|
||||
if (b.a == 255)
|
||||
{
|
||||
info.blendcolor[0] = b.r * FRACUNIT / 255;
|
||||
info.blendcolor[1] = b.g * FRACUNIT / 255;
|
||||
info.blendcolor[2] = b.b * FRACUNIT / 255;
|
||||
info.blend = BLEND_MODULATE;
|
||||
inf = &info;
|
||||
}
|
||||
else
|
||||
{
|
||||
info.blendcolor[3] = b.a * FRACUNIT / 255;
|
||||
info.blendcolor[0] = b.r * (FRACUNIT-info.blendcolor[3]);
|
||||
info.blendcolor[1] = b.g * (FRACUNIT-info.blendcolor[3]);
|
||||
info.blendcolor[2] = b.b * (FRACUNIT-info.blendcolor[3]);
|
||||
|
||||
info.blend = BLEND_OVERLAY;
|
||||
inf = &info;
|
||||
}
|
||||
}
|
||||
ret = Parts[i].Texture->CopyTrueColorPixels(bmp, x+Parts[i].OriginX, y+Parts[i].OriginY, Parts[i].Rotate, inf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the patch is a texture with some kind of processing involved
|
||||
// and being drawn with additional processing
|
||||
// the copying must be done in 2 steps: First create a complete image of the patch
|
||||
// including all processing and then copy from that intermediate image to the destination
|
||||
FBitmap bmp1;
|
||||
if (bmp1.Create(Parts[i].Texture->GetWidth(), Parts[i].Texture->GetHeight()))
|
||||
{
|
||||
Parts[i].Texture->CopyTrueColorPixels(&bmp1, 0, 0);
|
||||
bmp->CopyPixelDataRGB(x+Parts[i].OriginX, y+Parts[i].OriginY, bmp1.GetPixels(),
|
||||
bmp1.GetWidth(), bmp1.GetHeight(), 4, bmp1.GetPitch()*4, Parts[i].Rotate, CF_BGRA, inf);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret > retv) retv = ret;
|
||||
|
@ -589,19 +628,6 @@ FMultiPatchTexture::TexPart::TexPart()
|
|||
Blend = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: TexPart :: TexPart
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FMultiPatchTexture::TexPart::~TexPart()
|
||||
{
|
||||
if (textureOwned && Texture != NULL) delete Texture;
|
||||
Texture = NULL;
|
||||
if (Translation != NULL) delete Translation;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: AddTexturesLump
|
||||
|
@ -799,10 +825,20 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
|||
part.Texture = FTexture::CreateTexture(lumpnum, TEX_WallPatch);
|
||||
part.textureOwned = true;
|
||||
}
|
||||
else if (strlen(sc.String) <= 8 && !strpbrk(sc.String, "./"))
|
||||
{
|
||||
int lumpnum = Wads.CheckNumForName(sc.String, ns_patches);
|
||||
if (lumpnum >= 0)
|
||||
{
|
||||
part.Texture = FTexture::CreateTexture(lumpnum, TEX_WallPatch);
|
||||
TexMan.AddTexture(part.Texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
part.Texture = TexMan[texno];
|
||||
bComplex |= part.Texture->bComplex;
|
||||
}
|
||||
if (part.Texture == NULL)
|
||||
{
|
||||
|
@ -844,6 +880,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
|||
part.Translation = NULL;
|
||||
part.Blend = 0;
|
||||
static const char *maps[] = { "inverse", "gold", "red", "green", "ice", "desaturate", NULL };
|
||||
sc.MustGetString();
|
||||
int match = sc.MatchString(maps);
|
||||
if (match >= 0)
|
||||
{
|
||||
|
@ -857,6 +894,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
|||
}
|
||||
else
|
||||
{
|
||||
sc.UnGet();
|
||||
part.Translation = new FRemapTable;
|
||||
part.Translation->MakeIdentity();
|
||||
do
|
||||
|
@ -916,6 +954,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
|||
|
||||
if (!sc.CheckNumber())
|
||||
{
|
||||
sc.MustGetString();
|
||||
part.Blend = V_GetColor(NULL, sc.String);
|
||||
}
|
||||
else
|
||||
|
@ -1003,7 +1042,9 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
|
|||
{
|
||||
TexPart part;
|
||||
ParsePatch(sc, part);
|
||||
parts.Push(part);
|
||||
if (part.Texture != NULL) parts.Push(part);
|
||||
part.Texture = NULL;
|
||||
part.Translation = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ void FPCXTexture::MakeTexture()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
PalEntry pe[256];
|
||||
PCXHeader header;
|
||||
|
@ -473,13 +473,13 @@ int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
|||
lump.Seek(sizeof(header), SEEK_SET);
|
||||
ReadPCX8bits (Pixels, lump, &header);
|
||||
}
|
||||
bmp->CopyPixelData(x, y, Pixels, Width, Height, 1, Width, rotate, pe);
|
||||
bmp->CopyPixelData(x, y, Pixels, Width, Height, 1, Width, rotate, pe, inf);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pixels = new BYTE[Width*Height * 3];
|
||||
ReadPCX24bits (Pixels, lump, &header, 3);
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 3, Width*3, rotate, CF_RGB);
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 3, Width*3, rotate, CF_RGB, inf);
|
||||
}
|
||||
delete [] Pixels;
|
||||
return 0;
|
||||
|
|
|
@ -491,7 +491,7 @@ void FPNGTexture::MakeTexture ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
// Parse pre-IDAT chunks. I skip the CRCs. Is that bad?
|
||||
PalEntry pe[256];
|
||||
|
@ -555,20 +555,20 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
|||
{
|
||||
case 0:
|
||||
case 3:
|
||||
bmp->CopyPixelData(x, y, Pixels, Width, Height, 1, Width, rotate, pe);
|
||||
bmp->CopyPixelData(x, y, Pixels, Width, Height, 1, Width, rotate, pe, inf);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 3, pixwidth, rotate, CF_RGB);
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 3, pixwidth, rotate, CF_RGB, inf);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 2, pixwidth, rotate, CF_IA);
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 2, pixwidth, rotate, CF_IA, inf);
|
||||
transpal = -1;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 4, pixwidth, rotate, CF_RGBA);
|
||||
bmp->CopyPixelDataRGB(x, y, Pixels, Width, Height, 4, pixwidth, rotate, CF_RGBA, inf);
|
||||
transpal = -1;
|
||||
break;
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt)
|
|||
|
||||
case TEX_RGB:
|
||||
{
|
||||
FBitmap bmp(buff, pitch, pitch, height);
|
||||
FBitmap bmp(buff, pitch, pitch/4, height);
|
||||
CopyTrueColorPixels(&bmp, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
@ -480,11 +480,11 @@ void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int FTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
PalEntry *palette = screen->GetPalette();
|
||||
palette[0].a=255; // temporarily modify the first color's alpha
|
||||
bmp->CopyPixelData(x, y, GetPixels(), Width, Height, Height, 1, rotate, palette);
|
||||
bmp->CopyPixelData(x, y, GetPixels(), Width, Height, Height, 1, rotate, palette, inf);
|
||||
|
||||
palette[0].a=0;
|
||||
return 0;
|
||||
|
|
|
@ -385,7 +385,7 @@ void FTGATexture::MakeTexture ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
||||
int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
|
||||
{
|
||||
PalEntry pe[256];
|
||||
FWadLump lump = Wads.OpenLumpNum (SourceLump);
|
||||
|
@ -470,7 +470,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
|||
switch (hdr.img_type & 7)
|
||||
{
|
||||
case 1: // paletted
|
||||
bmp->CopyPixelData(x, y, ptr, Width, Height, step_x, Pitch, rotate, pe);
|
||||
bmp->CopyPixelData(x, y, ptr, Width, Height, step_x, Pitch, rotate, pe, inf);
|
||||
break;
|
||||
|
||||
case 2: // RGB
|
||||
|
@ -478,21 +478,21 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
|||
{
|
||||
case 15:
|
||||
case 16:
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_RGB555);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_RGB555, inf);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGR);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGR, inf);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
if ((hdr.img_desc&15)!=8) // 32 bits without a valid alpha channel
|
||||
{
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGR);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGR, inf);
|
||||
}
|
||||
else
|
||||
{
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGRA);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_BGRA, inf);
|
||||
transval = -1;
|
||||
}
|
||||
break;
|
||||
|
@ -507,11 +507,11 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate)
|
|||
{
|
||||
case 8:
|
||||
for(int i=0;i<256;i++) pe[i]=PalEntry(0,i,i,i); // gray map
|
||||
bmp->CopyPixelData(x, y, ptr, Width, Height, step_x, Pitch, rotate, pe);
|
||||
bmp->CopyPixelData(x, y, ptr, Width, Height, step_x, Pitch, rotate, pe, inf);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_I16);
|
||||
bmp->CopyPixelDataRGB(x, y, ptr, Width, Height, step_x, Pitch, rotate, CF_I16, inf);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue