mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-03 01:13:22 +00:00
- fixed order of multipatch texture initialization.
This didn't play well with hires replacements - the texture size needs to be set as early as possible.
This commit is contained in:
parent
3fd4d08004
commit
192ea40634
3 changed files with 13 additions and 8 deletions
|
@ -240,6 +240,10 @@ public:
|
||||||
if (int(ScaleY * h) != TexelHeight) ScaleY += (1 / 65536.);
|
if (int(ScaleY * h) != TexelHeight) ScaleY += (1 / 65536.);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void SetBase(FTexture* Tex)
|
||||||
|
{
|
||||||
|
Base = Tex;
|
||||||
|
}
|
||||||
void SetOffsets(int which, int x, int y)
|
void SetOffsets(int which, int x, int y)
|
||||||
{
|
{
|
||||||
LeftOffset[which] = x;
|
LeftOffset[which] = x;
|
||||||
|
|
|
@ -138,19 +138,18 @@ void FMultipatchTextureBuilder::MakeTexture(BuildInfo &buildinfo, ETextureType u
|
||||||
{
|
{
|
||||||
buildinfo.texture = new FGameTexture(nullptr, buildinfo.Name);
|
buildinfo.texture = new FGameTexture(nullptr, buildinfo.Name);
|
||||||
buildinfo.texture->SetUseType(usetype);
|
buildinfo.texture->SetUseType(usetype);
|
||||||
|
buildinfo.texture->SetSize(buildinfo.Width, buildinfo.Height);
|
||||||
buildinfo.texture->SetOffsets(0, buildinfo.LeftOffset[0], buildinfo.TopOffset[0]); // These are needed for construction of other multipatch textures.
|
buildinfo.texture->SetOffsets(0, buildinfo.LeftOffset[0], buildinfo.TopOffset[0]); // These are needed for construction of other multipatch textures.
|
||||||
buildinfo.texture->SetOffsets(1, buildinfo.LeftOffset[1], buildinfo.TopOffset[1]);
|
buildinfo.texture->SetOffsets(1, buildinfo.LeftOffset[1], buildinfo.TopOffset[1]);
|
||||||
|
buildinfo.texture->SetScale((float)buildinfo.Scale.X, (float)buildinfo.Scale.X);
|
||||||
|
buildinfo.texture->SetWorldPanning(buildinfo.bWorldPanning);
|
||||||
|
buildinfo.texture->SetNoDecals(buildinfo.bNoDecals);
|
||||||
TexMan.AddGameTexture(buildinfo.texture);
|
TexMan.AddGameTexture(buildinfo.texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FMultipatchTextureBuilder::AddImageToTexture(FImageTexture *tex, BuildInfo& buildinfo)
|
void FMultipatchTextureBuilder::AddImageToTexture(FImageTexture *tex, BuildInfo& buildinfo)
|
||||||
{
|
{
|
||||||
buildinfo.texture->Setup(tex);
|
buildinfo.texture->SetBase(tex);
|
||||||
buildinfo.texture->SetOffsets(0, buildinfo.LeftOffset[0], buildinfo.TopOffset[0]);
|
|
||||||
buildinfo.texture->SetOffsets(1, buildinfo.LeftOffset[1], buildinfo.TopOffset[1]);
|
|
||||||
buildinfo.texture->SetScale((float)buildinfo.Scale.X, (float)buildinfo.Scale.X);
|
|
||||||
buildinfo.texture->SetWorldPanning(buildinfo.bWorldPanning);
|
|
||||||
buildinfo.texture->SetNoDecals(buildinfo.bNoDecals);
|
|
||||||
calcShouldUpscale(buildinfo.texture); // calculate this once at insertion
|
calcShouldUpscale(buildinfo.texture); // calculate this once at insertion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,6 +873,7 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
|
||||||
for (int i = BuiltTextures.Size()-1; i>= 0; i--)
|
for (int i = BuiltTextures.Size()-1; i>= 0; i--)
|
||||||
{
|
{
|
||||||
auto &buildinfo = BuiltTextures[i];
|
auto &buildinfo = BuiltTextures[i];
|
||||||
|
|
||||||
bool hasEmpty = false;
|
bool hasEmpty = false;
|
||||||
|
|
||||||
for (unsigned j = 0; j < buildinfo.Inits.Size(); j++)
|
for (unsigned j = 0; j < buildinfo.Inits.Size(); j++)
|
||||||
|
|
|
@ -625,8 +625,9 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
||||||
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
|
||||||
gtex->SetWorldPanning(true);
|
gtex->SetWorldPanning(true);
|
||||||
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
||||||
gtex->SetOffsets(0, oldtex->GetTexelLeftOffset(0), oldtex->GetTexelTopOffset(0));
|
|
||||||
gtex->SetOffsets(1, oldtex->GetTexelLeftOffset(1), oldtex->GetTexelTopOffset(1));
|
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
|
||||||
|
gtex->SetOffsets(1, xs_RoundToInt(oldtex->GetDisplayLeftOffset(1) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(1) * gtex->GetScaleY()));
|
||||||
ReplaceTexture(tlist[i], gtex, true);
|
ReplaceTexture(tlist[i], gtex, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue