Files
UnrealEngineUWP/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Public/GeometryCollection/GeometryCollectionISMPoolSubSystem.h
cedric caillaud 5c4faf514a Make ISM Pool actor allocation be per level
This fixes an issue where geometry collection using custom renderer do not work with bRequireFullVisibilityToRender

#rb jeremy.moore

[CL 27383072 by cedric caillaud in ue5-main branch]
2023-08-25 13:36:52 -04:00

40 lines
1.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Subsystems/WorldSubsystem.h"
#include "GeometryCollectionISMPoolSubSystem.generated.h"
class AGeometryCollectionISMPoolActor;
class ULevel;
/**
* A subsystem managing ISMPool actors.
* Used by geometry collection now but repurposed for more general use.
*/
UCLASS(MinimalAPI)
class UGeometryCollectionISMPoolSubSystem : public UWorldSubsystem
{
GENERATED_BODY()
public:
GEOMETRYCOLLECTIONENGINE_API UGeometryCollectionISMPoolSubSystem();
// USubsystem BEGIN
GEOMETRYCOLLECTIONENGINE_API virtual void Initialize(FSubsystemCollectionBase& Collection) override;
GEOMETRYCOLLECTIONENGINE_API virtual void Deinitialize() override;
// USubsystem END
/** Finds or creates an actor. */
GEOMETRYCOLLECTIONENGINE_API AGeometryCollectionISMPoolActor* FindISMPoolActor(ULevel* Level);
/** Get all actors managed by the subsystem. */
GEOMETRYCOLLECTIONENGINE_API void GetISMPoolActors(TArray<AGeometryCollectionISMPoolActor*>& OutActors) const;
protected:
UFUNCTION()
void OnActorEndPlay(AActor* InSource, EEndPlayReason::Type Reason);
/** ISMPool are per level **/
TMap<TObjectPtr<ULevel>, TObjectPtr<AGeometryCollectionISMPoolActor> > PerLevelISMPoolActors;
};