Files
UnrealEngineUWP/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionRootProxyRenderer.h
jeremy moore 9821e1307b Geometry collection fix for bug with duplicated ISMs on Editor representation.
Issue was that duplicating an actor in Editor would duplicate the ISMs in the object hierachy. Because the ISM Pool was marked as transient the ISMs would be left leaking when the duplicated actor's custom renderer reregistered and created new ISMs.

[CL 33139028 by jeremy moore in ue5-main branch]
2024-04-22 10:52:10 -04:00

42 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GeometryCollection/GeometryCollectionExternalRenderInterface.h"
#include "GeometryCollectionRootProxyRenderer.generated.h"
class UGeometryCollectionComponent;
/** Implementation of a geometry collection custom renderer that creates static mesh components representing the root proxies. */
UCLASS()
class UGeometryCollectionRootProxyRenderer : public UObject, public IGeometryCollectionExternalRenderInterface
{
GENERATED_BODY()
/** Static mesh components for the root proxy meshes. */
UPROPERTY()
TArray<TObjectPtr<UStaticMeshComponent>> StaticMeshComponents;
public:
//~ Begin IGeometryCollectionExternalRenderInterface Interface.
virtual void OnRegisterGeometryCollection(UGeometryCollectionComponent& InComponent) override;
virtual void OnUnregisterGeometryCollection() override;
virtual void UpdateState(UGeometryCollection const& InGeometryCollection, FTransform const& InComponentTransform, uint32 InStateFlags) override;
virtual void UpdateRootTransform(UGeometryCollection const& InGeometryCollection, FTransform const& InRootTransform) override;
virtual void UpdateRootTransforms(UGeometryCollection const& InGeometryCollection, FTransform const& InRootTransform, TArrayView<const FTransform3f> InRootLocalTransforms) override;
virtual void UpdateTransforms(UGeometryCollection const& InGeometryCollection, TArrayView<const FTransform3f> InTransforms) override;
virtual bool ShouldUseNativeFallback(uint32 InStateFlags) const override { return (InStateFlags & EState_Broken) != 0; }
virtual bool CanEverUseNativeFallback() const override { return true; }
//~ End IGeometryCollectionExternalRenderInterface Interface.
protected:
/** Current visibility state. */
bool bIsVisible = true;
private:
void CreateRootProxyComponents(UGeometryCollectionComponent& InComponent);
void UpdateRootProxyTransforms(UGeometryCollection const& InGeometryCollection, FTransform const& InRootTransform, TArrayView<const FTransform3f> InLocalRootTransforms);
void ClearRootProxyComponents();
};