- make sure that warping textures never create a warped true color image.
This replaces the old redirection hackery that had to work differently for the legacy render path. Overriding CopyTrueColorTranslated is far more robust and ensures that no edge cases can reach the GetPixels function, which wasn't the case before.
This commit is contained in:
parent
c37ff22a05
commit
5e8a4b96fe
6 changed files with 23 additions and 27 deletions
|
|
@ -132,7 +132,7 @@ int FMaterial::mMaxBound;
|
|||
FMaterial::FMaterial(FTexture * tx, bool expanded)
|
||||
{
|
||||
mShaderIndex = SHADER_Default;
|
||||
tex = tx;
|
||||
sourcetex = tex = tx;
|
||||
|
||||
// TODO: apply custom shader object here
|
||||
/* if (tx->CustomShaderDefinition)
|
||||
|
|
@ -211,10 +211,11 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
|||
mSpriteU[0] = mSpriteV[0] = 0.f;
|
||||
mSpriteU[1] = mSpriteV[1] = 1.f;
|
||||
|
||||
FTexture *basetex = (tx->bWarped && gl.legacyMode)? tx : tx->GetRedirect(false);
|
||||
FTexture *basetex = tx->GetRedirect();
|
||||
// allow the redirect only if the texture is not expanded or the scale matches.
|
||||
if (!expanded || (tx->Scale.X == basetex->Scale.X && tx->Scale.Y == basetex->Scale.Y))
|
||||
{
|
||||
sourcetex = basetex;
|
||||
mBaseLayer = ValidateSysTexture(basetex, expanded);
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +327,7 @@ bool FMaterial::TrimBorders(uint16_t *rect)
|
|||
int w;
|
||||
int h;
|
||||
|
||||
unsigned char *buffer = tex->CreateTexBuffer(0, w, h);
|
||||
unsigned char *buffer = sourcetex->CreateTexBuffer(0, w, h);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
|
|
@ -549,8 +550,8 @@ int FMaterial::GetAreas(FloatRect **pAreas) const
|
|||
{
|
||||
if (mShaderIndex == SHADER_Default) // texture splitting can only be done if there's no attached effects
|
||||
{
|
||||
*pAreas = tex->areas;
|
||||
return tex->areacount;
|
||||
*pAreas = sourcetex->areas;
|
||||
return sourcetex->areacount;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -569,7 +570,7 @@ void FMaterial::BindToFrameBuffer()
|
|||
if (mBaseLayer == nullptr)
|
||||
{
|
||||
// must create the hardware texture first
|
||||
mBaseLayer->BindOrCreate(tex, 0, 0, 0, 0);
|
||||
mBaseLayer->BindOrCreate(sourcetex, 0, 0, 0, 0);
|
||||
FHardwareTexture::Unbind(0);
|
||||
ClearLastTexture();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue