You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Submitted on behalf of fred.kimberley #rb andy.davidson #preflight 61f8729a5a026d2d19bb9ca6 #preflight 61f87a025a026d2d19be76ed #ROBOMERGE-OWNER: andrew.davidson #ROBOMERGE-AUTHOR: andrew.davidson #ROBOMERGE-SOURCE: CL 18802361 in //UE5/Release-5.0/... via CL 18802891 via CL 18821557 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545) [CL 18821641 by andrew davidson in ue5-main branch]
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SlateAtlasedTextureResource.h"
|
|
#include "Slate/SlateTextureAtlasInterface.h"
|
|
|
|
TSharedPtr<FSlateAtlasedTextureResource> FSlateAtlasedTextureResource::NullResource = MakeShareable( new FSlateAtlasedTextureResource(nullptr) );
|
|
|
|
FSlateAtlasedTextureResource::FSlateAtlasedTextureResource(UTexture* InTexture)
|
|
: FSlateBaseUTextureResource(InTexture)
|
|
{
|
|
}
|
|
|
|
FSlateAtlasedTextureResource::~FSlateAtlasedTextureResource()
|
|
{
|
|
for ( FObjectResourceMap::TIterator ProxyIt(ProxyMap); ProxyIt; ++ProxyIt )
|
|
{
|
|
FSlateShaderResourceProxy* Proxy = ProxyIt.Value();
|
|
delete Proxy;
|
|
}
|
|
}
|
|
|
|
FSlateShaderResourceProxy* FSlateAtlasedTextureResource::FindOrCreateAtlasedProxy(UObject* InAtlasedObject, const FSlateAtlasData& AtlasData)
|
|
{
|
|
FSlateShaderResourceProxy* Proxy = ProxyMap.FindRef(InAtlasedObject);
|
|
if ( Proxy == nullptr )
|
|
{
|
|
// when we use image-DrawAsBox with PaperSprite, we need to change its actual size as its actual dimension.
|
|
FVector2D ActualSize(TextureObject->GetSurfaceWidth() * AtlasData.SizeUV.X, TextureObject->GetSurfaceHeight() * AtlasData.SizeUV.Y);
|
|
|
|
Proxy = new FSlateShaderResourceProxy();
|
|
Proxy->Resource = this;
|
|
Proxy->ActualSize = ActualSize.IntPoint();
|
|
Proxy->StartUV = FVector2f(AtlasData.StartUV); // LWC_TODO: Precision loss
|
|
Proxy->SizeUV = FVector2f(AtlasData.SizeUV); // LWC_TODO: Precision loss
|
|
|
|
ProxyMap.Add(InAtlasedObject, Proxy);
|
|
}
|
|
|
|
return Proxy;
|
|
}
|