Move TexMan.GetCanvas and GetTextureCanvas to common
This commit is contained in:
parent
753822359e
commit
e2778ba442
9 changed files with 56 additions and 43 deletions
|
|
@ -110,31 +110,6 @@ void SetCameraToTexture(AActor *viewpoint, const FString &texturename, double fo
|
|||
}
|
||||
}
|
||||
|
||||
TArray<FCanvas*> AllCanvases;
|
||||
|
||||
FCanvas* GetTextureCanvas(const FString& texturename)
|
||||
{
|
||||
FTextureID textureid = TexMan.CheckForTexture(texturename, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
|
||||
if (textureid.isValid())
|
||||
{
|
||||
// Only proceed if the texture is a canvas texture.
|
||||
auto tex = TexMan.GetGameTexture(textureid);
|
||||
if (tex && tex->GetTexture()->isCanvas())
|
||||
{
|
||||
FCanvasTexture* canvasTex = static_cast<FCanvasTexture*>(tex->GetTexture());
|
||||
if (!canvasTex->Canvas)
|
||||
{
|
||||
canvasTex->Canvas = Create<FCanvas>();
|
||||
canvasTex->Canvas->Tex = canvasTex;
|
||||
canvasTex->Canvas->Drawer.SetSize(tex->GetTexelWidth(), tex->GetTexelHeight());
|
||||
AllCanvases.Push(canvasTex->Canvas);
|
||||
}
|
||||
return canvasTex->Canvas;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FCanvasTextureInfo :: UpdateAll
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue