mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- narrowing down the public interface of the texture class
Cannot refactor if the entire class is this wide open to everything. Not complete yet, doesn't fully compile!
This commit is contained in:
parent
e83af15907
commit
6eab4a882c
74 changed files with 608 additions and 518 deletions
|
@ -1198,8 +1198,8 @@ static void AM_ScrollParchment (double dmapx, double dmapy)
|
|||
|
||||
if (backtex != NULL)
|
||||
{
|
||||
int pwidth = backtex->GetWidth();
|
||||
int pheight = backtex->GetHeight();
|
||||
int pwidth = backtex->GetDisplayWidth();
|
||||
int pheight = backtex->GetDisplayHeight();
|
||||
|
||||
while(mapxstart > 0)
|
||||
mapxstart -= pwidth;
|
||||
|
@ -1692,8 +1692,8 @@ void AM_clearFB (const AMColor &color)
|
|||
FTexture *backtex = TexMan[mapback];
|
||||
if (backtex != NULL)
|
||||
{
|
||||
int pwidth = backtex->GetWidth();
|
||||
int pheight = backtex->GetHeight();
|
||||
int pwidth = backtex->GetDisplayWidth();
|
||||
int pheight = backtex->GetDisplayHeight();
|
||||
int x, y;
|
||||
|
||||
//blit the automap background to the screen.
|
||||
|
@ -2212,8 +2212,7 @@ void AM_drawSubsectors()
|
|||
}
|
||||
|
||||
// Draw the polygon.
|
||||
FTexture *pic = TexMan(maptex);
|
||||
if (pic != nullptr && pic->UseType != ETextureType::Null)
|
||||
if (maptex.isValid())
|
||||
{
|
||||
// Hole filling "subsectors" are not necessarily convex so they require real triangulation.
|
||||
// These things are extremely rare so performance is secondary here.
|
||||
|
@ -3116,7 +3115,7 @@ void AM_drawThings ()
|
|||
static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
|
||||
INTBOOL flip, double xscale, double yscale, int translation, double alpha, uint32_t fillcolor, FRenderStyle renderstyle)
|
||||
{
|
||||
if (tex == NULL || tex->UseType == ETextureType::Null)
|
||||
if (tex == NULL || !tex->isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -3125,8 +3124,8 @@ static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
|
|||
AM_rotatePoint (&x, &y);
|
||||
}
|
||||
screen->DrawTexture (tex, CXMTOF(x) + f_x, CYMTOF(y) + yadjust + f_y,
|
||||
DTA_DestWidthF, tex->GetScaledWidthDouble() * CleanXfac * xscale,
|
||||
DTA_DestHeightF, tex->GetScaledHeightDouble() * CleanYfac * yscale,
|
||||
DTA_DestWidthF, tex->GetDisplayWidthDouble() * CleanXfac * xscale,
|
||||
DTA_DestHeightF, tex->GetDisplayHeightDouble() * CleanYfac * yscale,
|
||||
DTA_ClipTop, f_y,
|
||||
DTA_ClipBottom, f_y + f_h,
|
||||
DTA_ClipLeft, f_x,
|
||||
|
@ -3185,9 +3184,9 @@ void AM_drawAuthorMarkers ()
|
|||
if (mark->picnum.isValid())
|
||||
{
|
||||
tex = TexMan(mark->picnum);
|
||||
if (tex->Rotations != 0xFFFF)
|
||||
if (tex->GetRotations() != 0xFFFF)
|
||||
{
|
||||
spriteframe_t *sprframe = &SpriteFrames[tex->Rotations];
|
||||
spriteframe_t *sprframe = &SpriteFrames[tex->GetRotations()];
|
||||
picnum = sprframe->Texture[0];
|
||||
flip = sprframe->Flip & 1;
|
||||
tex = TexMan[picnum];
|
||||
|
|
|
@ -835,15 +835,15 @@ void D_Display ()
|
|||
FString pstring = "By ";
|
||||
|
||||
tex = TexMan(gameinfo.PauseSign);
|
||||
x = (SCREENWIDTH - tex->GetScaledWidth() * CleanXfac)/2 +
|
||||
tex->GetScaledLeftOffset(0) * CleanXfac;
|
||||
x = (SCREENWIDTH - tex->GetDisplayWidth() * CleanXfac)/2 +
|
||||
tex->GetDisplayLeftOffset() * CleanXfac;
|
||||
screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
|
||||
if (paused && multiplayer)
|
||||
{
|
||||
pstring += players[paused - 1].userinfo.GetName();
|
||||
screen->DrawText(SmallFont, CR_RED,
|
||||
(screen->GetWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2,
|
||||
(tex->GetScaledHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
|
||||
(tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -856,7 +856,7 @@ void D_Display ()
|
|||
if (picnum.isValid())
|
||||
{
|
||||
FTexture *tex = TexMan[picnum];
|
||||
screen->DrawTexture (tex, 160 - tex->GetScaledWidth()/2, 100 - tex->GetScaledHeight()/2,
|
||||
screen->DrawTexture (tex, 160 - tex->GetDisplayWidth()/2, 100 - tex->GetDisplayHeight()/2,
|
||||
DTA_320x200, true, TAG_DONE);
|
||||
}
|
||||
NoWipe = 10;
|
||||
|
|
|
@ -304,8 +304,8 @@ bool Wiper_Melt::Run(int ticks)
|
|||
// Only draw for the final tick.
|
||||
// No need for optimization. Wipes won't ever be drawn with anything else.
|
||||
|
||||
int w = startScreen->GetWidth();
|
||||
int h = startScreen->GetHeight();
|
||||
int w = startScreen->GetDisplayWidth();
|
||||
int h = startScreen->GetDisplayHeight();
|
||||
dpt.x = i * w / WIDTH;
|
||||
dpt.y = MAX(0, y[i] * h / HEIGHT);
|
||||
rect.left = dpt.x;
|
||||
|
|
|
@ -1904,7 +1904,7 @@ void FParser::SF_FloorTexture(void)
|
|||
|
||||
t_return.type = svt_string;
|
||||
FTexture * tex = TexMan[sector->GetTexture(sector_t::floor)];
|
||||
t_return.string = tex? tex->Name : "";
|
||||
t_return.string = tex? tex->GetName() : "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1994,7 +1994,7 @@ void FParser::SF_CeilingTexture(void)
|
|||
|
||||
t_return.type = svt_string;
|
||||
FTexture * tex = TexMan[sector->GetTexture(sector_t::ceiling)];
|
||||
t_return.string = tex? tex->Name : "";
|
||||
t_return.string = tex? tex->GetName() : "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *
|
|||
|
||||
FTexture *texture = TexMan[tex];
|
||||
|
||||
if (texture == NULL || texture->bNoDecals)
|
||||
if (texture == NULL || texture->allowNoDecals())
|
||||
{
|
||||
return FNullTextureID();
|
||||
}
|
||||
|
@ -497,10 +497,10 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, doub
|
|||
return;
|
||||
}
|
||||
|
||||
int dwidth = tex->GetWidth ();
|
||||
int dwidth = tex->GetDisplayWidth ();
|
||||
|
||||
DecalWidth = dwidth * ScaleX;
|
||||
DecalLeft = tex->GetLeftOffset(0) * ScaleX;
|
||||
DecalLeft = tex->GetDisplayLeftOffset() * ScaleX;
|
||||
DecalRight = DecalWidth - DecalLeft;
|
||||
SpreadSource = this;
|
||||
SpreadTemplate = tpl;
|
||||
|
|
|
@ -937,7 +937,7 @@ CCMD(listlights)
|
|||
if (dl->target)
|
||||
{
|
||||
FTextureID spr = sprites[dl->target->sprite].GetSpriteFrame(dl->target->frame, 0, 0., nullptr);
|
||||
Printf(", frame = %s ", TexMan[spr]->Name.GetChars());
|
||||
Printf(", frame = %s ", TexMan[spr]->GetName().GetChars());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1188,12 +1188,12 @@ public:
|
|||
|
||||
if((offsetflags & SBarInfoCommand::CENTER) == SBarInfoCommand::CENTER)
|
||||
{
|
||||
if (forceWidth < 0) dx -= (texture->GetScaledWidthDouble()/2.0)-texture->GetScaledLeftOffsetDouble(0);
|
||||
else dx -= forceWidth*(0.5-(texture->GetScaledLeftOffsetDouble(0)/texture->GetScaledWidthDouble()));
|
||||
//Unoptimalized ^^formula is dx -= forceWidth/2.0-(texture->GetScaledLeftOffsetDouble()*forceWidth/texture->GetScaledWidthDouble());
|
||||
if (forceWidth < 0) dx -= (texture->GetDisplayWidthDouble()/2.0)-texture->GetDisplayLeftOffsetDouble();
|
||||
else dx -= forceWidth*(0.5-(texture->GetDisplayLeftOffsetDouble()/texture->GetDisplayWidthDouble()));
|
||||
//Unoptimalized ^^formula is dx -= forceWidth/2.0-(texture->GetScaledLeftOffsetDouble()*forceWidth/texture->GetDisplayWidthDouble());
|
||||
|
||||
if (forceHeight < 0) dy -= (texture->GetScaledHeightDouble()/2.0)-texture->GetScaledTopOffsetDouble(0);
|
||||
else dy -= forceHeight*(0.5-(texture->GetScaledTopOffsetDouble(0)/texture->GetScaledHeightDouble()));
|
||||
if (forceHeight < 0) dy -= (texture->GetDisplayHeightDouble()/2.0)-texture->GetDisplayTopOffsetDouble();
|
||||
else dy -= forceHeight*(0.5-(texture->GetDisplayTopOffsetDouble()/texture->GetDisplayHeightDouble()));
|
||||
}
|
||||
|
||||
dx += xOffset;
|
||||
|
@ -1202,12 +1202,12 @@ public:
|
|||
if(!fullScreenOffsets)
|
||||
{
|
||||
double tmp = 0;
|
||||
w = forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth;
|
||||
h = forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight;
|
||||
double dcx = clip[0] == 0 ? 0 : dx + clip[0] - texture->GetScaledLeftOffsetDouble(0);
|
||||
double dcy = clip[1] == 0 ? 0 : dy + clip[1] - texture->GetScaledTopOffsetDouble(0);
|
||||
double dcr = clip[2] == 0 ? INT_MAX : dx + w - clip[2] - texture->GetScaledLeftOffsetDouble(0);
|
||||
double dcb = clip[3] == 0 ? INT_MAX : dy + h - clip[3] - texture->GetScaledTopOffsetDouble(0);
|
||||
w = forceWidth < 0 ? texture->GetDisplayWidthDouble() : forceWidth;
|
||||
h = forceHeight < 0 ? texture->GetDisplayHeightDouble() : forceHeight;
|
||||
double dcx = clip[0] == 0 ? 0 : dx + clip[0] - texture->GetDisplayLeftOffsetDouble();
|
||||
double dcy = clip[1] == 0 ? 0 : dy + clip[1] - texture->GetDisplayTopOffsetDouble();
|
||||
double dcr = clip[2] == 0 ? INT_MAX : dx + w - clip[2] - texture->GetDisplayLeftOffsetDouble();
|
||||
double dcb = clip[3] == 0 ? INT_MAX : dy + h - clip[3] - texture->GetDisplayTopOffsetDouble();
|
||||
|
||||
if(clip[0] != 0 || clip[1] != 0)
|
||||
{
|
||||
|
@ -1271,8 +1271,8 @@ public:
|
|||
bool xright = *x < 0 && !x.RelCenter();
|
||||
bool ybot = *y < 0 && !y.RelCenter();
|
||||
|
||||
w = (forceWidth < 0 ? texture->GetScaledWidthDouble() : forceWidth);
|
||||
h = (forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight);
|
||||
w = (forceWidth < 0 ? texture->GetDisplayWidthDouble() : forceWidth);
|
||||
h = (forceHeight < 0 ? texture->GetDisplayHeightDouble() : forceHeight);
|
||||
if(vid_fps && rx < 0 && ry >= 0)
|
||||
ry += 10;
|
||||
|
||||
|
@ -1289,10 +1289,10 @@ public:
|
|||
// Check for clipping
|
||||
if(clip[0] != 0 || clip[1] != 0 || clip[2] != 0 || clip[3] != 0)
|
||||
{
|
||||
rcx = clip[0] == 0 ? 0 : rx+((clip[0] - texture->GetScaledLeftOffsetDouble(0))*Scale.X);
|
||||
rcy = clip[1] == 0 ? 0 : ry+((clip[1] - texture->GetScaledTopOffsetDouble(0))*Scale.Y);
|
||||
rcr = clip[2] == 0 ? INT_MAX : rx+w-((clip[2] + texture->GetScaledLeftOffsetDouble(0))*Scale.X);
|
||||
rcb = clip[3] == 0 ? INT_MAX : ry+h-((clip[3] + texture->GetScaledTopOffsetDouble(0))*Scale.Y);
|
||||
rcx = clip[0] == 0 ? 0 : rx+((clip[0] - texture->GetDisplayLeftOffsetDouble())*Scale.X);
|
||||
rcy = clip[1] == 0 ? 0 : ry+((clip[1] - texture->GetDisplayTopOffsetDouble())*Scale.Y);
|
||||
rcr = clip[2] == 0 ? INT_MAX : rx+w-((clip[2] + texture->GetDisplayLeftOffsetDouble())*Scale.X);
|
||||
rcb = clip[3] == 0 ? INT_MAX : ry+h-((clip[3] + texture->GetDisplayTopOffsetDouble())*Scale.Y);
|
||||
}
|
||||
|
||||
if(clearDontDraw)
|
||||
|
@ -1389,13 +1389,13 @@ public:
|
|||
int character = (unsigned char)*str;
|
||||
|
||||
if (script->spacingCharacter == '\0') //If we are monospaced lets use the offset
|
||||
ax += (c->GetLeftOffset(0) + 1); //ignore x offsets since we adapt to character size
|
||||
ax += (c->GetDisplayLeftOffset() + 1); //ignore x offsets since we adapt to character size
|
||||
|
||||
double rx, ry, rw, rh;
|
||||
rx = ax + xOffset;
|
||||
ry = ay + yOffset;
|
||||
rw = c->GetScaledWidthDouble();
|
||||
rh = c->GetScaledHeightDouble();
|
||||
rw = c->GetDisplayWidthDouble();
|
||||
rh = c->GetDisplayHeightDouble();
|
||||
|
||||
if(script->spacingCharacter != '\0')
|
||||
{
|
||||
|
@ -1453,7 +1453,7 @@ public:
|
|||
DTA_Alpha, Alpha,
|
||||
TAG_DONE);
|
||||
if (script->spacingCharacter == '\0')
|
||||
ax += width + spacing - (c->GetLeftOffset(0) + 1);
|
||||
ax += width + spacing - (c->GetDisplayLeftOffsetDouble() + 1);
|
||||
else //width gets changed at the call to GetChar()
|
||||
ax += font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing;
|
||||
str++;
|
||||
|
|
|
@ -69,8 +69,8 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
|
|||
{
|
||||
double scale1, scale2;
|
||||
scale1 = scale2 = 1.0f;
|
||||
double texwidth = (int) (texture->GetScaledWidthDouble()*spawnScaleX);
|
||||
double texheight = (int) (texture->GetScaledHeightDouble()*spawnScaleY);
|
||||
double texwidth = (int) (texture->GetDisplayWidthDouble()*spawnScaleX);
|
||||
double texheight = (int) (texture->GetDisplayHeightDouble()*spawnScaleY);
|
||||
|
||||
if (w != -1 && (w<texwidth || (flags & DI_FORCESCALE)))
|
||||
{
|
||||
|
@ -93,8 +93,8 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
|
|||
}
|
||||
else if (applyscale)
|
||||
{
|
||||
w=(int) (texture->GetScaledWidthDouble()*spawnScaleX);
|
||||
h=(int) (texture->GetScaledHeightDouble()*spawnScaleY);
|
||||
w=(int) (texture->GetDisplayWidthDouble()*spawnScaleX);
|
||||
h=(int) (texture->GetDisplayHeightDouble()*spawnScaleY);
|
||||
}
|
||||
statusBar->DrawGraphic(texture, imgx, imgy, block->XOffset(), block->YOffset(), frameAlpha, block->FullScreenOffsets(),
|
||||
translatable, false, offset, false, w, h);
|
||||
|
@ -300,7 +300,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
|
|||
|
||||
if (flags & DI_ALTERNATEONFAIL)
|
||||
{
|
||||
SetTruth(texture == NULL || texture->UseType == ETextureType::Null, block, statusBar);
|
||||
SetTruth(texture == NULL || !texture->isValid(), block, statusBar);
|
||||
}
|
||||
}
|
||||
protected:
|
||||
|
@ -2266,11 +2266,11 @@ class CommandDrawInventoryBar : public SBarInfoCommand
|
|||
int spacing;
|
||||
if (!vertical)
|
||||
{
|
||||
spacing = box->GetScaledWidth();
|
||||
spacing = box->GetDisplayWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
spacing = box->GetScaledHeight();
|
||||
spacing = box->GetDisplayHeight();
|
||||
}
|
||||
return spacing + ((style != STYLE_Strife) ? 1 : -1);
|
||||
}
|
||||
|
@ -2370,21 +2370,21 @@ class CommandDrawKeyBar : public SBarInfoCommand
|
|||
if(!vertical)
|
||||
{
|
||||
statusBar->DrawGraphic(TexMan(item->TextureIDVar(NAME_Icon)), x+slotOffset, y+rowOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||
rowWidth = rowIconSize == -1 ? TexMan(item->TextureIDVar(NAME_Icon))->GetScaledHeight()+2 : rowIconSize;
|
||||
rowWidth = rowIconSize == -1 ? TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayHeight()+2 : rowIconSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
statusBar->DrawGraphic(TexMan(item->TextureIDVar(NAME_Icon)), x+rowOffset, y+slotOffset, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||
rowWidth = rowIconSize == -1 ? TexMan(item->TextureIDVar(NAME_Icon))->GetScaledWidth()+2 : rowIconSize;
|
||||
rowWidth = rowIconSize == -1 ? TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayWidth()+2 : rowIconSize;
|
||||
}
|
||||
|
||||
// If cmd.special is -1 then the slot size is auto detected
|
||||
if(iconSize == -1)
|
||||
{
|
||||
if(!vertical)
|
||||
slotOffset += (reverse ? -1 : 1) * (TexMan(item->TextureIDVar(NAME_Icon))->GetScaledWidth() + 2);
|
||||
slotOffset += (reverse ? -1 : 1) * (TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayWidth() + 2);
|
||||
else
|
||||
slotOffset += (reverse ? -1 : 1) * (TexMan(item->TextureIDVar(NAME_Icon))->GetScaledHeight() + 2);
|
||||
slotOffset += (reverse ? -1 : 1) * (TexMan(item->TextureIDVar(NAME_Icon))->GetDisplayHeight() + 2);
|
||||
}
|
||||
else
|
||||
slotOffset += (reverse ? -iconSize : iconSize);
|
||||
|
@ -2504,7 +2504,7 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
else
|
||||
{
|
||||
// Draw background
|
||||
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
|
||||
if (bg != NULL && bg->GetDisplayWidth() == fg->GetDisplayWidth() && bg->GetDisplayHeight() == fg->GetDisplayHeight())
|
||||
statusBar->DrawGraphic(bg, this->x, this->y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||
else
|
||||
statusBar->DrawGraphic(fg, this->x, this->y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, false, 0, false, -1, -1, nulclip, true);
|
||||
|
@ -2513,7 +2513,7 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
// {cx, cy, cr, cb}
|
||||
double Clip[4] = {0, 0, 0, 0};
|
||||
|
||||
int sizeOfImage = (horizontal ? fg->GetScaledWidth()-border*2 : fg->GetScaledHeight()-border*2);
|
||||
int sizeOfImage = (horizontal ? fg->GetDisplayWidth()-border*2 : fg->GetDisplayHeight()-border*2);
|
||||
Clip[(!horizontal)|((horizontal ? !reverse : reverse)<<1)] = sizeOfImage - sizeOfImage *value;
|
||||
// Draw background
|
||||
if(border != 0)
|
||||
|
@ -2521,7 +2521,7 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
for(unsigned int i = 0;i < 4;i++)
|
||||
Clip[i] += border;
|
||||
|
||||
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
|
||||
if (bg != NULL && bg->GetDisplayWidth() == fg->GetDisplayWidth() && bg->GetDisplayHeight() == fg->GetDisplayHeight())
|
||||
statusBar->DrawGraphic(bg, this->x, this->y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, false, 0, false, -1, -1, Clip);
|
||||
else
|
||||
statusBar->DrawGraphic(fg, this->x, this->y, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets(), false, false, 0, false, -1, -1, Clip, true);
|
||||
|
@ -2802,7 +2802,7 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
// [BL] Since we used a percentage (in order to get the most fluid animation)
|
||||
// we need to establish a cut off point so the last pixel won't hang as the animation slows
|
||||
if(pixel == -1 && statusBar->Images[foreground])
|
||||
pixel = MAX(1 / 65536., 1./statusBar->Images[foreground]->GetWidth());
|
||||
pixel = MAX(1 / 65536., 1./statusBar->Images[foreground]->GetDisplayWidth());
|
||||
|
||||
if(fabs(drawValue - value) < pixel)
|
||||
drawValue = value;
|
||||
|
@ -3115,7 +3115,7 @@ class CommandDrawGem : public SBarInfoCommand
|
|||
SBarInfoCoordinate drawY = y;
|
||||
if(wiggle && drawValue != goalValue) // Should only wiggle when the value doesn't equal what is being drawn.
|
||||
drawY += chainWiggle;
|
||||
int chainWidth = chainImg->GetScaledWidth();
|
||||
int chainWidth = chainImg->GetDisplayWidth();
|
||||
int offset = (int) (((double) (chainWidth-leftPadding-rightPadding)/100)*drawValue);
|
||||
statusBar->DrawGraphic(chainImg, x+(offset%chainSize), drawY, block->XOffset(), block->YOffset(), block->Alpha(), block->FullScreenOffsets());
|
||||
if(gemImg != NULL)
|
||||
|
|
|
@ -820,8 +820,8 @@ void DBaseStatusBar::RefreshBackground () const
|
|||
FTexture *p = TexMan[gameinfo.Border.b];
|
||||
if (p != NULL)
|
||||
{
|
||||
screen->FlatFill(0, y, x, y + p->GetHeight(), p, true);
|
||||
screen->FlatFill(x2, y, SCREENWIDTH, y + p->GetHeight(), p, true);
|
||||
screen->FlatFill(0, y, x, y + p->GetDisplayHeight(), p, true);
|
||||
screen->FlatFill(x2, y, SCREENWIDTH, y + p->GetDisplayHeight(), p, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -864,8 +864,8 @@ void DBaseStatusBar::DrawCrosshair ()
|
|||
{
|
||||
size *= CrosshairSize;
|
||||
}
|
||||
w = int(CrosshairImage->GetWidth() * size);
|
||||
h = int(CrosshairImage->GetHeight() * size);
|
||||
w = int(CrosshairImage->GetDisplayWidth() * size);
|
||||
h = int(CrosshairImage->GetDisplayHeight() * size);
|
||||
|
||||
if (crosshairhealth)
|
||||
{
|
||||
|
@ -1325,8 +1325,8 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
|
|||
|
||||
FTexture *tex = (flags & DI_DONTANIMATE)? TexMan[texture] : TexMan(texture);
|
||||
|
||||
double texwidth = tex->GetScaledWidthDouble() * scaleX;
|
||||
double texheight = tex->GetScaledHeightDouble() * scaleY;
|
||||
double texwidth = tex->GetDisplayWidthDouble() * scaleX;
|
||||
double texheight = tex->GetDisplayHeightDouble() * scaleY;
|
||||
|
||||
if (boxwidth > 0 || boxheight > 0)
|
||||
{
|
||||
|
@ -1378,14 +1378,14 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
|
|||
{
|
||||
case DI_ITEM_HCENTER: x -= boxwidth / 2; break;
|
||||
case DI_ITEM_RIGHT: x -= boxwidth; break;
|
||||
case DI_ITEM_HOFFSET: x -= tex->GetScaledLeftOffsetDouble(0) * boxwidth / texwidth; break;
|
||||
case DI_ITEM_HOFFSET: x -= tex->GetDisplayLeftOffsetDouble() * boxwidth / texwidth; break;
|
||||
}
|
||||
|
||||
switch (flags & DI_ITEM_VMASK)
|
||||
{
|
||||
case DI_ITEM_VCENTER: y -= boxheight / 2; break;
|
||||
case DI_ITEM_BOTTOM: y -= boxheight; break;
|
||||
case DI_ITEM_VOFFSET: y -= tex->GetScaledTopOffsetDouble(0) * boxheight / texheight; break;
|
||||
case DI_ITEM_VOFFSET: y -= tex->GetDisplayTopOffsetDouble() * boxheight / texheight; break;
|
||||
}
|
||||
|
||||
if (!fullscreenOffsets)
|
||||
|
@ -1520,13 +1520,13 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
|
|||
}
|
||||
|
||||
if (!monospaced) //If we are monospaced lets use the offset
|
||||
x += (c->GetLeftOffset(0) + 1); //ignore x offsets since we adapt to character size
|
||||
x += (c->GetDisplayLeftOffsetDouble() + 1); //ignore x offsets since we adapt to character size
|
||||
|
||||
double rx, ry, rw, rh;
|
||||
rx = x + drawOffset.X;
|
||||
ry = y + drawOffset.Y;
|
||||
rw = c->GetScaledWidthDouble();
|
||||
rh = c->GetScaledHeightDouble();
|
||||
rw = c->GetDisplayWidthDouble();
|
||||
rh = c->GetDisplayHeightDouble();
|
||||
|
||||
if (!fullscreenOffsets)
|
||||
{
|
||||
|
@ -1560,7 +1560,7 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
|
|||
TAG_DONE);
|
||||
|
||||
if (!monospaced)
|
||||
x += width + spacing - (c->GetLeftOffset(0) + 1);
|
||||
x += width + spacing - (c->GetDisplayLeftOffsetDouble() + 1);
|
||||
else
|
||||
x += spacing;
|
||||
}
|
||||
|
|
|
@ -303,7 +303,8 @@ void FGLRenderState::Apply()
|
|||
|
||||
void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translation, int overrideshader)
|
||||
{
|
||||
if (mat->tex->bHasCanvas)
|
||||
#if 0
|
||||
if (mat->tex->isHardwareCanvas())
|
||||
{
|
||||
mTempTM = TM_OPAQUE;
|
||||
}
|
||||
|
@ -317,8 +318,8 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
|||
|
||||
auto tex = mat->tex;
|
||||
if (tex->UseType == ETextureType::SWCanvas) clampmode = CLAMP_NOFILTER;
|
||||
if (tex->bHasCanvas) clampmode = CLAMP_CAMTEX;
|
||||
else if ((tex->bWarped || tex->shaderindex >= FIRST_USER_SHADER) && clampmode <= CLAMP_XY) clampmode = CLAMP_NONE;
|
||||
if (tex->sHardwareCanvas()) clampmode = CLAMP_CAMTEX;
|
||||
else if ((tex->isWarped() || tex->shaderindex >= FIRST_USER_SHADER) && clampmode <= CLAMP_XY) clampmode = CLAMP_NONE;
|
||||
|
||||
// avoid rebinding the same texture multiple times.
|
||||
if (mat == lastMaterial && lastClamp == clampmode && translation == lastTranslation) return;
|
||||
|
@ -330,7 +331,7 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
|||
int maxbound = 0;
|
||||
|
||||
// Textures that are already scaled in the texture lump will not get replaced by hires textures.
|
||||
int flags = mat->isExpanded() ? CTF_Expand : (gl_texture_usehires && tex->Scale.X == 1 && tex->Scale.Y == 1 && clampmode <= CLAMP_XY) ? CTF_CheckHires : 0;
|
||||
int flags = mat->isExpanded() ? CTF_Expand : (gl_texture_usehires && !tex->isScaled() && clampmode <= CLAMP_XY) ? CTF_CheckHires : 0;
|
||||
int numLayers = mat->GetLayers();
|
||||
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0));
|
||||
|
||||
|
@ -350,6 +351,7 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
|||
FHardwareTexture::Unbind(i);
|
||||
maxBoundMaterial = maxbound;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -595,4 +597,4 @@ bool FGLRenderState::SetDepthClamp(bool on)
|
|||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ void PostProcessShaderInstance::BindTextures()
|
|||
|
||||
FString name = pair->Value;
|
||||
FTexture *tex = TexMan(TexMan.CheckForTexture(name, ETextureType::Any));
|
||||
if (tex && tex->UseType != ETextureType::Null)
|
||||
if (tex && tex->isValid())
|
||||
{
|
||||
glUniform1i(location, textureUnit);
|
||||
|
||||
|
@ -225,16 +225,17 @@ void PostProcessShaderInstance::BindTextures()
|
|||
auto it = mTextureHandles.find(tex);
|
||||
if (it == mTextureHandles.end())
|
||||
{
|
||||
FBitmap bitmap;
|
||||
bitmap.Create(tex->GetWidth(), tex->GetHeight());
|
||||
tex->CopyTrueColorPixels(&bitmap, 0, 0);
|
||||
// Why does this completely circumvent the normal way of handling textures?
|
||||
int width, height;
|
||||
auto buffer = tex->CreateTexBuffer(0, width, height);
|
||||
|
||||
GLuint handle = 0;
|
||||
glGenTextures(1, &handle);
|
||||
glBindTexture(GL_TEXTURE_2D, handle);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex->GetWidth(), tex->GetHeight(), 0, GL_BGRA, GL_UNSIGNED_BYTE, bitmap.GetPixels());
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
delete[] buffer;
|
||||
mTextureHandles[tex] = handle;
|
||||
}
|
||||
else
|
||||
|
@ -247,4 +248,4 @@ void PostProcessShaderInstance::BindTextures()
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -347,16 +347,16 @@ void OpenGLFrameBuffer::SetTextureFilterMode()
|
|||
|
||||
IHardwareTexture *OpenGLFrameBuffer::CreateHardwareTexture(FTexture *tex)
|
||||
{
|
||||
return new FHardwareTexture(tex->bNoCompress);
|
||||
return new FHardwareTexture(true/*tex->bNoCompress*/);
|
||||
}
|
||||
|
||||
void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
||||
{
|
||||
auto tex = mat->tex;
|
||||
if (tex->UseType == ETextureType::SWCanvas) return;
|
||||
if (tex->isSWCanvas()) return;
|
||||
|
||||
// Textures that are already scaled in the texture lump will not get replaced by hires textures.
|
||||
int flags = mat->isExpanded() ? CTF_Expand : (gl_texture_usehires && tex->Scale.X == 1 && tex->Scale.Y == 1) ? CTF_CheckHires : 0;
|
||||
int flags = mat->isExpanded() ? CTF_Expand : (gl_texture_usehires && !tex->isScaled()) ? CTF_CheckHires : 0;
|
||||
int numLayers = mat->GetLayers();
|
||||
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0));
|
||||
|
||||
|
@ -527,9 +527,9 @@ FTexture *OpenGLFrameBuffer::WipeStartScreen()
|
|||
const auto &viewport = screen->mScreenViewport;
|
||||
|
||||
auto tex = new FWrapperTexture(viewport.width, viewport.height, 1);
|
||||
tex->SystemTexture[0]->CreateTexture(nullptr, viewport.width, viewport.height, 0, false, 0, "WipeStartScreen");
|
||||
tex->GetSystemTexture(0)->CreateTexture(nullptr, viewport.width, viewport.height, 0, false, 0, "WipeStartScreen");
|
||||
glFinish();
|
||||
static_cast<FHardwareTexture*>(tex->SystemTexture[0])->Bind(0, false, false);
|
||||
static_cast<FHardwareTexture*>(tex->GetSystemTexture(0))->Bind(0, false, false);
|
||||
|
||||
GLRenderer->mBuffers->BindCurrentFB();
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, viewport.left, viewport.top, viewport.width, viewport.height);
|
||||
|
@ -549,12 +549,12 @@ FTexture *OpenGLFrameBuffer::WipeEndScreen()
|
|||
GLRenderer->Flush();
|
||||
const auto &viewport = screen->mScreenViewport;
|
||||
auto tex = new FWrapperTexture(viewport.width, viewport.height, 1);
|
||||
tex->SystemTexture[0]->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0, "WipeEndScreen");
|
||||
tex->GetSystemTexture(0)->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0, "WipeEndScreen");
|
||||
glFinish();
|
||||
static_cast<FHardwareTexture*>(tex->SystemTexture[0])->Bind(0, false, false);
|
||||
static_cast<FHardwareTexture*>(tex->GetSystemTexture(0))->Bind(0, false, false);
|
||||
GLRenderer->mBuffers->BindCurrentFB();
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, viewport.left, viewport.top, viewport.width, viewport.height);
|
||||
return tex;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -422,6 +422,7 @@ void FHardwareTexture::BindToFrameBuffer(int width, int height)
|
|||
|
||||
bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags)
|
||||
{
|
||||
#if 0
|
||||
int usebright = false;
|
||||
|
||||
if (translation <= 0)
|
||||
|
@ -445,7 +446,7 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i
|
|||
// Create this texture
|
||||
unsigned char * buffer = nullptr;
|
||||
|
||||
if (!tex->bHasCanvas)
|
||||
if (!tex->isHardwareCanvas())
|
||||
{
|
||||
buffer = tex->CreateTexBuffer(translation, w, h, flags | CTF_ProcessData);
|
||||
}
|
||||
|
@ -462,9 +463,10 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i
|
|||
}
|
||||
delete[] buffer;
|
||||
}
|
||||
if (tex->bHasCanvas) static_cast<FCanvasTexture*>(tex)->NeedUpdate();
|
||||
if (tex->isHardwareCanvas()) static_cast<FCanvasTexture*>(tex)->NeedUpdate();
|
||||
GLRenderer->mSamplerManager->Bind(texunit, clampmode, 255);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,14 +210,14 @@ void HU_GetPlayerWidths(int &maxnamewidth, int &maxscorewidth, int &maxiconheigh
|
|||
if (players[i].mo->ScoreIcon.isValid())
|
||||
{
|
||||
FTexture *pic = TexMan[players[i].mo->ScoreIcon];
|
||||
width = pic->GetScaledWidth() - pic->GetScaledLeftOffset(0) + 2;
|
||||
width = pic->GetDisplayWidth() - pic->GetDisplayLeftOffset() + 2;
|
||||
if (width > maxscorewidth)
|
||||
{
|
||||
maxscorewidth = width;
|
||||
}
|
||||
// The icon's top offset does not count toward its height, because
|
||||
// zdoom.pk3's standard Hexen class icons are designed that way.
|
||||
int height = pic->GetScaledHeight() - pic->GetScaledTopOffset(0);
|
||||
int height = pic->GetDisplayHeight() - pic->GetDisplayTopOffset();
|
||||
if (height > maxiconheight)
|
||||
{
|
||||
maxiconheight = height;
|
||||
|
@ -446,7 +446,7 @@ static void HU_DrawPlayer (player_t *player, bool highlight, int col1, int col2,
|
|||
if (teamplay && Teams[player->userinfo.GetTeam()].GetLogo().IsNotEmpty ())
|
||||
{
|
||||
FTexture *pic = TexMan[Teams[player->userinfo.GetTeam()].GetLogo().GetChars ()];
|
||||
screen->DrawTexture (pic, col1 - (pic->GetScaledWidth() + 2) * CleanXfac, y,
|
||||
screen->DrawTexture (pic, col1 - (pic->GetDisplayWidth() + 2) * CleanXfac, y,
|
||||
DTA_CleanNoMove, true, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
|
|||
if (!seg->linedef->isVisualPortal())
|
||||
{
|
||||
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::mid));
|
||||
if (!tex || tex->UseType==ETextureType::Null)
|
||||
if (!tex || !tex->isValid())
|
||||
{
|
||||
// nothing to do here!
|
||||
seg->linedef->validcount=validcount;
|
||||
|
|
|
@ -118,7 +118,7 @@ bool hw_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
|
|||
if (bs_ceilingheight1 <= fs_floorheight1 && bs_ceilingheight2 <= fs_floorheight2)
|
||||
{
|
||||
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
|
||||
if (!tex || tex->UseType == ETextureType::Null) return false;
|
||||
if (!tex || !tex->isValid()) return false;
|
||||
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
|
||||
return true;
|
||||
|
@ -127,7 +127,7 @@ bool hw_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
|
|||
if (fs_ceilingheight1 <= bs_floorheight1 && fs_ceilingheight2 <= bs_floorheight2)
|
||||
{
|
||||
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
|
||||
if (!tex || tex->UseType == ETextureType::Null) return false;
|
||||
if (!tex || !tex->isValid()) return false;
|
||||
|
||||
// properly render skies (consider door "open" if both floors are sky):
|
||||
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||
|
@ -141,12 +141,12 @@ bool hw_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
|
|||
if (bs_ceilingheight1 < fs_ceilingheight1 || bs_ceilingheight2 < fs_ceilingheight2)
|
||||
{
|
||||
FTexture * tex = TexMan(sidedef->GetTexture(side_t::top));
|
||||
if (!tex || tex->UseType == ETextureType::Null) return false;
|
||||
if (!tex || !tex->isValid()) return false;
|
||||
}
|
||||
if (bs_floorheight1 > fs_floorheight1 || bs_floorheight2 > fs_floorheight2)
|
||||
{
|
||||
FTexture * tex = TexMan(sidedef->GetTexture(side_t::bottom));
|
||||
if (!tex || tex->UseType == ETextureType::Null) return false;
|
||||
if (!tex || !tex->isValid()) return false;
|
||||
}
|
||||
if (backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum) return false;
|
||||
|
|
|
@ -70,7 +70,7 @@ bool hw_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * glte
|
|||
|
||||
float xscale1 = secplane->Scale.X;
|
||||
float yscale1 = secplane->Scale.Y;
|
||||
if (gltexture->tex->bHasCanvas)
|
||||
if (gltexture->hasCanvas())
|
||||
{
|
||||
yscale1 = 0 - yscale1;
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ bool HWDrawInfo::DoOneSectorUpper(subsector_t * subsec, float Planez, area_t in_
|
|||
{
|
||||
// If there's a texture abort
|
||||
FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::top)];
|
||||
if (!tex || tex->UseType == ETextureType::Null) continue;
|
||||
if (!tex || !tex->isValid()) continue;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ bool HWDrawInfo::DoOneSectorLower(subsector_t * subsec, float Planez, area_t in_
|
|||
{
|
||||
// If there's a texture abort
|
||||
FTexture * tex = TexMan[seg->sidedef->GetTexture(side_t::bottom)];
|
||||
if (!tex || tex->UseType == ETextureType::Null) continue;
|
||||
if (!tex || !tex->isValid()) continue;
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
|
|||
|
||||
FTextureID texno = s->GetTexture(pos);
|
||||
texture[0] = FMaterial::ValidateTexture(texno, false, true);
|
||||
if (!texture[0] || texture[0]->tex->UseType == ETextureType::Null) goto normalsky;
|
||||
if (!texture[0] || !texture[0]->tex->isValid()) goto normalsky;
|
||||
skytexno1 = texno;
|
||||
x_offset[0] = s->GetTextureXOffset(pos) * (360.f/65536.f);
|
||||
y_offset = s->GetTextureYOffset(pos);
|
||||
|
@ -244,7 +244,7 @@ void GLWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vert
|
|||
if (bs->GetPlaneTexZ(sector_t::floor)==fs->GetPlaneTexZ(sector_t::floor)+1.)
|
||||
{
|
||||
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
|
||||
if (!tex || tex->UseType==ETextureType::Null) return;
|
||||
if (!tex || !tex->isValid()) return;
|
||||
|
||||
// very, very, very ugly special case (See Icarus MAP14)
|
||||
// It is VERY important that this is only done for a floor height difference of 1
|
||||
|
@ -327,8 +327,8 @@ void GLWall::SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,v
|
|||
if (bs->special == GLSector_NoSkyDraw) return;
|
||||
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
|
||||
|
||||
// For lower skies the normal logic only applies to walls with no lower texture!
|
||||
if (tex->UseType==ETextureType::Null)
|
||||
// For lower skies the normal logic only applies to walls with no lower texture.
|
||||
if (!tex->isValid())
|
||||
{
|
||||
if (bs->GetTexture(sector_t::floor)==skyflatnum)
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ void GLWall::SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,v
|
|||
}
|
||||
zbottom[0]=zbottom[1]=-32768.0f;
|
||||
|
||||
if ((tex && tex->UseType!=ETextureType::Null) || bs->GetTexture(sector_t::floor)!=skyflatnum)
|
||||
if ((tex && !tex->isValid()) || bs->GetTexture(sector_t::floor)!=skyflatnum)
|
||||
{
|
||||
ztop[0]=zfloor[0];
|
||||
ztop[1]=zfloor[1];
|
||||
|
|
|
@ -293,7 +293,7 @@ void FSkyVertexBuffer::SetupMatrices(FMaterial *tex, float x_offset, float y_off
|
|||
float yscale = 1.f;
|
||||
if (texh <= 128 && (level.flags & LEVEL_FORCETILEDSKY))
|
||||
{
|
||||
modelMatrix.translate(0.f, (-40 + tex->tex->SkyOffset + skyoffset)*skyoffsetfactor, 0.f);
|
||||
modelMatrix.translate(0.f, (-40 + tex->tex->GetSkyOffset() + skyoffset)*skyoffsetfactor, 0.f);
|
||||
modelMatrix.scale(1.f, 1.2f * 1.17f, 1.f);
|
||||
yscale = 240.f / texh;
|
||||
}
|
||||
|
@ -311,12 +311,12 @@ void FSkyVertexBuffer::SetupMatrices(FMaterial *tex, float x_offset, float y_off
|
|||
}
|
||||
else if (texh <= 240)
|
||||
{
|
||||
modelMatrix.translate(0.f, (200 - texh + tex->tex->SkyOffset + skyoffset)*skyoffsetfactor, 0.f);
|
||||
modelMatrix.translate(0.f, (200 - texh + tex->tex->GetSkyOffset() + skyoffset)*skyoffsetfactor, 0.f);
|
||||
modelMatrix.scale(1.f, 1.f + ((texh - 200.f) / 200.f) * 1.17f, 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
modelMatrix.translate(0.f, (-40 + tex->tex->SkyOffset + skyoffset)*skyoffsetfactor, 0.f);
|
||||
modelMatrix.translate(0.f, (-40 + tex->tex->GetSkyOffset() + skyoffset)*skyoffsetfactor, 0.f);
|
||||
modelMatrix.scale(1.f, 1.2f * 1.17f, 1.f);
|
||||
yscale = 240.f / texh;
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
di->SetupView(state, 0, 0, 0, !!(mState->MirrorFlag & 1), !!(mState->PlaneMirrorFlag & 1));
|
||||
|
||||
state.SetVertexBuffer(vertexBuffer);
|
||||
if (origin->texture[0] && origin->texture[0]->tex->bSkybox)
|
||||
if (origin->texture[0] && origin->texture[0]->tex->isSkybox())
|
||||
{
|
||||
RenderBox(di, state, origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->sky2);
|
||||
}
|
||||
|
|
|
@ -791,7 +791,7 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
// Animate picnum overrides.
|
||||
auto tex = TexMan(thing->picnum);
|
||||
if (tex == nullptr) return;
|
||||
patch = tex->id;
|
||||
patch = tex->GetID();
|
||||
mirror = false;
|
||||
}
|
||||
else
|
||||
|
@ -910,7 +910,7 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
// allow disabling of the fullbright flag by a brightmap definition
|
||||
// (e.g. to do the gun flashes of Doom's zombies correctly.
|
||||
fullbright = (thing->flags5 & MF5_BRIGHT) ||
|
||||
((thing->renderflags & RF_FULLBRIGHT) && (!gltexture || !gltexture->tex->bDisableFullbright));
|
||||
((thing->renderflags & RF_FULLBRIGHT) && (!gltexture || !gltexture->tex->isFullbrightDisabled()));
|
||||
|
||||
lightlevel = fullbright ? 255 :
|
||||
hw_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||
|
|
|
@ -1000,7 +1000,7 @@ bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float textureto
|
|||
if (gltexture != NULL)
|
||||
{
|
||||
bool normalize = false;
|
||||
if (gltexture->tex->bHasCanvas) normalize = true;
|
||||
if (gltexture->tex->isHardwareCanvas()) normalize = true;
|
||||
else if (flags & GLWF_CLAMPY)
|
||||
{
|
||||
// for negative scales we can get negative coordinates here.
|
||||
|
@ -1029,7 +1029,7 @@ void GLWall::CheckTexturePosition(FTexCoordInfo *tci)
|
|||
{
|
||||
float sub;
|
||||
|
||||
if (gltexture->tex->bHasCanvas) return;
|
||||
if (gltexture->tex->isHardwareCanvas()) return;
|
||||
|
||||
// clamp texture coordinates to a reasonable range.
|
||||
// Extremely large values can cause visual problems
|
||||
|
@ -1223,7 +1223,7 @@ void GLWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
//
|
||||
//
|
||||
FTexture * tex = TexMan(seg->sidedef->GetTexture(side_t::top));
|
||||
if (!tex || tex->UseType==ETextureType::Null)
|
||||
if (!tex || !tex->isValid())
|
||||
{
|
||||
if (front->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||
back->GetTexture(sector_t::ceiling) == skyflatnum && !wrap)
|
||||
|
@ -1259,7 +1259,7 @@ void GLWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
//
|
||||
//
|
||||
tex = TexMan(seg->sidedef->GetTexture(side_t::bottom));
|
||||
if (!tex || tex->UseType==ETextureType::Null)
|
||||
if (!tex || !tex->isValid())
|
||||
{
|
||||
// texture is missing - use the lower plane
|
||||
bottomleft = MIN(bfh1,ffh1);
|
||||
|
|
|
@ -132,7 +132,7 @@ static bool isBright(DPSprite *psp)
|
|||
if (lump.isValid())
|
||||
{
|
||||
FTexture * tex = TexMan(lump);
|
||||
if (tex) disablefullbright = tex->bDisableFullbright;
|
||||
if (tex) disablefullbright = tex->isFullbrightDisabled();
|
||||
}
|
||||
return psp->GetState()->GetFullbright() && !disablefullbright;
|
||||
}
|
||||
|
|
|
@ -164,12 +164,12 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
|||
{
|
||||
mShaderIndex = SHADER_Paletted;
|
||||
}
|
||||
else if (tx->bWarped)
|
||||
else if (tx->isWarped())
|
||||
{
|
||||
mShaderIndex = tx->bWarped; // This picks SHADER_Warp1 or SHADER_Warp2
|
||||
mShaderIndex = tx->isWarped(); // This picks SHADER_Warp1 or SHADER_Warp2
|
||||
tx->shaderspeed = static_cast<FWarpTexture*>(tx)->GetSpeed();
|
||||
}
|
||||
else if (tx->bHasCanvas)
|
||||
else if (tx->isHardwareCanvas())
|
||||
{
|
||||
if (tx->shaderindex >= FIRST_USER_SHADER)
|
||||
{
|
||||
|
@ -265,7 +265,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
|||
mMaxBound = -1;
|
||||
mMaterials.Push(this);
|
||||
tx->Material[expanded] = this;
|
||||
if (tx->bHasCanvas) tx->bTranslucent = 0;
|
||||
if (tx->isHardwareCanvas()) tx->bTranslucent = 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -484,19 +484,19 @@ int FMaterial::GetAreas(FloatRect **pAreas) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FMaterial * FMaterial::ValidateTexture(FTexture * tex, bool expand)
|
||||
FMaterial * FMaterial::ValidateTexture(FTexture * tex, bool expand, bool create)
|
||||
{
|
||||
again:
|
||||
if (tex && tex->UseType!=ETextureType::Null)
|
||||
if (tex && tex->isValid())
|
||||
{
|
||||
if (tex->bNoExpand) expand = false;
|
||||
|
||||
FMaterial *gltex = tex->Material[expand];
|
||||
if (gltex == NULL)
|
||||
if (gltex == NULL && create)
|
||||
{
|
||||
if (expand)
|
||||
{
|
||||
if (tex->bWarped || tex->bHasCanvas || tex->shaderindex >= FIRST_USER_SHADER || (tex->shaderindex >= SHADER_Specular && tex->shaderindex <= SHADER_PBRBrightmap))
|
||||
if (tex->isWarped() || tex->isHardwareCanvas() || tex->shaderindex >= FIRST_USER_SHADER || (tex->shaderindex >= SHADER_Specular && tex->shaderindex <= SHADER_PBRBrightmap))
|
||||
{
|
||||
tex->bNoExpand = true;
|
||||
goto again;
|
||||
|
@ -518,9 +518,9 @@ again:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translate)
|
||||
FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translate, bool create)
|
||||
{
|
||||
return ValidateTexture(translate? TexMan(no) : TexMan[no], expand);
|
||||
return ValidateTexture(translate? TexMan(no) : TexMan[no], expand, create);
|
||||
}
|
||||
|
||||
|
||||
|
@ -554,41 +554,3 @@ void FMaterial::Clean(bool f)
|
|||
mBaseLayer->Clean(f);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Prints some texture info
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
CCMD(textureinfo)
|
||||
{
|
||||
int cntt = 0;
|
||||
for (int i = 0; i < TexMan.NumTextures(); i++)
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
if (tex->SystemTexture[0] || tex->SystemTexture[1] || tex->Material[0] || tex->Material[1])
|
||||
{
|
||||
int lump = tex->GetSourceLump();
|
||||
Printf(PRINT_LOG, "Texture '%s' (Index %d, Lump %d, Name '%s'):\n", tex->Name.GetChars(), i, lump, Wads.GetLumpFullName(lump));
|
||||
if (tex->Material[0])
|
||||
{
|
||||
Printf(PRINT_LOG, "in use (normal)\n");
|
||||
}
|
||||
else if (tex->SystemTexture[0])
|
||||
{
|
||||
Printf(PRINT_LOG, "referenced (normal)\n");
|
||||
}
|
||||
if (tex->Material[1])
|
||||
{
|
||||
Printf(PRINT_LOG, "in use (expanded)\n");
|
||||
}
|
||||
else if (tex->SystemTexture[1])
|
||||
{
|
||||
Printf(PRINT_LOG, "referenced (normal)\n");
|
||||
}
|
||||
cntt++;
|
||||
}
|
||||
}
|
||||
Printf(PRINT_LOG, "%d system textures\n", cntt);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,11 @@ public:
|
|||
{
|
||||
return mTextureLayers.Size() + 1;
|
||||
}
|
||||
|
||||
bool hasCanvas()
|
||||
{
|
||||
return tex->isHardwareCanvas();
|
||||
}
|
||||
|
||||
IHardwareTexture *GetLayer(int i, FTexture **pLayer = nullptr)
|
||||
{
|
||||
|
@ -165,8 +170,8 @@ public:
|
|||
|
||||
static void DeleteAll();
|
||||
static void FlushAll();
|
||||
static FMaterial *ValidateTexture(FTexture * tex, bool expand);
|
||||
static FMaterial *ValidateTexture(FTextureID no, bool expand, bool trans);
|
||||
static FMaterial *ValidateTexture(FTexture * tex, bool expand, bool create = true);
|
||||
static FMaterial *ValidateTexture(FTextureID no, bool expand, bool trans, bool create = true);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -48,11 +48,6 @@ static void PrecacheTexture(FTexture *tex, int cache)
|
|||
FMaterial * gltex = FMaterial::ValidateTexture(tex, false);
|
||||
if (gltex) gltex->Precache();
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure that software pixel buffers do not stick around for unneeded textures.
|
||||
tex->Unload();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -91,14 +86,14 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
if (texhitlist[i] & (FTextureManager::HIT_Sky | FTextureManager::HIT_Wall))
|
||||
{
|
||||
FTexture *tex = TexMan.ByIndex(i);
|
||||
if (tex->bSkybox)
|
||||
if (tex->isSkybox())
|
||||
{
|
||||
FSkyBox *sb = static_cast<FSkyBox*>(tex);
|
||||
for (int i = 0; i<6; i++)
|
||||
{
|
||||
if (sb->faces[i])
|
||||
{
|
||||
int index = sb->faces[i]->id.GetIndex();
|
||||
int index = sb->faces[i]->GetID().GetIndex();
|
||||
texhitlist[index] |= FTextureManager::HIT_Flat;
|
||||
}
|
||||
}
|
||||
|
@ -181,11 +176,13 @@ void hw_PrecacheTexture(uint8_t *texhitlist, TMap<PClassActor*, bool> &actorhitl
|
|||
{
|
||||
if (!texhitlist[i])
|
||||
{
|
||||
if (tex->Material[0]) tex->Material[0]->Clean(true);
|
||||
auto mat = FMaterial::ValidateTexture(tex, false, false);
|
||||
if (mat) mat->Clean(true);
|
||||
}
|
||||
if (spritehitlist[i] == nullptr || (*spritehitlist[i]).CountUsed() == 0)
|
||||
{
|
||||
if (tex->Material[1]) tex->Material[1]->Clean(true);
|
||||
auto mat = FMaterial::ValidateTexture(tex, true, false);
|
||||
if (mat) mat->Clean(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
|||
state.EnableTexture(true);
|
||||
|
||||
// Canvas textures are stored upside down
|
||||
if (cmd.mTexture->bHasCanvas)
|
||||
if (cmd.mTexture->isHardwareCanvas())
|
||||
{
|
||||
state.mTextureMatrix.loadIdentity();
|
||||
state.mTextureMatrix.scale(1.f, -1.f, 1.f);
|
||||
|
|
|
@ -573,8 +573,8 @@ void DIntermissionScreenCast::Drawer ()
|
|||
screen->DrawTexture (pic, 160, 170,
|
||||
DTA_320x200, true,
|
||||
DTA_FlipX, sprframe->Flip & 1,
|
||||
DTA_DestHeightF, pic->GetScaledHeightDouble() * castscale.Y,
|
||||
DTA_DestWidthF, pic->GetScaledWidthDouble() * castscale.X,
|
||||
DTA_DestHeightF, pic->GetDisplayHeightDouble() * castscale.Y,
|
||||
DTA_DestWidthF, pic->GetDisplayWidthDouble() * castscale.X,
|
||||
DTA_RenderStyle, mDefaults->RenderStyle,
|
||||
DTA_Alpha, mDefaults->Alpha,
|
||||
DTA_TranslationIndex, casttranslation,
|
||||
|
@ -616,8 +616,8 @@ void DIntermissionScreenScroller::Drawer ()
|
|||
if (mTicker >= mScrollDelay && mTicker < mScrollDelay + mScrollTime && tex != NULL && tex2 != NULL)
|
||||
{
|
||||
|
||||
int fwidth = tex->GetScaledWidth();
|
||||
int fheight = tex->GetScaledHeight();
|
||||
int fwidth = tex->GetDisplayWidth();
|
||||
int fheight = tex->GetDisplayHeight();
|
||||
|
||||
double xpos1 = 0, ypos1 = 0, xpos2 = 0, ypos2 = 0;
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ unsigned FSavegameManager::ExtractSaveData(int index)
|
|||
{
|
||||
SavePic = PNGTexture_CreateFromFile(png, node->Filename);
|
||||
delete png;
|
||||
if (SavePic->GetWidth() == 1 && SavePic->GetHeight() == 1)
|
||||
if (SavePic->GetDisplayWidth() == 1 && SavePic->GetDisplayHeight() == 1)
|
||||
{
|
||||
delete SavePic;
|
||||
SavePic = nullptr;
|
||||
|
|
|
@ -6690,7 +6690,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
auto a = SingleActorFromTID(args[0], activator);
|
||||
if (a != nullptr)
|
||||
{
|
||||
return GlobalACSStrings.AddString(TexMan[a->floorpic]->Name);
|
||||
return GlobalACSStrings.AddString(TexMan[a->floorpic]->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -294,7 +294,7 @@ void DDoor::DoorSound(bool raise, DSeqNode *curseq) const
|
|||
continue;
|
||||
|
||||
FTexture *tex = TexMan[line->sidedef[0]->GetTexture(side_t::top)];
|
||||
texname = tex ? tex->Name.GetChars() : NULL;
|
||||
texname = tex ? tex->GetName().GetChars() : NULL;
|
||||
if (texname != NULL && texname[0] == 'D' && texname[1] == 'O' && texname[2] == 'R')
|
||||
{
|
||||
switch (texname[3])
|
||||
|
@ -715,9 +715,8 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
|
|||
|
||||
picnum = tex1[side_t::top].texture;
|
||||
|
||||
// don't forget texture scaling here!
|
||||
FTexture *tex = TexMan[picnum];
|
||||
topdist = tex ? tex->GetScaledHeight() : 64;
|
||||
topdist = tex ? tex->GetDisplayHeight() : 64;
|
||||
|
||||
topdist = m_Sector->ceilingplane.fD() - topdist * m_Sector->ceilingplane.fC();
|
||||
|
||||
|
|
|
@ -480,7 +480,7 @@ static inline void CheckShortestTex (FTextureID texnum, double &minsize)
|
|||
FTexture *tex = TexMan[texnum];
|
||||
if (tex != NULL)
|
||||
{
|
||||
double h = tex->GetScaledHeight();
|
||||
double h = tex->GetDisplayHeight();
|
||||
if (h < minsize)
|
||||
{
|
||||
minsize = h;
|
||||
|
@ -501,7 +501,7 @@ double FindShortestTextureAround (sector_t *sec)
|
|||
CheckShortestTex (check->sidedef[1]->GetTexture(side_t::bottom), minsize);
|
||||
}
|
||||
}
|
||||
return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight();
|
||||
return minsize < FLT_MAX ? minsize : TexMan[0]->GetDisplayHeight();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -526,7 +526,7 @@ double FindShortestUpperAround (sector_t *sec)
|
|||
CheckShortestTex (check->sidedef[1]->GetTexture(side_t::top), minsize);
|
||||
}
|
||||
}
|
||||
return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight();
|
||||
return minsize < FLT_MAX ? minsize : TexMan[0]->GetDisplayHeight();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1147,11 +1147,11 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
|
|||
FTexture *tex = TexMan[GetTexture(sector_t::floor)];
|
||||
if (tex != NULL && tex->isGlowing())
|
||||
{
|
||||
if (!tex->bAutoGlowing) tex = TexMan(GetTexture(sector_t::floor));
|
||||
if (!tex->isAutoGlowing()) tex = TexMan(GetTexture(sector_t::floor));
|
||||
if (tex->isGlowing()) // recheck the current animation frame.
|
||||
{
|
||||
tex->GetGlowColor(bottomglowcolor);
|
||||
bottomglowcolor[3] = (float)tex->GlowHeight;
|
||||
bottomglowcolor[3] = (float)tex->GetGlowHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1192,12 +1192,12 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
|
|||
FTexture *tex = TexMan[GetTexture(sector_t::ceiling)];
|
||||
if (tex != NULL && tex->isGlowing())
|
||||
{
|
||||
if (!tex->bAutoGlowing) tex = TexMan(GetTexture(sector_t::ceiling));
|
||||
if (!tex->isAutoGlowing()) tex = TexMan(GetTexture(sector_t::ceiling));
|
||||
if (tex->isGlowing()) // recheck the current animation frame.
|
||||
{
|
||||
ret = true;
|
||||
tex->GetGlowColor(topglowcolor);
|
||||
topglowcolor[3] = (float)tex->GlowHeight;
|
||||
topglowcolor[3] = (float)tex->GetGlowHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1216,12 +1216,12 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
|
|||
FTexture *tex = TexMan[GetTexture(sector_t::floor)];
|
||||
if (tex != NULL && tex->isGlowing())
|
||||
{
|
||||
if (!tex->bAutoGlowing) tex = TexMan(GetTexture(sector_t::floor));
|
||||
if (!tex->isAutoGlowing()) tex = TexMan(GetTexture(sector_t::floor));
|
||||
if (tex->isGlowing()) // recheck the current animation frame.
|
||||
{
|
||||
ret = true;
|
||||
tex->GetGlowColor(bottomglowcolor);
|
||||
bottomglowcolor[3] = (float)tex->GlowHeight;
|
||||
bottomglowcolor[3] = (float)tex->GetGlowHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void PolyDrawArgs::SetTexture(const uint8_t *texels, int width, int height)
|
|||
mTranslation = nullptr;
|
||||
}
|
||||
|
||||
void PolyDrawArgs::SetTexture(FTexture *texture, FRenderStyle style)
|
||||
void PolyDrawArgs::SetTexture(FSoftwareTexture *texture, FRenderStyle style)
|
||||
{
|
||||
mTexture = texture;
|
||||
mTextureWidth = texture->GetWidth();
|
||||
|
@ -59,7 +59,7 @@ void PolyDrawArgs::SetTexture(FTexture *texture, FRenderStyle style)
|
|||
mTranslation = nullptr;
|
||||
}
|
||||
|
||||
void PolyDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style)
|
||||
void PolyDrawArgs::SetTexture(FSoftwareTexture *texture, uint32_t translationID, FRenderStyle style)
|
||||
{
|
||||
// Alphatexture overrides translations.
|
||||
if (translationID != 0xffffffff && translationID != 0 && !(style.Flags & STYLEF_RedIsAlpha))
|
||||
|
@ -140,7 +140,7 @@ void PolyDrawArgs::SetColor(uint32_t bgra, uint8_t palindex)
|
|||
}
|
||||
}
|
||||
|
||||
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
|
||||
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FSoftwareTexture *tex, bool fullbright)
|
||||
{
|
||||
SetTexture(tex, translationID, renderstyle);
|
||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
||||
|
@ -203,7 +203,7 @@ void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint3
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RectDrawArgs::SetTexture(FTexture *texture, FRenderStyle style)
|
||||
void RectDrawArgs::SetTexture(FSoftwareTexture *texture, FRenderStyle style)
|
||||
{
|
||||
mTexture = texture;
|
||||
mTextureWidth = texture->GetWidth();
|
||||
|
@ -215,7 +215,7 @@ void RectDrawArgs::SetTexture(FTexture *texture, FRenderStyle style)
|
|||
mTranslation = nullptr;
|
||||
}
|
||||
|
||||
void RectDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style)
|
||||
void RectDrawArgs::SetTexture(FSoftwareTexture *texture, uint32_t translationID, FRenderStyle style)
|
||||
{
|
||||
// Alphatexture overrides translations.
|
||||
if (translationID != 0xffffffff && translationID != 0 && !(style.Flags & STYLEF_RedIsAlpha))
|
||||
|
@ -291,7 +291,7 @@ void RectDrawArgs::Draw(PolyRenderThread *thread, double x0, double x1, double y
|
|||
thread->DrawQueue->Push<DrawRectCommand>(*this);
|
||||
}
|
||||
|
||||
void RectDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
|
||||
void RectDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FSoftwareTexture *tex, bool fullbright)
|
||||
{
|
||||
SetTexture(tex, translationID, renderstyle);
|
||||
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "screen_triangle.h"
|
||||
|
||||
class PolyRenderThread;
|
||||
class FTexture;
|
||||
class FSoftwareTexture;
|
||||
class Mat4f;
|
||||
|
||||
enum class PolyDrawMode
|
||||
|
@ -67,8 +67,8 @@ class PolyDrawArgs
|
|||
public:
|
||||
void SetClipPlane(int index, const PolyClipPlane &plane) { mClipPlane[index] = plane; }
|
||||
void SetTexture(const uint8_t *texels, int width, int height);
|
||||
void SetTexture(FTexture *texture, FRenderStyle style);
|
||||
void SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style);
|
||||
void SetTexture(FSoftwareTexture *texture, FRenderStyle style);
|
||||
void SetTexture(FSoftwareTexture *texture, uint32_t translationID, FRenderStyle style);
|
||||
void SetLight(FSWColormap *basecolormap, uint32_t lightlevel, double globVis, bool fixed);
|
||||
void SetDepthTest(bool enable) { mDepthTest = enable; }
|
||||
void SetStencilTestValue(uint8_t stencilTestValue) { mStencilTestValue = stencilTestValue; }
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
void SetWriteStencil(bool enable, uint8_t stencilWriteValue = 0) { mWriteStencil = enable; mStencilWriteValue = stencilWriteValue; }
|
||||
void SetWriteDepth(bool enable) { mWriteDepth = enable; }
|
||||
void SetStyle(TriBlendMode blendmode, double alpha = 1.0) { mBlendMode = blendmode; mAlpha = (uint32_t)(alpha * 256.0 + 0.5); }
|
||||
void SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
|
||||
void SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FSoftwareTexture *texture, bool fullbright);
|
||||
void SetColor(uint32_t bgra, uint8_t palindex);
|
||||
void SetLights(PolyLight *lights, int numLights) { mLights = lights; mNumLights = numLights; }
|
||||
void SetDynLightColor(uint32_t color) { mDynLightColor = color; }
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
bool WriteColor() const { return mWriteColor; }
|
||||
|
||||
FTexture *Texture() const { return mTexture; }
|
||||
FSoftwareTexture *Texture() const { return mTexture; }
|
||||
const uint8_t *TexturePixels() const { return mTexturePixels; }
|
||||
int TextureWidth() const { return mTextureWidth; }
|
||||
int TextureHeight() const { return mTextureHeight; }
|
||||
|
@ -131,7 +131,7 @@ private:
|
|||
bool mWriteStencil = true;
|
||||
bool mWriteColor = true;
|
||||
bool mWriteDepth = true;
|
||||
FTexture *mTexture = nullptr;
|
||||
FSoftwareTexture *mTexture = nullptr;
|
||||
const uint8_t *mTexturePixels = nullptr;
|
||||
int mTextureWidth = 0;
|
||||
int mTextureHeight = 0;
|
||||
|
@ -166,15 +166,15 @@ private:
|
|||
class RectDrawArgs
|
||||
{
|
||||
public:
|
||||
void SetTexture(FTexture *texture, FRenderStyle style);
|
||||
void SetTexture(FTexture *texture, uint32_t translationID, FRenderStyle style);
|
||||
void SetTexture(FSoftwareTexture *texture, FRenderStyle style);
|
||||
void SetTexture(FSoftwareTexture *texture, uint32_t translationID, FRenderStyle style);
|
||||
void SetLight(FSWColormap *basecolormap, uint32_t lightlevel);
|
||||
void SetStyle(TriBlendMode blendmode, double alpha = 1.0) { mBlendMode = blendmode; mAlpha = (uint32_t)(alpha * 256.0 + 0.5); }
|
||||
void SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *texture, bool fullbright);
|
||||
void SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FSoftwareTexture *texture, bool fullbright);
|
||||
void SetColor(uint32_t bgra, uint8_t palindex);
|
||||
void Draw(PolyRenderThread *thread, double x0, double x1, double y0, double y1, double u0, double u1, double v0, double v1);
|
||||
|
||||
FTexture *Texture() const { return mTexture; }
|
||||
FSoftwareTexture *Texture() const { return mTexture; }
|
||||
const uint8_t *TexturePixels() const { return mTexturePixels; }
|
||||
int TextureWidth() const { return mTextureWidth; }
|
||||
int TextureHeight() const { return mTextureHeight; }
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
float V1() const { return mV1; }
|
||||
|
||||
private:
|
||||
FTexture *mTexture = nullptr;
|
||||
FSoftwareTexture *mTexture = nullptr;
|
||||
const uint8_t *mTexturePixels = nullptr;
|
||||
int mTextureWidth = 0;
|
||||
int mTextureHeight = 0;
|
||||
|
|
|
@ -74,7 +74,7 @@ void PolyRenderThread::FlushDrawQueue()
|
|||
}
|
||||
}
|
||||
|
||||
void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
|
||||
void PolyRenderThread::PrepareTexture(FSoftwareTexture *texture, FRenderStyle style)
|
||||
{
|
||||
if (texture == nullptr)
|
||||
return;
|
||||
|
@ -92,7 +92,7 @@ void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
|
|||
std::unique_lock<std::mutex> lock(loadmutex);
|
||||
|
||||
texture->GetPixels(style);
|
||||
const FTexture::Span *spans;
|
||||
const FSoftwareTextureSpan *spans;
|
||||
texture->GetColumn(style, 0, &spans);
|
||||
if (PolyRenderer::Instance()->RenderTarget->IsBgra())
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
TArray<ADynamicLight*> AddedLightsArray;
|
||||
|
||||
// Make sure texture can accessed safely
|
||||
void PrepareTexture(FTexture *texture, FRenderStyle style);
|
||||
void PrepareTexture(FSoftwareTexture *texture, FRenderStyle style);
|
||||
|
||||
// Setup poly object in a threadsafe manner
|
||||
void PreparePolyObject(subsector_t *sub);
|
||||
|
|
|
@ -49,9 +49,11 @@ void RenderPolyDecal::Render(PolyRenderThread *thread, DBaseDecal *decal, const
|
|||
if (decal->RenderFlags & RF_INVISIBLE || !viewactive || !decal->PicNum.isValid())
|
||||
return;
|
||||
|
||||
FTexture *tex = TexMan(decal->PicNum, true);
|
||||
if (tex == nullptr || tex->UseType == ETextureType::Null)
|
||||
FTexture *ttex = TexMan(decal->PicNum, true);
|
||||
if (ttex == nullptr || !ttex->isValid())
|
||||
return;
|
||||
|
||||
FSoftwareTexture *tex = ttex->GetSoftwareTexture();
|
||||
|
||||
sector_t *front, *back;
|
||||
GetDecalSectors(decal, line, &front, &back);
|
||||
|
@ -73,16 +75,16 @@ void RenderPolyDecal::Render(PolyRenderThread *thread, DBaseDecal *decal, const
|
|||
|
||||
bool flipTextureX = (decal->RenderFlags & RF_XFLIP) == RF_XFLIP;
|
||||
double u_left = flipTextureX ? 1.0 : 0.0;
|
||||
double u_right = flipTextureX ? 1.0 - tex->Scale.X : tex->Scale.X;
|
||||
double u_right = flipTextureX ? 1.0 - tex->GetScale().X : tex->GetScale().X;
|
||||
double u_unit = (u_right - u_left) / (edge_left + edge_right);
|
||||
|
||||
double zpos = GetDecalZ(decal, line, front, back);
|
||||
double spriteHeight = decal->ScaleY / tex->Scale.Y * tex->GetHeight();
|
||||
double spriteHeight = decal->ScaleY / tex->GetScale().Y * tex->GetHeight();
|
||||
double ztop = zpos + spriteHeight - spriteHeight * 0.5;
|
||||
double zbottom = zpos - spriteHeight * 0.5;
|
||||
|
||||
double v_top = 0.0;
|
||||
double v_bottom = tex->Scale.Y;
|
||||
double v_bottom = tex->GetScale().Y;
|
||||
double v_unit = (v_bottom - v_top) / (zbottom - ztop);
|
||||
|
||||
// Clip decal to wall part
|
||||
|
|
|
@ -67,7 +67,7 @@ static bool isBright(DPSprite *psp)
|
|||
if (lump.isValid())
|
||||
{
|
||||
FTexture * tex = TexMan(lump);
|
||||
if (tex) disablefullbright = tex->bDisableFullbright;
|
||||
if (tex) disablefullbright = tex->isFullbrightDisabled();
|
||||
}
|
||||
return psp->GetState()->GetFullbright() && !disablefullbright;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ void PolyModelRenderer::SetInterpolation(double interpolation)
|
|||
|
||||
void PolyModelRenderer::SetMaterial(FTexture *skin, bool clampNoFilter, int translation)
|
||||
{
|
||||
SkinTexture = skin;
|
||||
SkinTexture = skin? skin->GetSoftwareTexture() : nullptr;
|
||||
}
|
||||
|
||||
void PolyModelRenderer::SetTransform()
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
uint32_t Translation;
|
||||
|
||||
Mat4f ObjectToWorld;
|
||||
FTexture *SkinTexture = nullptr;
|
||||
FSoftwareTexture *SkinTexture = nullptr;
|
||||
unsigned int *IndexBuffer = nullptr;
|
||||
FModelVertex *VertexBuffer = nullptr;
|
||||
float InterpolationFactor = 0.0;
|
||||
|
|
|
@ -67,10 +67,10 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyTransferH
|
|||
if (picnum != skyflatnum)
|
||||
{
|
||||
FTexture *tex = TexMan(picnum);
|
||||
if (!tex || tex->UseType == ETextureType::Null)
|
||||
if (!tex || !tex->isValid())
|
||||
return;
|
||||
|
||||
PolyPlaneUVTransform transform = PolyPlaneUVTransform(ceiling ? fakeflat.FrontSector->planes[sector_t::ceiling].xform : fakeflat.FrontSector->planes[sector_t::floor].xform, tex);
|
||||
PolyPlaneUVTransform transform = PolyPlaneUVTransform(ceiling ? fakeflat.FrontSector->planes[sector_t::ceiling].xform : fakeflat.FrontSector->planes[sector_t::floor].xform, tex->GetSoftwareTexture());
|
||||
TriVertex *vertices = CreatePlaneVertices(thread, fakeflat.Subsector, transform, ceiling ? fakeflat.FrontSector->ceilingplane : fakeflat.FrontSector->floorplane);
|
||||
|
||||
PolyDrawArgs args;
|
||||
|
@ -78,7 +78,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyTransferH
|
|||
SetDynLights(thread, args, fakeflat.Subsector, ceiling);
|
||||
args.SetStencilTestValue(stencilValue);
|
||||
args.SetWriteStencil(true, stencilValue + 1);
|
||||
args.SetTexture(tex, DefaultRenderStyle());
|
||||
args.SetTexture(tex->GetSoftwareTexture(), DefaultRenderStyle());
|
||||
args.SetStyle(TriBlendMode::Opaque);
|
||||
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
||||
}
|
||||
|
@ -389,12 +389,12 @@ TriVertex *RenderPolyPlane::CreateSkyPlaneVertices(PolyRenderThread *thread, sub
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PolyPlaneUVTransform::PolyPlaneUVTransform(const FTransform &transform, FTexture *tex)
|
||||
PolyPlaneUVTransform::PolyPlaneUVTransform(const FTransform &transform, FSoftwareTexture *tex)
|
||||
{
|
||||
if (tex)
|
||||
{
|
||||
xscale = (float)(transform.xScale * tex->Scale.X / tex->GetWidth());
|
||||
yscale = (float)(transform.yScale * tex->Scale.Y / tex->GetHeight());
|
||||
xscale = (float)(transform.xScale * tex->GetScale().X / tex->GetWidth());
|
||||
yscale = (float)(transform.yScale * tex->GetScale().Y / tex->GetHeight());
|
||||
|
||||
double planeang = (transform.Angle + transform.baseAngle).Radians();
|
||||
cosine = (float)cos(planeang);
|
||||
|
@ -510,8 +510,8 @@ void Render3DFloorPlane::RenderPlanes(PolyRenderThread *thread, subsector_t *sub
|
|||
void Render3DFloorPlane::Render(PolyRenderThread *thread)
|
||||
{
|
||||
FTextureID picnum = ceiling ? *fakeFloor->bottom.texture : *fakeFloor->top.texture;
|
||||
FTexture *tex = TexMan(picnum);
|
||||
if (tex->UseType == ETextureType::Null)
|
||||
auto tex = TexMan(picnum);
|
||||
if (!tex->isValid())
|
||||
return;
|
||||
|
||||
PolyCameraLight *cameraLight = PolyCameraLight::Instance();
|
||||
|
@ -528,7 +528,7 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread)
|
|||
int actualextralight = foggy ? 0 : PolyRenderer::Instance()->Viewpoint.extralight << 4;
|
||||
lightlevel = clamp(lightlevel + actualextralight, 0, 255);
|
||||
|
||||
PolyPlaneUVTransform xform(ceiling ? fakeFloor->top.model->planes[sector_t::ceiling].xform : fakeFloor->top.model->planes[sector_t::floor].xform, tex);
|
||||
PolyPlaneUVTransform xform(ceiling ? fakeFloor->top.model->planes[sector_t::ceiling].xform : fakeFloor->top.model->planes[sector_t::floor].xform, tex->GetSoftwareTexture());
|
||||
|
||||
TriVertex *vertices = thread->FrameMemory->AllocMemory<TriVertex>(sub->numlines);
|
||||
if (ceiling)
|
||||
|
@ -562,6 +562,6 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread)
|
|||
}
|
||||
args.SetStencilTestValue(stencilValue);
|
||||
args.SetWriteStencil(true, stencilValue + 1);
|
||||
args.SetTexture(tex, DefaultRenderStyle());
|
||||
args.SetTexture(tex->GetSoftwareTexture(), DefaultRenderStyle());
|
||||
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, sub->numlines, PolyDrawMode::TriangleFan);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class PolyDrawSectorPortal;
|
|||
class PolyPlaneUVTransform
|
||||
{
|
||||
public:
|
||||
PolyPlaneUVTransform(const FTransform &transform, FTexture *tex);
|
||||
PolyPlaneUVTransform(const FTransform &transform, FSoftwareTexture *tex);
|
||||
|
||||
TriVertex GetVertex(vertex_t *v1, double height) const
|
||||
{
|
||||
|
|
|
@ -162,7 +162,7 @@ void RenderPolyPlayerSprites::RenderRemainingSprites()
|
|||
{
|
||||
for (const PolyHWAccelPlayerSprite &sprite : AcceleratedSprites)
|
||||
{
|
||||
screen->DrawTexture(sprite.pic,
|
||||
screen->DrawTexture(sprite.pic->GetTexture(),
|
||||
viewwindowx + sprite.x1,
|
||||
viewwindowy + viewheight / 2 - sprite.texturemid * sprite.yscale - 0.5,
|
||||
DTA_DestWidthF, FIXED2DBL(sprite.pic->GetWidth() * sprite.xscale),
|
||||
|
@ -198,7 +198,8 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
|
|||
spriteframe_t* sprframe;
|
||||
FTextureID picnum;
|
||||
uint16_t flip;
|
||||
FTexture* tex;
|
||||
FTexture* ttex;
|
||||
FSoftwareTexture* tex;
|
||||
bool noaccel;
|
||||
double alpha = owner->Alpha;
|
||||
|
||||
|
@ -226,10 +227,12 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
|
|||
|
||||
picnum = sprframe->Texture[0];
|
||||
flip = sprframe->Flip & 1;
|
||||
tex = TexMan(picnum);
|
||||
ttex = TexMan(picnum);
|
||||
|
||||
if (tex->UseType == ETextureType::Null)
|
||||
if (!ttex->isValid())
|
||||
return;
|
||||
|
||||
tex = ttex->GetSoftwareTexture();
|
||||
|
||||
if (pspr->firstTic)
|
||||
{ // Can't interpolate the first tic.
|
||||
|
@ -290,7 +293,7 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
|
|||
|
||||
vis.renderflags = owner->renderflags;
|
||||
|
||||
vis.texturemid = (BASEYCENTER - sy) * tex->Scale.Y + tex->GetTopOffsetPo();
|
||||
vis.texturemid = (BASEYCENTER - sy) * tex->GetScale().Y + tex->GetTopOffsetPo();
|
||||
|
||||
if (viewpoint.camera->player && (renderToCanvas ||
|
||||
viewheight == renderTarget->GetHeight() ||
|
||||
|
@ -304,20 +307,20 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
|
|||
}
|
||||
vis.x1 = x1 < 0 ? 0 : x1;
|
||||
vis.x2 = x2 >= viewwidth ? viewwidth : x2;
|
||||
vis.xscale = FLOAT2FIXED(pspritexscale / tex->Scale.X);
|
||||
vis.yscale = float(pspriteyscale / tex->Scale.Y);
|
||||
vis.xscale = FLOAT2FIXED(pspritexscale / tex->GetScale().X);
|
||||
vis.yscale = float(pspriteyscale / tex->GetScale().Y);
|
||||
vis.pic = tex;
|
||||
|
||||
// If flip is used, provided that it's not already flipped (that would just invert itself)
|
||||
// (It's an XOR...)
|
||||
if (!(flip) != !(pspr->Flags & PSPF_FLIP))
|
||||
{
|
||||
vis.xiscale = -FLOAT2FIXED(pspritexiscale * tex->Scale.X);
|
||||
vis.xiscale = -FLOAT2FIXED(pspritexiscale * tex->GetScale().X);
|
||||
vis.startfrac = (tex->GetWidth() << FRACBITS) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
vis.xiscale = FLOAT2FIXED(pspritexiscale * tex->Scale.X);
|
||||
vis.xiscale = FLOAT2FIXED(pspritexiscale * tex->GetScale().X);
|
||||
vis.startfrac = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
fixed_t xscale = 0;
|
||||
float yscale = 0.0f;
|
||||
|
||||
FTexture *pic = nullptr;
|
||||
FSoftwareTexture *pic = nullptr;
|
||||
|
||||
fixed_t xiscale = 0;
|
||||
fixed_t startfrac = 0;
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
class PolyHWAccelPlayerSprite
|
||||
{
|
||||
public:
|
||||
FTexture *pic = nullptr;
|
||||
FSoftwareTexture *pic = nullptr;
|
||||
double texturemid = 0.0;
|
||||
float yscale = 0.0f;
|
||||
fixed_t xscale = 0;
|
||||
|
|
|
@ -63,7 +63,7 @@ void PolySkyDome::Render(PolyRenderThread *thread, const Mat4f &worldToView, con
|
|||
float offsetBaseV = 0.25f;
|
||||
|
||||
float scaleFrontU = frameSetup.frontcyl / (float)frameSetup.frontskytex->GetWidth();
|
||||
float scaleFrontV = (float)frameSetup.frontskytex->Scale.Y * scaleBaseV;
|
||||
float scaleFrontV = (float)frameSetup.frontskytex->GetScale().Y * scaleBaseV;
|
||||
float offsetFrontU = (float)((frameSetup.frontpos / 65536.0 + frameSetup.frontcyl / 2) / frameSetup.frontskytex->GetWidth());
|
||||
float offsetFrontV = (float)((frameSetup.skymid / frameSetup.frontskytex->GetHeight() + offsetBaseV) * scaleBaseV);
|
||||
|
||||
|
@ -115,7 +115,7 @@ void PolySkyDome::RenderRow(PolyRenderThread *thread, PolyDrawArgs &args, int ro
|
|||
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, &mVertices[mPrimStart[row]], mPrimStart[row + 1] - mPrimStart[row], PolyDrawMode::TriangleStrip);
|
||||
}
|
||||
|
||||
void PolySkyDome::RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args, FTexture *skytex, int row, bool bottomCap)
|
||||
void PolySkyDome::RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args, FSoftwareTexture *skytex, int row, bool bottomCap)
|
||||
{
|
||||
uint32_t solid = skytex->GetSkyCapColor(bottomCap);
|
||||
uint8_t palsolid = RGB32k.RGB[(RPART(solid) >> 3)][(GPART(solid) >> 3)][(BPART(solid) >> 3)];
|
||||
|
@ -214,7 +214,7 @@ Mat4f PolySkyDome::GLSkyMath()
|
|||
float x_offset = 0.0f;
|
||||
float y_offset = 0.0f;
|
||||
bool mirror = false;
|
||||
FTexture *tex = mCurrentSetup.frontskytex;
|
||||
FSoftwareTexture *tex = mCurrentSetup.frontskytex;
|
||||
|
||||
int texh = 0;
|
||||
int texw = 0;
|
||||
|
@ -231,7 +231,7 @@ Mat4f PolySkyDome::GLSkyMath()
|
|||
float yscale = 1.f;
|
||||
if (texh <= 128 && (level.flags & LEVEL_FORCETILEDSKY))
|
||||
{
|
||||
modelMatrix = modelMatrix * Mat4f::Translate(0.f, 0.f, (-40 + tex->SkyOffset + skyoffset)*skyoffsetfactor);
|
||||
modelMatrix = modelMatrix * Mat4f::Translate(0.f, 0.f, (-40 + tex->GetSkyOffset() + skyoffset)*skyoffsetfactor);
|
||||
modelMatrix = modelMatrix * Mat4f::Scale(1.f, 1.f, 1.2f * 1.17f);
|
||||
yscale = 240.f / texh;
|
||||
}
|
||||
|
@ -249,12 +249,12 @@ Mat4f PolySkyDome::GLSkyMath()
|
|||
}
|
||||
else if (texh <= 240)
|
||||
{
|
||||
modelMatrix = modelMatrix * Mat4f::Translate(0.f, 0.f, (200 - texh + tex->SkyOffset + skyoffset)*skyoffsetfactor);
|
||||
modelMatrix = modelMatrix * Mat4f::Translate(0.f, 0.f, (200 - texh + tex->GetSkyOffset() + skyoffset)*skyoffsetfactor);
|
||||
modelMatrix = modelMatrix * Mat4f::Scale(1.f, 1.f, 1.f + ((texh - 200.f) / 200.f) * 1.17f);
|
||||
}
|
||||
else
|
||||
{
|
||||
modelMatrix = modelMatrix * Mat4f::Translate(0.f, 0.f, (-40 + tex->SkyOffset + skyoffset)*skyoffsetfactor);
|
||||
modelMatrix = modelMatrix * Mat4f::Translate(0.f, 0.f, (-40 + tex->GetSkyOffset() + skyoffset)*skyoffsetfactor);
|
||||
modelMatrix = modelMatrix * Mat4f::Scale(1.f, 1.f, 1.2f * 1.17f);
|
||||
yscale = 240.f / texh;
|
||||
}
|
||||
|
@ -277,6 +277,14 @@ Mat4f PolySkyDome::GLSkyMath()
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static FSoftwareTexture *GetSWTex(FTextureID texid, bool allownull = true)
|
||||
{
|
||||
auto tex = TexMan(texid, true);
|
||||
if (tex == nullptr) return nullptr;
|
||||
if (!allownull && !tex->isValid()) return nullptr;
|
||||
return tex->GetSoftwareTexture();
|
||||
}
|
||||
|
||||
void PolySkySetup::Update()
|
||||
{
|
||||
FTextureID sky1tex, sky2tex;
|
||||
|
@ -299,9 +307,9 @@ void PolySkySetup::Update()
|
|||
if (!(sectorSky & PL_SKYFLAT))
|
||||
{ // use sky1
|
||||
sky1:
|
||||
frontskytex = TexMan(sky1tex, true);
|
||||
frontskytex = GetSWTex(sky1tex);
|
||||
if (level.flags & LEVEL_DOUBLESKY)
|
||||
backskytex = TexMan(sky2tex, true);
|
||||
backskytex = GetSWTex(sky2tex);
|
||||
else
|
||||
backskytex = nullptr;
|
||||
skyflip = false;
|
||||
|
@ -312,7 +320,7 @@ void PolySkySetup::Update()
|
|||
}
|
||||
else if (sectorSky == PL_SKYFLAT)
|
||||
{ // use sky2
|
||||
frontskytex = TexMan(sky2tex, true);
|
||||
frontskytex = GetSWTex(sky2tex);
|
||||
backskytex = nullptr;
|
||||
frontcyl = sky2cyl;
|
||||
skyflip = false;
|
||||
|
@ -338,8 +346,8 @@ void PolySkySetup::Update()
|
|||
pos = side_t::top;
|
||||
}
|
||||
|
||||
frontskytex = TexMan(s->GetTexture(pos), true);
|
||||
if (frontskytex == nullptr || frontskytex->UseType == ETextureType::Null)
|
||||
frontskytex = GetSWTex(s->GetTexture(pos), false);
|
||||
if (frontskytex == nullptr)
|
||||
{ // [RH] The blank texture: Use normal sky instead.
|
||||
goto sky1;
|
||||
}
|
||||
|
@ -361,7 +369,7 @@ void PolySkySetup::Update()
|
|||
// allow old sky textures to be used.
|
||||
skyflip = l->args[2] ? false : true;
|
||||
|
||||
int frontxscale = int(frontskytex->Scale.X * 1024);
|
||||
int frontxscale = int(frontskytex->GetScale().X * 1024);
|
||||
frontcyl = MAX(frontskytex->GetWidth(), frontxscale);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ public:
|
|||
bool operator==(const PolySkySetup &that) const { return memcmp(this, &that, sizeof(PolySkySetup)) == 0; }
|
||||
bool operator!=(const PolySkySetup &that) const { return memcmp(this, &that, sizeof(PolySkySetup)) != 0; }
|
||||
|
||||
FTexture *frontskytex = nullptr;
|
||||
FTexture *backskytex = nullptr;
|
||||
FSoftwareTexture *frontskytex = nullptr;
|
||||
FSoftwareTexture *backskytex = nullptr;
|
||||
bool skyflip = 0;
|
||||
int frontpos = 0;
|
||||
int backpos = 0;
|
||||
|
@ -58,7 +58,7 @@ private:
|
|||
void CreateSkyHemisphere(bool zflip);
|
||||
void CreateDome();
|
||||
void RenderRow(PolyRenderThread *thread, PolyDrawArgs &args, int row, uint32_t capcolor, uint8_t capcolorindex);
|
||||
void RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args, FTexture *skytex, int row, bool bottomCap);
|
||||
void RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args, FSoftwareTexture *skytex, int row, bool bottomCap);
|
||||
|
||||
TriVertex SetVertexXYZ(float xx, float yy, float zz, float uu = 0, float vv = 0);
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@ bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
|
|||
DVector3 pos = thing->InterpolatedPosition(viewpoint.TicFrac);
|
||||
|
||||
bool flipTextureX = false;
|
||||
FTexture *tex = GetSpriteTexture(thing, flipTextureX);
|
||||
FSoftwareTexture *tex = GetSpriteTexture(thing, flipTextureX);
|
||||
if (tex == nullptr)
|
||||
return false;
|
||||
|
||||
DVector2 spriteScale = thing->Scale;
|
||||
double thingxscalemul = spriteScale.X / tex->Scale.X;
|
||||
double thingyscalemul = spriteScale.Y / tex->Scale.Y;
|
||||
double thingxscalemul = spriteScale.X / tex->GetScale().X;
|
||||
double thingyscalemul = spriteScale.Y / tex->GetScale().Y;
|
||||
|
||||
double spriteWidth = thingxscalemul * tex->GetWidth();
|
||||
double spriteHeight = thingyscalemul * tex->GetHeight();
|
||||
|
@ -105,11 +105,11 @@ void RenderPolySprite::Render(PolyRenderThread *thread, AActor *thing, subsector
|
|||
posZ += thing->GetBobOffset(viewpoint.TicFrac);
|
||||
|
||||
bool flipTextureX = false;
|
||||
FTexture *tex = GetSpriteTexture(thing, flipTextureX);
|
||||
if (tex == nullptr || tex->UseType == ETextureType::Null)
|
||||
FSoftwareTexture *tex = GetSpriteTexture(thing, flipTextureX);
|
||||
if (tex == nullptr)
|
||||
return;
|
||||
|
||||
double thingyscalemul = thing->Scale.Y / tex->Scale.Y;
|
||||
double thingyscalemul = thing->Scale.Y / tex->GetScale().Y;
|
||||
double spriteHeight = thingyscalemul * tex->GetHeight();
|
||||
|
||||
posZ -= (tex->GetHeight() - tex->GetTopOffsetPo()) * thingyscalemul;
|
||||
|
@ -302,7 +302,7 @@ bool RenderPolySprite::IsThingCulled(AActor *thing)
|
|||
return false;
|
||||
}
|
||||
|
||||
FTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX)
|
||||
FSoftwareTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX)
|
||||
{
|
||||
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
|
||||
flipX = false;
|
||||
|
@ -312,16 +312,17 @@ FTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX)
|
|||
|
||||
if (thing->picnum.isValid())
|
||||
{
|
||||
FTexture *tex = TexMan(thing->picnum);
|
||||
if (tex->UseType == ETextureType::Null)
|
||||
FTexture *ttex = TexMan(thing->picnum);
|
||||
if (!ttex || !ttex->isValid())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
FSoftwareTexture *tex = ttex->GetSoftwareTexture();
|
||||
|
||||
if (tex->Rotations != 0xFFFF)
|
||||
if (ttex->GetRotations() != 0xFFFF)
|
||||
{
|
||||
// choose a different rotation based on player view
|
||||
spriteframe_t *sprframe = &SpriteFrames[tex->Rotations];
|
||||
spriteframe_t *sprframe = &SpriteFrames[ttex->GetRotations()];
|
||||
DVector3 pos = thing->InterpolatedPosition(viewpoint.TicFrac);
|
||||
pos.Z += thing->GetBobOffset(viewpoint.TicFrac);
|
||||
DAngle ang = (pos - viewpoint.Pos).Angle();
|
||||
|
@ -335,7 +336,13 @@ FTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX)
|
|||
rot = (ang - thing->Angles.Yaw + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28;
|
||||
}
|
||||
flipX = (sprframe->Flip & (1 << rot)) != 0;
|
||||
tex = TexMan[sprframe->Texture[rot]]; // Do not animate the rotation
|
||||
ttex = TexMan[sprframe->Texture[rot]]; // Do not animate the rotation
|
||||
tex = ttex->GetSoftwareTexture();
|
||||
if (!ttex || !ttex->isValid())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
FSoftwareTexture *tex = ttex->GetSoftwareTexture();
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
@ -364,7 +371,7 @@ FTexture *RenderPolySprite::GetSpriteTexture(AActor *thing, /*out*/ bool &flipX)
|
|||
DAngle sprangle = thing->GetSpriteAngle((pos - viewpoint.Pos).Angle(), viewpoint.TicFrac);
|
||||
FTextureID tex = sprdef->GetSpriteFrame(thing->frame, -1, sprangle, &flipX);
|
||||
if (!tex.isValid()) return nullptr;
|
||||
return TexMan[tex];
|
||||
return TexMan[tex]->GetSoftwareTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
static bool GetLine(AActor *thing, DVector2 &left, DVector2 &right);
|
||||
static bool IsThingCulled(AActor *thing);
|
||||
static FTexture *GetSpriteTexture(AActor *thing, /*out*/ bool &flipX);
|
||||
static FSoftwareTexture *GetSpriteTexture(AActor *thing, /*out*/ bool &flipX);
|
||||
|
||||
private:
|
||||
static double PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, double spriteheight, double z);
|
||||
|
|
|
@ -172,7 +172,7 @@ bool RenderPolyWall::RenderLine(PolyRenderThread *thread, seg_t *line, sector_t
|
|||
wall.FogBoundary = IsFogBoundary(frontsector, backsector);
|
||||
|
||||
FTexture *midtex = TexMan(line->sidedef->GetTexture(side_t::mid), true);
|
||||
if ((midtex && midtex->UseType != ETextureType::Null) || wall.FogBoundary)
|
||||
if ((midtex && midtex->isValid()) || wall.FogBoundary)
|
||||
translucentWallsOutput.push_back(thread->FrameMemory->NewObject<PolyTranslucentWall>(wall));
|
||||
|
||||
if (polyportal)
|
||||
|
@ -526,10 +526,10 @@ void RenderPolyWall::ClampHeight(TriVertex &v1, TriVertex &v2)
|
|||
v2.v = texv1 * inv_t2 + texv2 * t2;
|
||||
}
|
||||
|
||||
FTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, side_t::ETexpart texpart)
|
||||
FSoftwareTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, side_t::ETexpart texpart)
|
||||
{
|
||||
FTexture *tex = TexMan(side->GetTexture(texpart), true);
|
||||
if (tex == nullptr || tex->UseType == ETextureType::Null)
|
||||
if (tex == nullptr || !tex->isValid())
|
||||
{
|
||||
// Mapping error. Doom floodfills this with a plane.
|
||||
// This code doesn't do that, but at least it uses the "right" texture..
|
||||
|
@ -549,10 +549,10 @@ FTexture *RenderPolyWall::GetTexture(const line_t *line, const side_t *side, sid
|
|||
tex = TexMan(line->frontsector->GetTexture(sector_t::floor), true);
|
||||
}
|
||||
|
||||
if (tex == nullptr || tex->UseType == ETextureType::Null)
|
||||
if (tex == nullptr || !tex->isValid())
|
||||
return nullptr;
|
||||
}
|
||||
return tex;
|
||||
return tex? tex->GetSoftwareTexture() : nullptr;
|
||||
}
|
||||
|
||||
int RenderPolyWall::GetLightLevel()
|
||||
|
@ -572,13 +572,13 @@ int RenderPolyWall::GetLightLevel()
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PolyWallTextureCoordsU::PolyWallTextureCoordsU(FTexture *tex, const seg_t *lineseg, const line_t *line, const side_t *side, side_t::ETexpart wallpart)
|
||||
PolyWallTextureCoordsU::PolyWallTextureCoordsU(FSoftwareTexture *tex, const seg_t *lineseg, const line_t *line, const side_t *side, side_t::ETexpart wallpart)
|
||||
{
|
||||
// Calculate the U texture coordinate for the line
|
||||
double lineu1 = side->GetTextureXOffset(wallpart);
|
||||
double lineu2 = side->GetTextureXOffset(wallpart) + line->sidedef[0]->TexelLength * side->GetTextureXScale(wallpart);
|
||||
lineu1 *= tex->Scale.X / tex->GetWidth();
|
||||
lineu2 *= tex->Scale.X / tex->GetWidth();
|
||||
lineu1 *= tex->GetScale().X / tex->GetWidth();
|
||||
lineu2 *= tex->GetScale().X / tex->GetWidth();
|
||||
|
||||
// Calculate where we are on the lineseg
|
||||
double t1, t2;
|
||||
|
@ -606,11 +606,11 @@ PolyWallTextureCoordsU::PolyWallTextureCoordsU(FTexture *tex, const seg_t *lines
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PolyWallTextureCoordsV::PolyWallTextureCoordsV(FTexture *tex, const line_t *line, const side_t *side, side_t::ETexpart wallpart, double topz, double bottomz, double unpeggedceil, double topTexZ, double bottomTexZ)
|
||||
PolyWallTextureCoordsV::PolyWallTextureCoordsV(FSoftwareTexture *tex, const line_t *line, const side_t *side, side_t::ETexpart wallpart, double topz, double bottomz, double unpeggedceil, double topTexZ, double bottomTexZ)
|
||||
{
|
||||
double yoffset = side->GetTextureYOffset(wallpart);
|
||||
if (tex->bWorldPanning)
|
||||
yoffset *= side->GetTextureYScale(wallpart) * tex->Scale.Y;
|
||||
if (tex->useWorldPanning())
|
||||
yoffset *= side->GetTextureYScale(wallpart) * tex->GetScale().Y;
|
||||
|
||||
switch (wallpart)
|
||||
{
|
||||
|
@ -626,8 +626,8 @@ PolyWallTextureCoordsV::PolyWallTextureCoordsV(FTexture *tex, const line_t *line
|
|||
break;
|
||||
}
|
||||
|
||||
v1 *= tex->Scale.Y / tex->GetHeight();
|
||||
v2 *= tex->Scale.Y / tex->GetHeight();
|
||||
v1 *= tex->GetScale().Y / tex->GetHeight();
|
||||
v2 *= tex->GetScale().Y / tex->GetHeight();
|
||||
|
||||
double texZHeight = (bottomTexZ - topTexZ);
|
||||
if (texZHeight > 0.0f || texZHeight < -0.0f)
|
||||
|
@ -641,12 +641,12 @@ PolyWallTextureCoordsV::PolyWallTextureCoordsV(FTexture *tex, const line_t *line
|
|||
}
|
||||
}
|
||||
|
||||
void PolyWallTextureCoordsV::CalcVTopPart(FTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset)
|
||||
void PolyWallTextureCoordsV::CalcVTopPart(FSoftwareTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset)
|
||||
{
|
||||
bool pegged = (line->flags & ML_DONTPEGTOP) == 0;
|
||||
if (pegged) // bottom to top
|
||||
{
|
||||
double texHeight = tex->GetHeight() / tex->Scale.Y;
|
||||
double texHeight = tex->GetHeight() / tex->GetScale().Y;
|
||||
v1 = (topz - bottomz) * side->GetTextureYScale(side_t::top) - yoffset;
|
||||
v2 = -yoffset;
|
||||
v1 = texHeight - v1;
|
||||
|
@ -659,7 +659,7 @@ void PolyWallTextureCoordsV::CalcVTopPart(FTexture *tex, const line_t *line, con
|
|||
}
|
||||
}
|
||||
|
||||
void PolyWallTextureCoordsV::CalcVMidPart(FTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset)
|
||||
void PolyWallTextureCoordsV::CalcVMidPart(FSoftwareTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset)
|
||||
{
|
||||
bool pegged = (line->flags & ML_DONTPEGBOTTOM) == 0;
|
||||
if (pegged) // top to bottom
|
||||
|
@ -669,7 +669,7 @@ void PolyWallTextureCoordsV::CalcVMidPart(FTexture *tex, const line_t *line, con
|
|||
}
|
||||
else // bottom to top
|
||||
{
|
||||
double texHeight = tex->GetHeight() / tex->Scale.Y;
|
||||
double texHeight = tex->GetHeight() / tex->GetScale().Y;
|
||||
v1 = yoffset - (topz - bottomz) * side->GetTextureYScale(side_t::mid);
|
||||
v2 = yoffset;
|
||||
v1 = texHeight + v1;
|
||||
|
@ -677,7 +677,7 @@ void PolyWallTextureCoordsV::CalcVMidPart(FTexture *tex, const line_t *line, con
|
|||
}
|
||||
}
|
||||
|
||||
void PolyWallTextureCoordsV::CalcVBottomPart(FTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double unpeggedceil, double yoffset)
|
||||
void PolyWallTextureCoordsV::CalcVBottomPart(FSoftwareTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double unpeggedceil, double yoffset)
|
||||
{
|
||||
bool pegged = (line->flags & ML_DONTPEGBOTTOM) == 0;
|
||||
if (pegged) // top to bottom
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
const line_t *LineSegLine = nullptr;
|
||||
const line_t *Line = nullptr;
|
||||
const side_t *Side = nullptr;
|
||||
FTexture *Texture = nullptr;
|
||||
FSoftwareTexture *Texture = nullptr;
|
||||
side_t::ETexpart Wallpart = side_t::mid;
|
||||
double TopTexZ = 0.0;
|
||||
double BottomTexZ = 0.0;
|
||||
|
@ -72,13 +72,13 @@ private:
|
|||
void SetDynLights(PolyRenderThread *thread, PolyDrawArgs &args);
|
||||
|
||||
static bool IsFogBoundary(sector_t *front, sector_t *back);
|
||||
static FTexture *GetTexture(const line_t *Line, const side_t *Side, side_t::ETexpart texpart);
|
||||
static FSoftwareTexture *GetTexture(const line_t *Line, const side_t *Side, side_t::ETexpart texpart);
|
||||
};
|
||||
|
||||
class PolyWallTextureCoordsU
|
||||
{
|
||||
public:
|
||||
PolyWallTextureCoordsU(FTexture *tex, const seg_t *lineseg, const line_t *linesegline, const side_t *side, side_t::ETexpart wallpart);
|
||||
PolyWallTextureCoordsU(FSoftwareTexture *tex, const seg_t *lineseg, const line_t *linesegline, const side_t *side, side_t::ETexpart wallpart);
|
||||
|
||||
double u1, u2;
|
||||
};
|
||||
|
@ -86,14 +86,14 @@ public:
|
|||
class PolyWallTextureCoordsV
|
||||
{
|
||||
public:
|
||||
PolyWallTextureCoordsV(FTexture *tex, const line_t *line, const side_t *side, side_t::ETexpart wallpart, double topz, double bottomz, double unpeggedceil, double topTexZ, double bottomTexZ);
|
||||
PolyWallTextureCoordsV(FSoftwareTexture *tex, const line_t *line, const side_t *side, side_t::ETexpart wallpart, double topz, double bottomz, double unpeggedceil, double topTexZ, double bottomTexZ);
|
||||
|
||||
double v1, v2;
|
||||
|
||||
private:
|
||||
void CalcVTopPart(FTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset);
|
||||
void CalcVMidPart(FTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset);
|
||||
void CalcVBottomPart(FTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double unpeggedceil, double yoffset);
|
||||
void CalcVTopPart(FSoftwareTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset);
|
||||
void CalcVMidPart(FSoftwareTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double yoffset);
|
||||
void CalcVBottomPart(FSoftwareTexture *tex, const line_t *line, const side_t *side, double topz, double bottomz, double unpeggedceil, double yoffset);
|
||||
};
|
||||
|
||||
class PolyTranslucentWall : public PolyTranslucentObject
|
||||
|
|
|
@ -40,13 +40,13 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, AActor *thing, subse
|
|||
pos.Z += thing->GetBobOffset(viewpoint.TicFrac);
|
||||
|
||||
bool flipTextureX = false;
|
||||
FTexture *tex = RenderPolySprite::GetSpriteTexture(thing, flipTextureX);
|
||||
if (tex == nullptr || tex->UseType == ETextureType::Null)
|
||||
FSoftwareTexture *tex = RenderPolySprite::GetSpriteTexture(thing, flipTextureX);
|
||||
if (tex == nullptr)
|
||||
return;
|
||||
|
||||
DVector2 spriteScale = thing->Scale;
|
||||
double thingxscalemul = spriteScale.X / tex->Scale.X;
|
||||
double thingyscalemul = spriteScale.Y / tex->Scale.Y;
|
||||
double thingxscalemul = spriteScale.X / tex->GetScale().X;
|
||||
double thingyscalemul = spriteScale.Y / tex->GetScale().Y;
|
||||
double spriteHeight = thingyscalemul * tex->GetHeight();
|
||||
|
||||
DAngle ang = thing->Angles.Yaw + 90;
|
||||
|
@ -91,8 +91,8 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, AActor *thing, subse
|
|||
vertices[i].y = (float)p.Y;
|
||||
vertices[i].z = (float)(pos.Z + spriteHeight * offsets[i].second);
|
||||
vertices[i].w = 1.0f;
|
||||
vertices[i].u = (float)(offsets[i].first * tex->Scale.X);
|
||||
vertices[i].v = (float)((1.0f - offsets[i].second) * tex->Scale.Y);
|
||||
vertices[i].u = (float)(offsets[i].first * tex->GetScale().X);
|
||||
vertices[i].v = (float)((1.0f - offsets[i].second) * tex->GetScale().Y);
|
||||
if (flipTextureX)
|
||||
vertices[i].u = 1.0f - vertices[i].u;
|
||||
}
|
||||
|
|
|
@ -652,13 +652,16 @@ bool I_SetCursor(FTexture* cursorpic)
|
|||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
NSCursor* cursor = nil;
|
||||
|
||||
if (NULL != cursorpic && ETextureType::Null != cursorpic->UseType)
|
||||
if (NULL != cursorpic && cursorpic->isValid())
|
||||
{
|
||||
// Create bitmap image representation
|
||||
|
||||
int w, h;
|
||||
auto sbuffer = cursorpic->CreateTexBuffer(0, w, h);
|
||||
|
||||
const NSInteger imageWidth = cursorpic->GetWidth();
|
||||
const NSInteger imageHeight = cursorpic->GetHeight();
|
||||
const NSInteger imagePitch = imageWidth * 4;
|
||||
const NSInteger imageWidth = w;
|
||||
const NSInteger imageHeight = h;
|
||||
const NSInteger imagePitch = w * 4;
|
||||
|
||||
NSBitmapImageRep* bitmapImageRep = [NSBitmapImageRep alloc];
|
||||
[bitmapImageRep initWithBitmapDataPlanes:NULL
|
||||
|
@ -675,20 +678,15 @@ bool I_SetCursor(FTexture* cursorpic)
|
|||
// Load bitmap data to representation
|
||||
|
||||
uint8_t* buffer = [bitmapImageRep bitmapData];
|
||||
memset(buffer, 0, imagePitch * imageHeight);
|
||||
|
||||
FBitmap bitmap(buffer, imagePitch, imageWidth, imageHeight);
|
||||
cursorpic->CopyTrueColorPixels(&bitmap, 0, 0);
|
||||
memcpy(buffer, sbuffer, imagePitch * imageHeight);
|
||||
delete [] sbuffer;
|
||||
|
||||
// Swap red and blue components in each pixel
|
||||
|
||||
for (size_t i = 0; i < size_t(imageWidth * imageHeight); ++i)
|
||||
{
|
||||
const size_t offset = i * 4;
|
||||
|
||||
const uint8_t temp = buffer[offset ];
|
||||
buffer[offset ] = buffer[offset + 2];
|
||||
buffer[offset + 2] = temp;
|
||||
std::swap(buffer[offset ], buffer[offset + 2]);
|
||||
}
|
||||
|
||||
// Create image from representation and set it as cursor
|
||||
|
|
|
@ -73,9 +73,7 @@ static void ParseVavoomSkybox()
|
|||
int facecount=0;
|
||||
int maplump = -1;
|
||||
bool error = false;
|
||||
FSkyBox * sb = new FSkyBox;
|
||||
sb->Name = sc.String;
|
||||
sb->Name.ToUpper();
|
||||
FSkyBox * sb = new FSkyBox(sc.String);
|
||||
sb->fliptop = true;
|
||||
sc.MustGetStringName("{");
|
||||
while (!sc.CheckString("}"))
|
||||
|
@ -91,7 +89,7 @@ static void ParseVavoomSkybox()
|
|||
FTexture *tex = TexMan.FindTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
|
||||
if (tex == NULL)
|
||||
{
|
||||
sc.ScriptMessage("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name.GetChars());
|
||||
sc.ScriptMessage("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->GetName().GetChars());
|
||||
error = true;
|
||||
}
|
||||
sb->faces[facecount] = tex;
|
||||
|
@ -101,7 +99,7 @@ static void ParseVavoomSkybox()
|
|||
}
|
||||
if (facecount != 6)
|
||||
{
|
||||
sc.ScriptError("%s: Skybox definition requires 6 faces", sb->Name.GetChars());
|
||||
sc.ScriptError("%s: Skybox definition requires 6 faces", sb->GetName().GetChars());
|
||||
}
|
||||
sb->SetSize();
|
||||
if (!error) TexMan.AddTexture(sb);
|
||||
|
@ -1140,14 +1138,6 @@ class GLDefsParser
|
|||
|
||||
if (bmtex != NULL)
|
||||
{
|
||||
/* I do not think this is needed any longer
|
||||
if (tex->bWarped != 0)
|
||||
{
|
||||
Printf("Cannot combine warping with brightmap on texture '%s'\n", tex->Name.GetChars());
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
bmtex->bMasked = false;
|
||||
tex->Brightmap = bmtex;
|
||||
}
|
||||
|
@ -1367,7 +1357,7 @@ class GLDefsParser
|
|||
usershader.defines.AppendFormat("#define %s texture%d\n", texNameList[i].GetChars(), texNameIndex[i] + firstUserTexture);
|
||||
}
|
||||
|
||||
if (tex->bWarped != 0)
|
||||
if (tex->isWarped() != 0)
|
||||
{
|
||||
Printf("Cannot combine warping with hardware shader on texture '%s'\n", tex->Name.GetChars());
|
||||
return;
|
||||
|
@ -1608,7 +1598,7 @@ class GLDefsParser
|
|||
|
||||
if (desc.shader.IsNotEmpty())
|
||||
{
|
||||
if (tex->bWarped != 0)
|
||||
if (tex->isWarped() != 0)
|
||||
{
|
||||
Printf("Cannot combine warping with hardware shader on texture '%s'\n", tex->Name.GetChars());
|
||||
return;
|
||||
|
|
|
@ -122,7 +122,7 @@ static bool R_InstallSpriteLump (FTextureID lump, unsigned frame, char rot, bool
|
|||
|
||||
if (frame >= MAX_SPRITE_FRAMES || rotation > 16)
|
||||
{
|
||||
Printf (TEXTCOLOR_RED "R_InstallSpriteLump: Bad frame characters in lump %s\n", TexMan[lump]->Name.GetChars());
|
||||
Printf (TEXTCOLOR_RED "R_InstallSpriteLump: Bad frame characters in lump %s\n", TexMan[lump]->GetName().GetChars());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ static bool R_InstallSpriteLump (FTextureID lump, unsigned frame, char rot, bool
|
|||
|
||||
|
||||
// [RH] Seperated out of R_InitSpriteDefs()
|
||||
static void R_InstallSprite (int num, spriteframewithrotate *sprtemp, int &maxframe)
|
||||
void R_InstallSprite (int num, spriteframewithrotate *sprtemp, int &maxframe)
|
||||
{
|
||||
int frame;
|
||||
int framestart;
|
||||
|
|
|
@ -100,7 +100,7 @@ void R_InitSkyMap ()
|
|||
if (skytex1 == nullptr)
|
||||
return;
|
||||
|
||||
if ((level.flags & LEVEL_DOUBLESKY) && skytex1->GetHeight() != skytex2->GetHeight())
|
||||
if ((level.flags & LEVEL_DOUBLESKY) && skytex1->GetDisplayHeight() != skytex2->GetDisplayHeight())
|
||||
{
|
||||
Printf (TEXTCOLOR_BOLD "Both sky textures must be the same height." TEXTCOLOR_NORMAL "\n");
|
||||
sky2texture = sky1texture;
|
||||
|
@ -119,20 +119,30 @@ void R_InitSkyMap ()
|
|||
// the screen when looking fully up.
|
||||
// h > 200: Unstretched, but the baseline is shifted down so that the top
|
||||
// of the texture is at the top of the screen when looking fully up.
|
||||
skyheight = skytex1->GetScaledHeight();
|
||||
skystretch = false;
|
||||
skytexturemid = 0;
|
||||
skyheight = skytex1->GetDisplayHeight();
|
||||
|
||||
if (skyheight >= 128 && skyheight < 200)
|
||||
{
|
||||
skystretch = (r_skymode == 1
|
||||
&& skyheight >= 128
|
||||
&& level.IsFreelookAllowed()
|
||||
&& !(level.flags & LEVEL_FORCETILEDSKY)) ? 1 : 0;
|
||||
}
|
||||
else skystretch = false;
|
||||
|
||||
// Anything below is only for the software renderer (todo - move it there!)
|
||||
// Note: I don't think it is good that this stuff gets cached globally.
|
||||
// For something that only needs to be once per frame it is rather pointless and makes it hard to swap out the underlying textures based on user settings.
|
||||
FSoftwareTexture *sskytex1 = skytex1->GetSoftwareTexture();
|
||||
FSoftwareTexture *sskytex2 = skytex2->GetSoftwareTexture();
|
||||
skytexturemid = 0;
|
||||
if (skyheight >= 128 && skyheight < 200)
|
||||
{
|
||||
skytexturemid = -28;
|
||||
}
|
||||
else if (skyheight > 200)
|
||||
{
|
||||
skytexturemid = (200 - skyheight) * skytex1->Scale.Y +((r_skymode == 2 && !(level.flags & LEVEL_FORCETILEDSKY)) ? skytex1->SkyOffset + testskyoffset : 0);
|
||||
skytexturemid = (200 - skyheight) * sskytex1->GetScale().Y +((r_skymode == 2 && !(level.flags & LEVEL_FORCETILEDSKY)) ? skytex1->GetSkyOffset() + testskyoffset : 0);
|
||||
}
|
||||
|
||||
if (viewwidth != 0 && viewheight != 0)
|
||||
|
@ -155,8 +165,8 @@ void R_InitSkyMap ()
|
|||
// giving a total sky width of 1024 pixels. So if the sky texture is no wider than 1024,
|
||||
// we map it to a cylinder with circumfrence 1024. For larger ones, we use the width of
|
||||
// the texture as the cylinder's circumfrence.
|
||||
sky1cyl = MAX(skytex1->GetWidth(), fixed_t(skytex1->Scale.X * 1024));
|
||||
sky2cyl = MAX(skytex2->GetWidth(), fixed_t(skytex2->Scale.Y * 1024));
|
||||
sky1cyl = MAX(sskytex1->GetWidth(), fixed_t(sskytex1->GetScale().X * 1024));
|
||||
sky2cyl = MAX(sskytex2->GetWidth(), fixed_t(sskytex2->GetScale().Y * 1024));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1108,7 +1108,7 @@ void SetCameraToTexture(AActor *viewpoint, const FString &texturename, double fo
|
|||
{
|
||||
// Only proceed if the texture actually has a canvas.
|
||||
FTexture *tex = TexMan[textureid];
|
||||
if (tex && tex->bHasCanvas)
|
||||
if (tex && tex->isCanvas())
|
||||
{
|
||||
FCanvasTextureInfo::Add(viewpoint, textureid, fov);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %0
|
|||
static int CastS2So(FString *b) { return FSoundID(*b); }
|
||||
static void CastSo2S(FString *a, int b) { *a = S_sfx[b].name; }
|
||||
static void CastSID2S(FString *a, unsigned int b) { *a = (b >= sprites.Size()) ? "TNT1" : sprites[b].name; }
|
||||
static void CastTID2S(FString *a, int b) { auto tex = TexMan[*(FTextureID*)&b]; *a = (tex == nullptr) ? "(null)" : tex->Name.GetChars(); }
|
||||
static void CastTID2S(FString *a, int b) { auto tex = TexMan[*(FTextureID*)&b]; *a = (tex == nullptr) ? "(null)" : tex->GetName().GetChars(); }
|
||||
|
||||
void JitCompiler::EmitCAST()
|
||||
{
|
||||
|
|
|
@ -1875,7 +1875,7 @@ static void DoCast(const VMRegisters ®, const VMFrame *f, int a, int b, int c
|
|||
{
|
||||
ASSERTS(a); ASSERTD(b);
|
||||
auto tex = TexMan[*(FTextureID*)&(reg.d[b])];
|
||||
reg.s[a] = tex == nullptr ? "(null)" : tex->Name.GetChars();
|
||||
reg.s[a] = tex == nullptr ? "(null)" : tex->GetName().GetChars();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -2372,7 +2372,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DBaseStatusBar, ReceivedWeapon, ReceivedWeapon)
|
|||
static int GetMugshot(DBaseStatusBar *self, int accuracy, int stateflags, const FString &def_face)
|
||||
{
|
||||
auto tex = self->mugshot.GetFace(self->CPlayer, def_face, accuracy, (FMugShot::StateFlags)stateflags);
|
||||
return (tex ? tex->id.GetIndex() : -1);
|
||||
return (tex ? tex->GetID().GetIndex() : -1);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBaseStatusBar, GetMugshot, GetMugshot)
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace swrenderer
|
|||
std::unique_lock<std::mutex> lock(loadmutex);
|
||||
|
||||
texture->GetPixels(style);
|
||||
const FTexture::Span *spans;
|
||||
const FSoftwareTextureSpan *spans;
|
||||
texture->GetColumn(style, 0, &spans);
|
||||
if (Viewport->RenderTarget->IsBgra())
|
||||
{
|
||||
|
|
|
@ -88,7 +88,7 @@ void FSoftwareRenderer::PrecacheTexture(FTexture *tex, int cache)
|
|||
{
|
||||
if (cache & FTextureManager::HIT_Columnmode)
|
||||
{
|
||||
const FTexture::Span *spanp;
|
||||
const FSoftwareTextureSpan *spanp;
|
||||
if (isbgra)
|
||||
tex->GetColumnBgra(0, &spanp);
|
||||
else
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace swrenderer
|
|||
fixed_t xscale = 0;
|
||||
float yscale = 0.0f;
|
||||
|
||||
FTexture *pic = nullptr;
|
||||
FSoftwareTexture *pic = nullptr;
|
||||
|
||||
fixed_t xiscale = 0;
|
||||
fixed_t startfrac = 0;
|
||||
|
|
|
@ -62,14 +62,14 @@ namespace swrenderer
|
|||
dc_iscale = iscale;
|
||||
dc_textureheight = tex->GetHeight();
|
||||
|
||||
const FTexture::Span *span;
|
||||
const FSoftwareTextureSpan *span;
|
||||
const uint8_t *column;
|
||||
if (viewport->RenderTarget->IsBgra() && !drawer_needs_pal_input)
|
||||
column = (const uint8_t *)tex->GetColumnBgra(col >> FRACBITS, &span);
|
||||
else
|
||||
column = tex->GetColumn(style, col >> FRACBITS, &span);
|
||||
|
||||
FTexture::Span unmaskedSpan[2];
|
||||
FSoftwareTextureSpan unmaskedSpan[2];
|
||||
if (unmasked)
|
||||
{
|
||||
span = unmaskedSpan;
|
||||
|
@ -192,9 +192,9 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
// Grab the posts we need to draw
|
||||
const FTexture::Span *span;
|
||||
const FSoftwareTextureSpan *span;
|
||||
tex->GetColumnBgra(col >> FRACBITS, &span);
|
||||
FTexture::Span unmaskedSpan[2];
|
||||
FSoftwareTextureSpan unmaskedSpan[2];
|
||||
if (unmasked)
|
||||
{
|
||||
span = unmaskedSpan;
|
||||
|
|
|
@ -224,7 +224,7 @@ void FTextureManager::InitAnimated (void)
|
|||
(anim_p[21] << 16) | (anim_p[22] << 24);
|
||||
|
||||
// SMMU-style swirly hack? Don't apply on already-warping texture
|
||||
if (animspeed > 65535 && tex1 != NULL && !tex1->bWarped)
|
||||
if (animspeed > 65535 && tex1 != NULL && !tex1->isWarped())
|
||||
{
|
||||
FTexture *warper = new FWarpTexture (tex1, 2);
|
||||
ReplaceTexture (pic1, warper, false);
|
||||
|
@ -622,7 +622,7 @@ void FTextureManager::ParseWarp(FScanner &sc)
|
|||
|
||||
|
||||
// don't warp a texture more than once
|
||||
if (!warper->bWarped)
|
||||
if (!warper->isWarped())
|
||||
{
|
||||
warper = new FWarpTexture (warper, type2? 2:1);
|
||||
ReplaceTexture (picnum, warper, false);
|
||||
|
|
|
@ -61,7 +61,7 @@ FCanvasTexture::~FCanvasTexture ()
|
|||
Unload ();
|
||||
}
|
||||
|
||||
const uint8_t *FCanvasTexture::GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out)
|
||||
const uint8_t *FCanvasTexture::GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
bNeedsUpdate = true;
|
||||
if (Canvas == NULL)
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
|
||||
protected:
|
||||
uint8_t *Pixels;
|
||||
Span **Spans;
|
||||
FSoftwareTextureSpan **Spans;
|
||||
int DefinitionLump;
|
||||
|
||||
struct TexPart
|
||||
|
@ -199,7 +199,7 @@ protected:
|
|||
|
||||
// The getters must optionally redirect if it's a simple one-patch texture.
|
||||
const uint8_t *GetPixels(FRenderStyle style) override { return bRedirect ? Parts->Texture->GetPixels(style) : FWorldTexture::GetPixels(style); }
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int col, const Span **out) override
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int col, const FSoftwareTextureSpan **out) override
|
||||
{ return bRedirect ? Parts->Texture->GetColumn(style, col, out) : FWorldTexture::GetColumn(style, col, out); }
|
||||
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void FWorldTexture::Unload ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
const uint8_t *FWorldTexture::GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out)
|
||||
const uint8_t *FWorldTexture::GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
int index = !!(style.Flags & STYLEF_RedIsAlpha);
|
||||
GetPixels(style);
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
FSkyBox::FSkyBox()
|
||||
FSkyBox::FSkyBox(const char *name)
|
||||
: FTexture(name)
|
||||
{
|
||||
faces[0]=faces[1]=faces[2]=faces[3]=faces[4]=faces[5]=NULL;
|
||||
UseType = ETextureType::Override;
|
||||
|
@ -58,7 +59,7 @@ FSkyBox::~FSkyBox()
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const uint8_t *FSkyBox::GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out)
|
||||
const uint8_t *FSkyBox::GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
if (faces[0]) return faces[0]->GetColumn(style, column, spans_out);
|
||||
return NULL;
|
||||
|
|
|
@ -15,9 +15,9 @@ public:
|
|||
FTexture * faces[6];
|
||||
bool fliptop;
|
||||
|
||||
FSkyBox();
|
||||
FSkyBox(const char *name = nullptr);
|
||||
~FSkyBox();
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out);
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out);
|
||||
const uint8_t *GetPixels (FRenderStyle style);
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf);
|
||||
bool UseBasePalette();
|
||||
|
@ -27,9 +27,7 @@ public:
|
|||
{
|
||||
if (faces[0])
|
||||
{
|
||||
Width=faces[0]->GetWidth();
|
||||
Height=faces[0]->GetHeight();
|
||||
CalcBitSize();
|
||||
CopySize(faces[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ void FTexture::Unload()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
const uint32_t *FTexture::GetColumnBgra(unsigned int column, const Span **spans_out)
|
||||
const uint32_t *FTexture::GetColumnBgra(unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
const uint32_t *pixels = GetPixelsBgra();
|
||||
if (pixels == nullptr) return nullptr;
|
||||
|
@ -327,14 +327,14 @@ void FTexture::CalcBitSize ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture::Span **FTexture::CreateSpans (const uint8_t *pixels) const
|
||||
FSoftwareTextureSpan **FTexture::CreateSpans (const uint8_t *pixels) const
|
||||
{
|
||||
Span **spans, *span;
|
||||
FSoftwareTextureSpan **spans, *span;
|
||||
|
||||
if (!bMasked)
|
||||
{ // Texture does not have holes, so it can use a simpler span structure
|
||||
spans = (Span **)M_Malloc (sizeof(Span*)*Width + sizeof(Span)*2);
|
||||
span = (Span *)&spans[Width];
|
||||
spans = (FSoftwareTextureSpan **)M_Malloc (sizeof(FSoftwareTextureSpan*)*Width + sizeof(FSoftwareTextureSpan)*2);
|
||||
span = (FSoftwareTextureSpan *)&spans[Width];
|
||||
for (int x = 0; x < Width; ++x)
|
||||
{
|
||||
spans[x] = span;
|
||||
|
@ -378,10 +378,10 @@ FTexture::Span **FTexture::CreateSpans (const uint8_t *pixels) const
|
|||
}
|
||||
|
||||
// Allocate space for the spans
|
||||
spans = (Span **)M_Malloc (sizeof(Span*)*numcols + sizeof(Span)*numspans);
|
||||
spans = (FSoftwareTextureSpan **)M_Malloc (sizeof(FSoftwareTextureSpan*)*numcols + sizeof(FSoftwareTextureSpan)*numspans);
|
||||
|
||||
// Fill in the spans
|
||||
for (x = 0, span = (Span *)&spans[numcols], data_p = pixels; x < numcols; ++x)
|
||||
for (x = 0, span = (FSoftwareTextureSpan *)&spans[numcols], data_p = pixels; x < numcols; ++x)
|
||||
{
|
||||
newspan = true;
|
||||
spans[x] = span;
|
||||
|
@ -421,7 +421,7 @@ FTexture::Span **FTexture::CreateSpans (const uint8_t *pixels) const
|
|||
return spans;
|
||||
}
|
||||
|
||||
void FTexture::FreeSpans (Span **spans) const
|
||||
void FTexture::FreeSpans (FSoftwareTextureSpan **spans) const
|
||||
{
|
||||
M_Free (spans);
|
||||
}
|
||||
|
@ -996,29 +996,22 @@ PalEntry FTexture::GetSkyCapColor(bool bottom)
|
|||
|
||||
int FTexture::CheckRealHeight()
|
||||
{
|
||||
const FTexture::Span *span;
|
||||
int maxy = 0, miny = GetHeight();
|
||||
|
||||
for (int i = 0; i < GetWidth(); ++i)
|
||||
auto pixels = GetPixels(DefaultRenderStyle());
|
||||
|
||||
for(int h = GetHeight()-1; h>= 0; h--)
|
||||
{
|
||||
GetColumn(DefaultRenderStyle(), i, &span);
|
||||
while (span->Length != 0)
|
||||
for(int w = 0; w < GetWidth(); w++)
|
||||
{
|
||||
if (span->TopOffset < miny)
|
||||
if (pixels[h + w * GetHeight()] != 0)
|
||||
{
|
||||
miny = span->TopOffset;
|
||||
// Scale maxy before returning it
|
||||
h = int((h * 2) / Scale.Y);
|
||||
h = (h >> 1) + (h & 1);
|
||||
return h;
|
||||
}
|
||||
if (span->TopOffset + span->Length > maxy)
|
||||
{
|
||||
maxy = span->TopOffset + span->Length;
|
||||
}
|
||||
span++;
|
||||
}
|
||||
}
|
||||
// Scale maxy before returning it
|
||||
maxy = int((maxy * 2) / Scale.Y);
|
||||
maxy = (maxy >> 1) + (maxy & 1);
|
||||
return maxy;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1461,7 +1454,7 @@ void FTexture::SetSpriteAdjust()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
const uint8_t *FTexture::GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out)
|
||||
const uint8_t *FTexture::GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1511,43 +1504,6 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
|
|||
SystemTexture[0] = screen->CreateHardwareTexture(this);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Debug stuff
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Prints the spans generated for a texture. Only needed for debugging.
|
||||
CCMD (printspans)
|
||||
{
|
||||
if (argv.argc() != 2)
|
||||
return;
|
||||
|
||||
FTextureID picnum = TexMan.CheckForTexture (argv[1], ETextureType::Any);
|
||||
if (!picnum.Exists())
|
||||
{
|
||||
Printf ("Unknown texture %s\n", argv[1]);
|
||||
return;
|
||||
}
|
||||
FTexture *tex = TexMan[picnum];
|
||||
for (int x = 0; x < tex->GetWidth(); ++x)
|
||||
{
|
||||
const FTexture::Span *spans;
|
||||
Printf ("%4d:", x);
|
||||
tex->GetColumn(DefaultRenderStyle(), x, &spans);
|
||||
while (spans->Length != 0)
|
||||
{
|
||||
Printf (" (%4d,%4d)", spans->TopOffset, spans->TopOffset+spans->Length-1);
|
||||
spans++;
|
||||
}
|
||||
Printf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Coordinate helper.
|
||||
|
|
|
@ -211,10 +211,40 @@ enum FTextureFormat : uint32_t
|
|||
TEX_Count
|
||||
};
|
||||
|
||||
class FSoftwareTexture;
|
||||
class FGLRenderState;
|
||||
|
||||
struct FSoftwareTextureSpan
|
||||
{
|
||||
uint16_t TopOffset;
|
||||
uint16_t Length; // A length of 0 terminates this column
|
||||
};
|
||||
|
||||
struct spriteframewithrotate;
|
||||
class FSerializer;
|
||||
|
||||
// Base texture class
|
||||
class FTexture
|
||||
{
|
||||
// This is initialization code that is allowed to have full access.
|
||||
friend void R_InitSpriteDefs ();
|
||||
friend void R_InstallSprite (int num, spriteframewithrotate *sprtemp, int &maxframe);
|
||||
friend class GLDefsParser;
|
||||
|
||||
// The serializer also needs access to more specific info that shouldn't be accessible through the interface.
|
||||
friend FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTextureID *defval);
|
||||
|
||||
// For now only give access to classes which cannot be reworked yet. None of these should remain here when all is done.
|
||||
friend class FSoftwareTexture;
|
||||
friend class FWarpTexture;
|
||||
friend class FMaterial;
|
||||
friend class FGLRenderState; // For now this needs access to some fields in ApplyMaterial. This should be rerouted through the Material class
|
||||
friend struct FTexCoordInfo;
|
||||
friend class FHardwareTexture;
|
||||
friend class FMultiPatchTexture;
|
||||
friend class FSkyBox;
|
||||
friend void RecordTextureColors (FTexture *pic, uint8_t *usedcolors);
|
||||
|
||||
|
||||
public:
|
||||
static FTexture *CreateTexture(const char *name, int lumpnum, ETextureType usetype);
|
||||
|
@ -223,6 +253,61 @@ public:
|
|||
void AddAutoMaterials();
|
||||
unsigned char *CreateUpsampledTextureBuffer(unsigned char *inputBuffer, const int inWidth, const int inHeight, int &outWidth, int &outHeight, bool hasAlpha);
|
||||
|
||||
// These should only be used in places where the texture scaling must be ignored and absolutely nowhere else!
|
||||
// Preferably all code depending on the physical texture size should be rewritten, unless it is part of the software rasterizer.
|
||||
//int GetPixelWidth() { return GetWidth(); }
|
||||
//int GetPixelHeight() { return GetHeight(); }
|
||||
|
||||
// These are mainly meant for 2D code which only needs logical information about the texture to position it properly.
|
||||
int GetDisplayWidth() { return GetScaledWidth(); }
|
||||
int GetDisplayHeight() { return GetScaledHeight(); }
|
||||
double GetDisplayWidthDouble() { return GetScaledWidthDouble(); }
|
||||
double GetDisplayHeightDouble() { return GetScaledHeightDouble(); }
|
||||
int GetDisplayLeftOffset() { return GetScaledLeftOffset(0); }
|
||||
int GetDisplayTopOffset() { return GetScaledTopOffset(0); }
|
||||
double GetDisplayLeftOffsetDouble() { return GetScaledLeftOffsetDouble(0); }
|
||||
double GetDisplayTopOffsetDouble() { return GetScaledTopOffsetDouble(0); }
|
||||
|
||||
|
||||
bool isValid() const { return UseType != ETextureType::Null; }
|
||||
bool isSWCanvas() const { return UseType == ETextureType::SWCanvas; }
|
||||
bool isSkybox() const { return bSkybox; }
|
||||
bool isFullbrightDisabled() const { return bDisableFullbright; }
|
||||
bool isHardwareCanvas() const { return bHasCanvas; } // There's two here so that this can deal with software canvases in the hardware renderer later.
|
||||
bool isCanvas() const { return bHasCanvas; }
|
||||
int isWarped() const { return bWarped; }
|
||||
int GetRotations() const { return Rotations; }
|
||||
void SetRotations(int rot) { Rotations = int16_t(rot); }
|
||||
|
||||
const FString &GetName() const { return Name; }
|
||||
bool allowNoDecals() const { return bNoDecals; }
|
||||
bool isScaled() const { return Scale.X != 1 || Scale.Y != 1; }
|
||||
int GetSkyOffset() const { return SkyOffset; }
|
||||
FTextureID GetID() const { return id; }
|
||||
PalEntry GetSkyCapColor(bool bottom);
|
||||
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
|
||||
void GetGlowColor(float *data);
|
||||
bool isGlowing() const { return bGlowing; }
|
||||
bool isAutoGlowing() const { return bAutoGlowing; }
|
||||
int GetGlowHeight() const { return GlowHeight; }
|
||||
bool isFullbright() const { return bFullbright; }
|
||||
void CreateDefaultBrightmap();
|
||||
bool FindHoles(const unsigned char * buffer, int w, int h);
|
||||
|
||||
public:
|
||||
static void FlipSquareBlock (uint8_t *block, int x, int y);
|
||||
static void FlipSquareBlockBgra (uint32_t *block, int x, int y);
|
||||
static void FlipSquareBlockRemap (uint8_t *block, int x, int y, const uint8_t *remap);
|
||||
static void FlipNonSquareBlock (uint8_t *blockto, const uint8_t *blockfrom, int x, int y, int srcpitch);
|
||||
static void FlipNonSquareBlockBgra (uint32_t *blockto, const uint32_t *blockfrom, int x, int y, int srcpitch);
|
||||
static void FlipNonSquareBlockRemap (uint8_t *blockto, const uint8_t *blockfrom, int x, int y, int srcpitch, const uint8_t *remap);
|
||||
static bool SmoothEdges(unsigned char * buffer,int w, int h);
|
||||
static PalEntry averageColor(const uint32_t *data, int size, int maxout);
|
||||
|
||||
|
||||
FSoftwareTexture *GetSoftwareTexture();
|
||||
|
||||
protected:
|
||||
//int16_t LeftOffset, TopOffset;
|
||||
|
||||
uint8_t WidthBits, HeightBits;
|
||||
|
@ -234,6 +319,7 @@ public:
|
|||
|
||||
FMaterial *Material[2] = { nullptr, nullptr };
|
||||
IHardwareTexture *SystemTexture[2] = { nullptr, nullptr };
|
||||
FSoftwareTexture *SoftwareTexture;
|
||||
|
||||
// None of the following pointers are owned by this texture, they are all controlled by the texture manager.
|
||||
|
||||
|
@ -292,17 +378,11 @@ public:
|
|||
|
||||
|
||||
|
||||
struct Span
|
||||
{
|
||||
uint16_t TopOffset;
|
||||
uint16_t Length; // A length of 0 terminates this column
|
||||
};
|
||||
|
||||
// Returns a single column of the texture
|
||||
virtual const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out);
|
||||
virtual const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out);
|
||||
|
||||
// Returns a single column of the texture, in BGRA8 format
|
||||
virtual const uint32_t *GetColumnBgra(unsigned int column, const Span **spans_out);
|
||||
virtual const uint32_t *GetColumnBgra(unsigned int column, const FSoftwareTextureSpan **spans_out);
|
||||
|
||||
// Returns the whole texture, stored in column-major order
|
||||
virtual const uint8_t *GetPixels(FRenderStyle style);
|
||||
|
@ -318,7 +398,6 @@ public:
|
|||
virtual bool UseBasePalette();
|
||||
virtual int GetSourceLump() { return SourceLump; }
|
||||
virtual FTexture *GetRedirect();
|
||||
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
|
||||
|
||||
virtual void Unload ();
|
||||
|
||||
|
@ -392,8 +471,6 @@ public:
|
|||
}
|
||||
|
||||
void SetScaledSize(int fitwidth, int fitheight);
|
||||
PalEntry GetSkyCapColor(bool bottom);
|
||||
static PalEntry averageColor(const uint32_t *data, int size, int maxout);
|
||||
|
||||
protected:
|
||||
uint16_t Width, Height, WidthMask;
|
||||
|
@ -448,8 +525,8 @@ protected:
|
|||
|
||||
FTexture (const char *name = NULL, int lumpnum = -1);
|
||||
|
||||
Span **CreateSpans (const uint8_t *pixels) const;
|
||||
void FreeSpans (Span **spans) const;
|
||||
FSoftwareTextureSpan **CreateSpans (const uint8_t *pixels) const;
|
||||
void FreeSpans (FSoftwareTextureSpan **spans) const;
|
||||
void CalcBitSize ();
|
||||
void CopyInfo(FTexture *other)
|
||||
{
|
||||
|
@ -481,21 +558,7 @@ private:
|
|||
PalEntry CeilingSkyColor;
|
||||
|
||||
public:
|
||||
static void FlipSquareBlock (uint8_t *block, int x, int y);
|
||||
static void FlipSquareBlockBgra (uint32_t *block, int x, int y);
|
||||
static void FlipSquareBlockRemap (uint8_t *block, int x, int y, const uint8_t *remap);
|
||||
static void FlipNonSquareBlock (uint8_t *blockto, const uint8_t *blockfrom, int x, int y, int srcpitch);
|
||||
static void FlipNonSquareBlockBgra (uint32_t *blockto, const uint32_t *blockfrom, int x, int y, int srcpitch);
|
||||
static void FlipNonSquareBlockRemap (uint8_t *blockto, const uint8_t *blockfrom, int x, int y, int srcpitch, const uint8_t *remap);
|
||||
|
||||
public:
|
||||
|
||||
void GetGlowColor(float *data);
|
||||
bool isGlowing() { return bGlowing; }
|
||||
bool isFullbright() { return bFullbright; }
|
||||
void CreateDefaultBrightmap();
|
||||
bool FindHoles(const unsigned char * buffer, int w, int h);
|
||||
static bool SmoothEdges(unsigned char * buffer,int w, int h);
|
||||
void CheckTrans(unsigned char * buffer, int size, int trans);
|
||||
bool ProcessData(unsigned char * buffer, int w, int h, bool ispatch);
|
||||
int CheckRealHeight();
|
||||
|
@ -504,6 +567,100 @@ public:
|
|||
friend class FTextureManager;
|
||||
};
|
||||
|
||||
// For now this is just a minimal wrapper around FTexture. Once the software renderer no longer accesses FTexture directly, it is time for cleaning up.
|
||||
class FSoftwareTexture
|
||||
{
|
||||
FTexture *mTexture;
|
||||
|
||||
|
||||
public:
|
||||
FSoftwareTexture(FTexture *tex)
|
||||
{
|
||||
mTexture = tex;
|
||||
}
|
||||
|
||||
FTexture *GetTexture() const
|
||||
{
|
||||
return mTexture;
|
||||
}
|
||||
|
||||
// The feature from hell... :(
|
||||
bool useWorldPanning() const
|
||||
{
|
||||
return mTexture->bWorldPanning;
|
||||
}
|
||||
|
||||
bool UseBasePalette() const { return mTexture->UseBasePalette(); }
|
||||
int GetSkyOffset() const { return mTexture->GetSkyOffset(); }
|
||||
PalEntry GetSkyCapColor(bool bottom) const { return mTexture->GetSkyCapColor(bottom); }
|
||||
|
||||
int GetWidth () { return mTexture->GetWidth(); }
|
||||
int GetHeight () { return mTexture->GetHeight(); }
|
||||
|
||||
int GetScaledWidth () { return mTexture->GetScaledWidth(); }
|
||||
int GetScaledHeight () { return mTexture->GetScaledHeight(); }
|
||||
double GetScaledWidthDouble () { return mTexture->GetScaledWidthDouble(); }
|
||||
double GetScaledHeightDouble () { return mTexture->GetScaledHeightDouble(); }
|
||||
double GetScaleY() const { return mTexture->GetScaleY(); }
|
||||
|
||||
// Now with improved offset adjustment.
|
||||
int GetLeftOffset(int adjusted) { return mTexture->GetLeftOffset(adjusted); }
|
||||
int GetTopOffset(int adjusted) { return mTexture->GetTopOffset(adjusted); }
|
||||
int GetScaledLeftOffset (int adjusted) { return mTexture->GetScaledLeftOffset(adjusted); }
|
||||
int GetScaledTopOffset (int adjusted) { return mTexture->GetScaledTopOffset(adjusted); }
|
||||
double GetScaledLeftOffsetDouble(int adjusted) { return mTexture->GetScaledLeftOffsetDouble(adjusted); }
|
||||
double GetScaledTopOffsetDouble(int adjusted) { return mTexture->GetScaledTopOffsetDouble(adjusted); }
|
||||
|
||||
// Interfaces for the different renderers. Everything that needs to check renderer-dependent offsets
|
||||
// should use these, so that if changes are needed, this is the only place to edit.
|
||||
|
||||
// For the original software renderer
|
||||
int GetLeftOffsetSW() { return GetLeftOffset(r_spriteadjustSW); }
|
||||
int GetTopOffsetSW() { return GetTopOffset(r_spriteadjustSW); }
|
||||
int GetScaledLeftOffsetSW() { return GetScaledLeftOffset(r_spriteadjustSW); }
|
||||
int GetScaledTopOffsetSW() { return GetScaledTopOffset(r_spriteadjustSW); }
|
||||
|
||||
// For the softpoly renderer, in case it wants adjustment
|
||||
int GetLeftOffsetPo() { return GetLeftOffset(r_spriteadjustSW); }
|
||||
int GetTopOffsetPo() { return GetTopOffset(r_spriteadjustSW); }
|
||||
int GetScaledLeftOffsetPo() { return GetScaledLeftOffset(r_spriteadjustSW); }
|
||||
int GetScaledTopOffsetPo() { return GetScaledTopOffset(r_spriteadjustSW); }
|
||||
|
||||
DVector2 GetScale() const { return mTexture->Scale; }
|
||||
|
||||
// Returns a single column of the texture
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
return mTexture->GetColumn(style, column, spans_out);
|
||||
}
|
||||
|
||||
// Returns a single column of the texture, in BGRA8 format
|
||||
const uint32_t *GetColumnBgra(unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
return mTexture->GetColumnBgra(column, spans_out);
|
||||
}
|
||||
|
||||
// Returns the whole texture, stored in column-major order
|
||||
const uint8_t *GetPixels(FRenderStyle style)
|
||||
{
|
||||
return mTexture->GetPixels(style);
|
||||
}
|
||||
|
||||
// Returns the whole texture, stored in column-major order, in BGRA8 format
|
||||
const uint32_t *GetPixelsBgra()
|
||||
{
|
||||
return mTexture->GetPixelsBgra();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline FSoftwareTexture *FTexture::GetSoftwareTexture()
|
||||
{
|
||||
if (!SoftwareTexture) SoftwareTexture = new FSoftwareTexture(this);
|
||||
return SoftwareTexture;
|
||||
}
|
||||
|
||||
class FxAddSub;
|
||||
// Texture manager
|
||||
class FTextureManager
|
||||
|
@ -703,13 +860,13 @@ class FWorldTexture : public FTexture
|
|||
{
|
||||
protected:
|
||||
uint8_t *Pixeldata[2] = { nullptr, nullptr };
|
||||
Span **Spandata[2] = { nullptr, nullptr };
|
||||
FSoftwareTextureSpan **Spandata[2] = { nullptr, nullptr };
|
||||
uint8_t PixelsAreStatic = 0; // can be set by subclasses which provide static pixel buffers.
|
||||
|
||||
FWorldTexture(const char *name = nullptr, int lumpnum = -1);
|
||||
~FWorldTexture();
|
||||
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out) override;
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out) override;
|
||||
const uint8_t *GetPixels(FRenderStyle style) override;
|
||||
void Unload() override;
|
||||
virtual uint8_t *MakeTexture(FRenderStyle style) = 0;
|
||||
|
@ -763,7 +920,7 @@ public:
|
|||
FCanvasTexture (const char *name, int width, int height);
|
||||
~FCanvasTexture ();
|
||||
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out);
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out);
|
||||
const uint8_t *GetPixels (FRenderStyle style);
|
||||
const uint32_t *GetPixelsBgra() override;
|
||||
void Unload ();
|
||||
|
@ -782,7 +939,7 @@ protected:
|
|||
DCanvas *CanvasBgra = nullptr;
|
||||
uint8_t *Pixels = nullptr;
|
||||
uint32_t *PixelsBgra = nullptr;
|
||||
Span DummySpans[2];
|
||||
FSoftwareTextureSpan DummySpans[2];
|
||||
bool bNeedsUpdate = true;
|
||||
bool bDidUpdate = false;
|
||||
bool bPixelsAllocated = false;
|
||||
|
@ -799,6 +956,10 @@ class FWrapperTexture : public FTexture
|
|||
{
|
||||
public:
|
||||
FWrapperTexture(int w, int h, int bits = 1);
|
||||
IHardwareTexture *GetSystemTexture(int slot)
|
||||
{
|
||||
return SystemTexture[slot];
|
||||
}
|
||||
};
|
||||
|
||||
extern FTextureManager TexMan;
|
||||
|
|
|
@ -125,7 +125,6 @@ void F2DDrawer::AddIndices(int firstvert, int count, ...)
|
|||
|
||||
bool F2DDrawer::SetStyle(FTexture *tex, DrawParms &parms, PalEntry &vertexcolor, RenderCommand &quad)
|
||||
{
|
||||
auto fmt = tex->GetFormat();
|
||||
FRenderStyle style = parms.style;
|
||||
float alpha;
|
||||
bool stencilling;
|
||||
|
@ -298,12 +297,12 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
|||
dg.mType = DrawTypeTriangles;
|
||||
dg.mVertCount = 4;
|
||||
dg.mTexture = img;
|
||||
if (img->bWarped) dg.mFlags |= DTF_Wrap;
|
||||
if (img->isWarped()) dg.mFlags |= DTF_Wrap;
|
||||
|
||||
dg.mTranslation = 0;
|
||||
SetStyle(img, parms, vertexcolor, dg);
|
||||
|
||||
if (!img->bHasCanvas && parms.remap != nullptr && !parms.remap->Inactive)
|
||||
if (!img->isHardwareCanvas() && parms.remap != nullptr && !parms.remap->Inactive)
|
||||
{
|
||||
dg.mTranslation = parms.remap;
|
||||
}
|
||||
|
@ -378,7 +377,7 @@ void F2DDrawer::AddShape( FTexture *img, DShape2D *shape, DrawParms &parms )
|
|||
dg.mTranslation = 0;
|
||||
SetStyle(img, parms, vertexcolor, dg);
|
||||
|
||||
if (!img->bHasCanvas && parms.remap != nullptr && !parms.remap->Inactive)
|
||||
if (!img->isHardwareCanvas() && parms.remap != nullptr && !parms.remap->Inactive)
|
||||
dg.mTranslation = parms.remap;
|
||||
|
||||
double minx = 16383, miny = 16383, maxx = -16384, maxy = -16384;
|
||||
|
@ -466,8 +465,8 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
|||
float cosrot = (float)cos(rotation.Radians());
|
||||
float sinrot = (float)sin(rotation.Radians());
|
||||
|
||||
float uscale = float(1.f / (texture->GetScaledWidth() * scalex));
|
||||
float vscale = float(1.f / (texture->GetScaledHeight() * scaley));
|
||||
float uscale = float(1.f / (texture->GetDisplayWidth() * scalex));
|
||||
float vscale = float(1.f / (texture->GetDisplayHeight() * scaley));
|
||||
float ox = float(originx);
|
||||
float oy = float(originy);
|
||||
|
||||
|
@ -529,17 +528,17 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *
|
|||
// scaling is not used here.
|
||||
if (!local_origin)
|
||||
{
|
||||
fU1 = float(left) / src->GetWidth();
|
||||
fV1 = float(top) / src->GetHeight();
|
||||
fU2 = float(right) / src->GetWidth();
|
||||
fV2 = float(bottom) / src->GetHeight();
|
||||
fU1 = float(left) / src->GetDisplayWidth();
|
||||
fV1 = float(top) / src->GetDisplayHeight();
|
||||
fU2 = float(right) / src->GetDisplayWidth();
|
||||
fV2 = float(bottom) / src->GetDisplayHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
fU1 = 0;
|
||||
fV1 = 0;
|
||||
fU2 = float(right - left) / src->GetWidth();
|
||||
fV2 = float(bottom - top) / src->GetHeight();
|
||||
fU2 = float(right - left) / src->GetDisplayWidth();
|
||||
fV2 = float(bottom - top) / src->GetDisplayHeight();
|
||||
}
|
||||
dg.mVertIndex = (int)mVertices.Reserve(4);
|
||||
auto ptr = &mVertices[dg.mVertIndex];
|
||||
|
|
|
@ -312,23 +312,23 @@ bool DFrameBuffer::SetTextureParms(DrawParms *parms, FTexture *img, double xx, d
|
|||
{
|
||||
parms->x = xx;
|
||||
parms->y = yy;
|
||||
parms->texwidth = img->GetScaledWidthDouble();
|
||||
parms->texheight = img->GetScaledHeightDouble();
|
||||
parms->texwidth = img->GetDisplayWidthDouble();
|
||||
parms->texheight = img->GetDisplayHeightDouble();
|
||||
if (parms->top == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->top = img->GetScaledTopOffset(0);
|
||||
parms->top = img->GetDisplayTopOffset();
|
||||
}
|
||||
if (parms->left == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->left = img->GetScaledLeftOffset(0);
|
||||
parms->left = img->GetDisplayLeftOffset();
|
||||
}
|
||||
if (parms->destwidth == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->destwidth = img->GetScaledWidthDouble();
|
||||
parms->destwidth = img->GetDisplayWidthDouble();
|
||||
}
|
||||
if (parms->destheight == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->destheight = img->GetScaledHeightDouble();
|
||||
parms->destheight = img->GetDisplayHeightDouble();
|
||||
}
|
||||
|
||||
switch (parms->cleanmode)
|
||||
|
@ -470,7 +470,7 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
|
||||
if (!fortext)
|
||||
{
|
||||
if (img == NULL || img->UseType == ETextureType::Null)
|
||||
if (img == NULL || !img->isValid())
|
||||
{
|
||||
ListEnd(tags);
|
||||
return false;
|
||||
|
@ -650,8 +650,8 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
assert(fortext == false);
|
||||
if (img == NULL) return false;
|
||||
parms->cleanmode = DTA_Fullscreen;
|
||||
parms->virtWidth = img->GetScaledWidthDouble();
|
||||
parms->virtHeight = img->GetScaledHeightDouble();
|
||||
parms->virtWidth = img->GetDisplayWidthDouble();
|
||||
parms->virtHeight = img->GetDisplayHeightDouble();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -697,19 +697,19 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
break;
|
||||
|
||||
case DTA_SrcX:
|
||||
parms->srcx = ListGetDouble(tags) / img->GetScaledWidthDouble();
|
||||
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidthDouble();
|
||||
break;
|
||||
|
||||
case DTA_SrcY:
|
||||
parms->srcy = ListGetDouble(tags) / img->GetScaledHeightDouble();
|
||||
parms->srcy = ListGetDouble(tags) / img->GetDisplayHeightDouble();
|
||||
break;
|
||||
|
||||
case DTA_SrcWidth:
|
||||
parms->srcwidth = ListGetDouble(tags) / img->GetScaledWidthDouble();
|
||||
parms->srcwidth = ListGetDouble(tags) / img->GetDisplayWidthDouble();
|
||||
break;
|
||||
|
||||
case DTA_SrcHeight:
|
||||
parms->srcheight = ListGetDouble(tags) / img->GetScaledHeightDouble();
|
||||
parms->srcheight = ListGetDouble(tags) / img->GetDisplayHeightDouble();
|
||||
break;
|
||||
|
||||
case DTA_TopOffset:
|
||||
|
@ -741,8 +741,8 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
if (fortext) return false;
|
||||
if (ListGetInt(tags))
|
||||
{
|
||||
parms->left = img->GetScaledWidthDouble() * 0.5;
|
||||
parms->top = img->GetScaledHeightDouble() * 0.5;
|
||||
parms->left = img->GetDisplayWidthDouble() * 0.5;
|
||||
parms->top = img->GetDisplayHeightDouble() * 0.5;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -751,8 +751,8 @@ bool DFrameBuffer::ParseDrawTextureTags(FTexture *img, double x, double y, uint3
|
|||
if (fortext) return false;
|
||||
if (ListGetInt(tags))
|
||||
{
|
||||
parms->left = img->GetScaledWidthDouble() * 0.5;
|
||||
parms->top = img->GetScaledHeightDouble();
|
||||
parms->left = img->GetDisplayWidthDouble() * 0.5;
|
||||
parms->top = img->GetDisplayHeightDouble();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1305,15 +1305,15 @@ void DFrameBuffer::DrawFrame (int left, int top, int width, int height)
|
|||
|
||||
// Draw top and bottom sides.
|
||||
p = TexMan[border->t];
|
||||
FlatFill(left, top - p->GetHeight(), right, top, p, true);
|
||||
FlatFill(left, top - p->GetDisplayHeight(), right, top, p, true);
|
||||
p = TexMan[border->b];
|
||||
FlatFill(left, bottom, right, bottom + p->GetHeight(), p, true);
|
||||
FlatFill(left, bottom, right, bottom + p->GetDisplayHeight(), p, true);
|
||||
|
||||
// Draw left and right sides.
|
||||
p = TexMan[border->l];
|
||||
FlatFill(left - p->GetWidth(), top, left, bottom, p, true);
|
||||
FlatFill(left - p->GetDisplayWidth(), top, left, bottom, p, true);
|
||||
p = TexMan[border->r];
|
||||
FlatFill(right, top, right + p->GetWidth(), bottom, p, true);
|
||||
FlatFill(right, top, right + p->GetDisplayWidth(), bottom, p, true);
|
||||
|
||||
// Draw beveled corners.
|
||||
DrawTexture (TexMan[border->tl], left-offset, top-offset, TAG_DONE);
|
||||
|
|
|
@ -171,7 +171,7 @@ class FFontChar1 : public FTexture
|
|||
{
|
||||
public:
|
||||
FFontChar1 (FTexture *sourcelump);
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out);
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out);
|
||||
const uint8_t *GetPixels (FRenderStyle style);
|
||||
void SetSourceRemap(const uint8_t *sourceremap);
|
||||
void Unload ();
|
||||
|
@ -192,7 +192,7 @@ public:
|
|||
FFontChar2 (int sourcelump, int sourcepos, int width, int height, int leftofs=0, int topofs=0);
|
||||
~FFontChar2 ();
|
||||
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out);
|
||||
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const FSoftwareTextureSpan **spans_out);
|
||||
const uint8_t *GetPixels (FRenderStyle style);
|
||||
void SetSourceRemap(const uint8_t *sourceremap);
|
||||
void Unload ();
|
||||
|
@ -201,7 +201,7 @@ protected:
|
|||
int SourceLump;
|
||||
int SourcePos;
|
||||
uint8_t *Pixels;
|
||||
Span **Spans;
|
||||
FSoftwareTextureSpan **Spans;
|
||||
const uint8_t *SourceRemap;
|
||||
|
||||
void MakeTexture ();
|
||||
|
@ -532,25 +532,15 @@ FFont *FFont::FindFont (FName name)
|
|||
void RecordTextureColors (FTexture *pic, uint8_t *usedcolors)
|
||||
{
|
||||
int x;
|
||||
|
||||
for (x = pic->GetWidth() - 1; x >= 0; x--)
|
||||
|
||||
auto pixels = pic->GetPixels(DefaultRenderStyle());
|
||||
auto size = pic->GetWidth() * pic->GetHeight();
|
||||
|
||||
for(x = 0;x < size; x++)
|
||||
{
|
||||
const FTexture::Span *spans;
|
||||
const uint8_t *column = pic->GetColumn(DefaultRenderStyle(), x, &spans); // This shouldn't use the spans...
|
||||
|
||||
while (spans->Length != 0)
|
||||
{
|
||||
const uint8_t *source = column + spans->TopOffset;
|
||||
int count = spans->Length;
|
||||
|
||||
do
|
||||
{
|
||||
usedcolors[*source++] = 1;
|
||||
} while (--count);
|
||||
|
||||
spans++;
|
||||
}
|
||||
usedcolors[pixels[x]]++;
|
||||
}
|
||||
pic->Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1623,7 +1613,7 @@ void FFontChar1::MakeTexture ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
const uint8_t *FFontChar1::GetColumn(FRenderStyle, unsigned int column, const Span **spans_out)
|
||||
const uint8_t *FFontChar1::GetColumn(FRenderStyle, unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
if (Pixels == NULL)
|
||||
{
|
||||
|
@ -1747,7 +1737,7 @@ const uint8_t *FFontChar2::GetPixels (FRenderStyle)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
const uint8_t *FFontChar2::GetColumn(FRenderStyle, unsigned int column, const Span **spans_out)
|
||||
const uint8_t *FFontChar2::GetColumn(FRenderStyle, unsigned int column, const FSoftwareTextureSpan **spans_out)
|
||||
{
|
||||
if (Pixels == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue