You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#ROBOMERGE-SOURCE: CL 12341733 via CL 12341750 via CL 12342073 via CL 12342088 #ROBOMERGE-BOT: (v671-12333473) [CL 12342141 by nick darnell in Main branch]
68 lines
2.0 KiB
C++
68 lines
2.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Textures/SlateShaderResource.h"
|
|
#include "Materials/MaterialInterface.h"
|
|
|
|
class FMaterialRenderProxy;
|
|
|
|
/**
|
|
* A resource for rendering a UMaterial in Slate
|
|
*/
|
|
class FSlateMaterialResource : public FSlateShaderResource
|
|
{
|
|
public:
|
|
FSlateMaterialResource(const UMaterialInterface& InMaterialResource, const FVector2D& InImageSize, FSlateShaderResource* InTextureMask = nullptr );
|
|
~FSlateMaterialResource();
|
|
|
|
virtual uint32 GetWidth() const override { return Width; }
|
|
virtual uint32 GetHeight() const override { return Height; }
|
|
virtual ESlateShaderResource::Type GetType() const override { return ESlateShaderResource::Material; }
|
|
|
|
void UpdateMaterial(const UMaterialInterface& InMaterialResource, const FVector2D& InImageSize, FSlateShaderResource* InTextureMask );
|
|
void ResetMaterial();
|
|
|
|
/** @return The material render proxy */
|
|
FMaterialRenderProxy* GetRenderProxy() const { return MaterialProxy; }
|
|
|
|
/** @return the material object */
|
|
const UMaterialInterface* GetMaterialObject() const
|
|
{
|
|
return MaterialObject;
|
|
}
|
|
|
|
/** Slate proxy used for batching the material */
|
|
FSlateShaderResourceProxy* GetResourceProxy() const { return SlateProxy; }
|
|
|
|
FSlateShaderResource* GetTextureMaskResource() const { return TextureMaskResource; }
|
|
|
|
#if SLATE_CHECK_UOBJECT_RENDER_RESOURCES
|
|
virtual void CheckForStaleResources() const override;
|
|
#endif
|
|
|
|
private:
|
|
const class UMaterialInterface* MaterialObject;
|
|
class FMaterialRenderProxy* MaterialProxy;
|
|
|
|
#if SLATE_CHECK_UOBJECT_RENDER_RESOURCES
|
|
// Used to guard against crashes when the material object is deleted. This is expensive so we do not do it in shipping
|
|
TWeakObjectPtr<const UMaterialInterface> MaterialObjectWeakPtr;
|
|
FName DebugName;
|
|
#endif
|
|
|
|
/** Slate proxy used for batching the material */
|
|
FSlateShaderResourceProxy* SlateProxy;
|
|
|
|
FSlateShaderResource* TextureMaskResource;
|
|
uint32 Width;
|
|
uint32 Height;
|
|
|
|
private:
|
|
#if SLATE_CHECK_UOBJECT_RENDER_RESOURCES
|
|
void UpdateMaterialName();
|
|
#endif
|
|
};
|
|
|