339 lines
14 KiB
C++
339 lines
14 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "LedVolumeTypes.h"
|
|
#include "LedVolumeRemoteControlActor.generated.h"
|
|
|
|
class ALedVolumeDisplayActor;
|
|
class UMaterialInterface;
|
|
class UStaticMesh;
|
|
class UTexture2D;
|
|
class UVolumeTexture;
|
|
class UWorld;
|
|
|
|
UCLASS(BlueprintType, Blueprintable)
|
|
class LEDCUBE3D_API ALedVolumeRemoteControlActor : public AActor
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
ALedVolumeRemoteControlActor();
|
|
|
|
virtual void BeginPlay() override;
|
|
virtual void Tick(float DeltaSeconds) override;
|
|
#if WITH_EDITOR
|
|
virtual bool ShouldTickIfViewportsOnly() const override;
|
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
|
#endif
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetTargetActorLabel, Category = "LED Control|Target")
|
|
FName TargetActorLabel = TEXT("LED_Volume_Display");
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetWidth, Category = "LED Control|Layout", meta = (ClampMin = "1", ClampMax = "128"))
|
|
int32 Width = 32;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetHeight, Category = "LED Control|Layout", meta = (ClampMin = "1", ClampMax = "128"))
|
|
int32 Height = 32;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetDepth, Category = "LED Control|Layout", meta = (ClampMin = "1", ClampMax = "128"))
|
|
int32 Depth = 32;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetPixelSize, Category = "LED Control|Layout", meta = (ClampMin = "0.01"))
|
|
float PixelSize = 4.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetSpacing, Category = "LED Control|Layout", meta = (ClampMin = "0.01"))
|
|
float Spacing = 8.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetPreviewStride, Category = "LED Control|Layout", meta = (ClampMin = "1", ClampMax = "16"))
|
|
int32 PreviewStride = 2;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
ELedDisplayGeometryMode GeometryMode = ELedDisplayGeometryMode::PhysicalMatrix;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1", ClampMax = "64"))
|
|
int32 CabinetCountX = 20;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1", ClampMax = "64"))
|
|
int32 CabinetCountZ = 20;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1", ClampMax = "16"))
|
|
int32 DotsPerCabinetX = 6;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1", ClampMax = "16"))
|
|
int32 DotsPerCabinetZ = 6;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1", ClampMax = "256"))
|
|
int32 LedsPerString = 120;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1.0"))
|
|
float CabinetSizeMm = 500.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1.0"))
|
|
float DotPitchMm = 83.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "0.1"))
|
|
float PhysicalLedSizeMm = 18.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "0.1"))
|
|
float WireThicknessMm = 2.6f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "0.0", ClampMax = "1.0"))
|
|
float WireOpacity = 0.62f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "0.0"))
|
|
float PhysicalJitterMm = 9.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix", meta = (ClampMin = "1", ClampMax = "32"))
|
|
int32 WireSegmentsPerString = 12;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
int32 PhysicalRandomSeed = 1337;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
bool bShowCabinets = false;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
bool bShowWires = true;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
bool bShowBottomFixers = true;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
TObjectPtr<UMaterialInterface> CabinetMaterial;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
TObjectPtr<UMaterialInterface> WireMaterial;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Physical Matrix")
|
|
TObjectPtr<UMaterialInterface> BottomFixerMaterial;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetVoxelShape, Category = "LED Control|Appearance")
|
|
ELedVoxelShape VoxelShape = ELedVoxelShape::Lens;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetCustomVoxelMesh, Category = "LED Control|Appearance")
|
|
TObjectPtr<UStaticMesh> CustomVoxelMesh;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetLedMaterial, Category = "LED Control|Appearance")
|
|
TObjectPtr<UMaterialInterface> LedMaterial;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetBrightness, Category = "LED Control|Appearance", meta = (ClampMin = "0.0"))
|
|
float Brightness = 18.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetGamma, Category = "LED Control|Appearance", meta = (ClampMin = "0.1", ClampMax = "5.0"))
|
|
float Gamma = 1.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetSolidColor, Category = "LED Control|Appearance")
|
|
FLinearColor SolidColor = FLinearColor(1.0f, 0.2f, 0.05f, 1.0f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetSourceMode, Category = "LED Control|Animation")
|
|
ELedVolumeSourceMode SourceMode = ELedVolumeSourceMode::TestPattern;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetTestPattern, Category = "LED Control|Animation")
|
|
ELedTestPattern TestPattern = ELedTestPattern::RainbowWave;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetAnimationSpeed, Category = "LED Control|Animation", meta = (ClampMin = "0.0"))
|
|
float AnimationSpeed = 1.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetAnimateInEditor, Category = "LED Control|Animation")
|
|
bool bAnimateInEditor = false;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetUseGpuTestPattern, Category = "LED Control|Animation")
|
|
bool bUseGpuTestPattern = true;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetMaxEditorInstances, Category = "LED Control|Performance", meta = (ClampMin = "1024"))
|
|
int32 MaxEditorInstances = 2097152;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetMaxRuntimeInstances, Category = "LED Control|Performance", meta = (ClampMin = "1024"))
|
|
int32 MaxRuntimeInstances = 2097152;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetColorUpdatesPerFrame, Category = "LED Control|Performance", meta = (ClampMin = "1"))
|
|
int32 ColorUpdatesPerFrame = 1024;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Setter = SetApplyDebounceSeconds, Category = "LED Control|Performance", meta = (ClampMin = "0.0", ClampMax = "2.0"))
|
|
float ApplyDebounceSeconds = 0.15f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Prepared Animation")
|
|
TArray<TObjectPtr<UVolumeTexture>> VolumeTextureFrames;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Prepared Animation")
|
|
TArray<TObjectPtr<UTexture2D>> TextureSliceFrames;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Sublevel Source")
|
|
TSoftObjectPtr<UWorld> VoxelizedSublevel;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Sublevel Source")
|
|
FVector CaptureBoundsExtent = FVector(100.0f, 100.0f, 100.0f);
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Sublevel Source")
|
|
bool bUseActorBoundsAsCaptureVolume = true;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Sublevel Source")
|
|
FName SourceActorTag = TEXT("LedVoxelSource");
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "LED Control|Sublevel Source")
|
|
FLinearColor EmptyVoxelColor = FLinearColor::Black;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "LED Control|Status")
|
|
int32 RenderedInstanceCount = 0;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "LED Control|Status")
|
|
int64 RequestedVoxelCount = 0;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Commands")
|
|
void ApplyToTarget();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Commands")
|
|
void RebuildTarget();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Commands")
|
|
void SyncFromTarget();
|
|
|
|
UFUNCTION(BlueprintPure, Category = "LED Control|Status")
|
|
ALedVolumeDisplayActor* GetTargetDisplay() const;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetTargetActorLabel(FName NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetWidth(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetHeight(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetDepth(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetPixelSize(float NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetSpacing(float NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetPreviewStride(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetVoxelShape(ELedVoxelShape NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetVoxelShapeIndex(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetCustomVoxelMesh(UStaticMesh* NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetLedMaterial(UMaterialInterface* NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetBrightness(float NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetGamma(float NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetSolidColor(FLinearColor NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetSourceMode(ELedVolumeSourceMode NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetSourceModeIndex(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetTestPattern(ELedTestPattern NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetTestPatternIndex(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetAnimationSpeed(float NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetAnimateInEditor(bool bNewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetUseGpuTestPattern(bool bNewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetMaxEditorInstances(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetMaxRuntimeInstances(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetColorUpdatesPerFrame(int32 NewValue);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "LED Control|Setters")
|
|
void SetApplyDebounceSeconds(float NewValue);
|
|
|
|
private:
|
|
TWeakObjectPtr<ALedVolumeDisplayActor> CachedTarget;
|
|
#if WITH_EDITOR
|
|
TWeakObjectPtr<ALedVolumeRemoteControlActor> CachedEditorSourceActor;
|
|
#endif
|
|
|
|
float PendingApplySeconds = 0.0f;
|
|
bool bApplyPending = true;
|
|
|
|
int32 CachedWidth = INDEX_NONE;
|
|
int32 CachedHeight = INDEX_NONE;
|
|
int32 CachedDepth = INDEX_NONE;
|
|
float CachedPixelSize = -1.0f;
|
|
float CachedSpacing = -1.0f;
|
|
int32 CachedPreviewStride = INDEX_NONE;
|
|
ELedDisplayGeometryMode CachedGeometryMode = ELedDisplayGeometryMode::VoxelGrid;
|
|
int32 CachedCabinetCountX = INDEX_NONE;
|
|
int32 CachedCabinetCountZ = INDEX_NONE;
|
|
int32 CachedDotsPerCabinetX = INDEX_NONE;
|
|
int32 CachedDotsPerCabinetZ = INDEX_NONE;
|
|
int32 CachedLedsPerString = INDEX_NONE;
|
|
float CachedCabinetSizeMm = -1.0f;
|
|
float CachedDotPitchMm = -1.0f;
|
|
float CachedPhysicalLedSizeMm = -1.0f;
|
|
float CachedWireThicknessMm = -1.0f;
|
|
float CachedWireOpacity = -1.0f;
|
|
float CachedPhysicalJitterMm = -1.0f;
|
|
int32 CachedWireSegmentsPerString = 0;
|
|
int32 CachedPhysicalRandomSeed = INDEX_NONE;
|
|
bool bCachedShowCabinets = false;
|
|
bool bCachedShowWires = false;
|
|
bool bCachedShowBottomFixers = false;
|
|
TObjectPtr<UMaterialInterface> CachedCabinetMaterial;
|
|
TObjectPtr<UMaterialInterface> CachedWireMaterial;
|
|
TObjectPtr<UMaterialInterface> CachedBottomFixerMaterial;
|
|
ELedVoxelShape CachedVoxelShape = ELedVoxelShape::Cube;
|
|
TObjectPtr<UStaticMesh> CachedCustomVoxelMesh;
|
|
TObjectPtr<UMaterialInterface> CachedLedMaterial;
|
|
FName CachedTargetActorLabel;
|
|
float CachedBrightness = -1.0f;
|
|
float CachedGamma = -1.0f;
|
|
FLinearColor CachedSolidColor = FLinearColor::Transparent;
|
|
ELedVolumeSourceMode CachedSourceMode = ELedVolumeSourceMode::TestPattern;
|
|
ELedTestPattern CachedTestPattern = ELedTestPattern::Solid;
|
|
float CachedAnimationSpeed = -1.0f;
|
|
bool bCachedAnimateInEditor = false;
|
|
bool bCachedUseGpuTestPattern = false;
|
|
int32 CachedMaxEditorInstances = INDEX_NONE;
|
|
int32 CachedMaxRuntimeInstances = INDEX_NONE;
|
|
int32 CachedColorUpdatesPerFrame = INDEX_NONE;
|
|
float CachedApplyDebounceSeconds = -1.0f;
|
|
int32 CachedVolumeTextureFrameCount = INDEX_NONE;
|
|
int32 CachedTextureSliceFrameCount = INDEX_NONE;
|
|
TSoftObjectPtr<UWorld> CachedVoxelizedSublevel;
|
|
FVector CachedCaptureBoundsExtent = FVector::ZeroVector;
|
|
bool bCachedUseActorBoundsAsCaptureVolume = false;
|
|
FName CachedSourceActorTag;
|
|
FLinearColor CachedEmptyVoxelColor = FLinearColor::Transparent;
|
|
|
|
void ClampSettings();
|
|
void QueueApply();
|
|
void CacheSettings();
|
|
bool HasSettingsChanged() const;
|
|
void UpdateStatusFromTarget();
|
|
#if WITH_EDITOR
|
|
void MirrorEditorControllerStateForPIE();
|
|
#endif
|
|
};
|