Files
UnrealEngineUWP/Engine/Source/Runtime/MediaAssets/Public/MediaTextureTracker.h
Tony Wong cb1a986da7 MediaPlate: Added vertical arc control of sphere mesh.
#JIRA: UE-153163
#preflight 62cc8b61f22e9d4fdf7a4443
#review-21047288 @eric.renaudhoude @ruslan.idrisov
#rb eric.renaudhoude, ruslan.idrisov
#rnx

[CL 21071514 by Tony Wong in ue5-main branch]
2022-07-13 11:12:28 -04:00

89 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "UObject/ObjectPtr.h"
#include "UObject/WeakObjectPtr.h"
#include "UObject/WeakObjectPtrTemplates.h"
#include "MediaTextureTracker.generated.h"
class AActor;
class UMediaTexture;
UENUM()
enum class EMediaTextureVisibleMipsTiles : uint8
{
None = 0,
Plane = 1,
Sphere
};
/** Holds info on a single object. */
struct FMediaTextureTrackerObject
{
/** Actor that is using our img sequence. */
TWeakObjectPtr<class AActor> Object;
/** LOD bias for the mipmap level. */
float MipMapLODBias;
/** Specify type of mesh used for visible mips and tiles calculations. */
EMediaTextureVisibleMipsTiles VisibleMipsTilesCalculations;
/** Arc size in degrees used for visible tiles calculations, specific to the sphere.*/
FVector2D MeshRange;
};
/**
* Tracks which media textures are used by which objects.
*/
class FMediaTextureTracker
{
public:
/**
* Access engine from here.
*
* @return Engine.
*/
MEDIAASSETS_API static FMediaTextureTracker& Get();
virtual ~FMediaTextureTracker() {}
/**
* Each object should call this for each media texture that the object has.
*
* @param InInfo Object that has the texture.
* @param InTexture Texture to register.
*/
MEDIAASSETS_API void RegisterTexture(TSharedPtr<FMediaTextureTrackerObject, ESPMode::ThreadSafe>& InInfo, TObjectPtr<UMediaTexture> InTexture);
/**
* Each object should call this for each media texture that the object has.
*
* @param InInfo Object that has the texture.
* @param InTexture Texture to unregister.
*/
MEDIAASSETS_API void UnregisterTexture(TSharedPtr<FMediaTextureTrackerObject, ESPMode::ThreadSafe>& InInfo, TObjectPtr<UMediaTexture> InTexture);
/**
* Get which objects are usnig a specific media texture.
*
* @param InTexture Media texture to check.
* @return Nullptr if nothing found, or a pointer to an array of objects.
*/
MEDIAASSETS_API const TArray<TWeakPtr<FMediaTextureTrackerObject, ESPMode::ThreadSafe>>* GetObjects(TObjectPtr<UMediaTexture> InTexture) const;
/**
* Get a list of media textures we know about.
*
* @ return List of textures.
*/
MEDIAASSETS_API const TArray<TWeakObjectPtr<UMediaTexture>>& GetTextures() { return MediaTextures; }
protected:
/** Maps a media texture to an array of playback components. */
TMap<TWeakObjectPtr<UMediaTexture>, TArray<TWeakPtr<FMediaTextureTrackerObject, ESPMode::ThreadSafe>>> MapTextureToObject;
/** Array of media textures that we know about. */
TArray<TWeakObjectPtr<UMediaTexture>> MediaTextures;
};