Plot3D.h 4.54 KB
Newer Older
Jan Kremer's avatar
Jan Kremer committed
1 2 3 4 5 6 7 8
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "PointCloud.h"
#include "PointCloudActor.h"
Jan Kremer's avatar
Jan Kremer committed
9
#include "Runtime/Engine/Classes/Curves/CurveVector.h"
10
#include "MyObject.h"
Jan Kremer's avatar
Jan Kremer committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#include "Plot3D.generated.h"

UCLASS()
class IMMERSIVEANALYTICS_API APlot3D : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	APlot3D();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

private:
	void InitPoints();
	void InitCloud();
Jan Kremer's avatar
Jan Kremer committed
29 30 31 32 33 34
	FColor CalculateColorOfPoint(int32 Index, float Min, float Max);
	void RebuildCloud();
	FVector CalculateWorldLocOfPoint(FPointCloudPoint* Point);

	UPROPERTY(Category = PointCloudActor, VisibleAnywhere, BlueprintReadOnly, meta = (ExposeFunctionCategories = "Rendering,Components|PointCloud", AllowPrivateAccess = "true"))
	class UPointCloudComponent* PointCloudComponent;
Jan Kremer's avatar
Jan Kremer committed
35 36 37 38 39

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

40
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
Jan Kremer's avatar
Jan Kremer committed
41 42
	TArray<FPointCloudPoint> Points;

43 44 45 46
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
	TArray<bool> IsBrushed;

	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
47 48
	TArray<float> X;

49
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
50 51
	TArray<float> Y;

52
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
53 54
	TArray<float> Z;

55
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
56 57
	TArray<FVector> Color;

58
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
Jan Kremer's avatar
Jan Kremer committed
59 60
	TArray<float> U;

61
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
Jan Kremer's avatar
Jan Kremer committed
62 63
	TArray<float> V;

64
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
Jan Kremer's avatar
Jan Kremer committed
65 66
	TArray<float> W;

67
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadWrite)
Jan Kremer's avatar
Jan Kremer committed
68 69
	TArray<float> Length;

70
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
71 72
	float MinLength;

73
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
74 75
	float MaxLength;

76
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
77 78
	float MinX;

79
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
80 81
	float MaxX;

82
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
83 84
	float MinY;

85
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
86 87
	float MaxY;

88
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
89 90
	float MinZ;

91
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
92 93
	float MaxZ;

94
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
95 96
	float MinU;

97
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
98 99
	float MaxU;

100
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
101 102
	float MinV;

103
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
104 105
	float MaxV;

106
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
107 108
	float MinW;

109
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
110 111
	float MaxW;

112 113 114 115
	UPROPERTY(Category = Plot3D, VisibleDefaultsOnly, BlueprintReadOnly)
	float DataScaleFactor;

	UPROPERTY(EditAnywhere, Category = Plot3D)
Jan Kremer's avatar
Jan Kremer committed
116 117
	UCurveVector* TransferFunction;

118 119 120
	UPROPERTY(EditAnywhere, Category = Plot3D)
	FString FileName;

Jan Kremer's avatar
Jan Kremer committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	UPointCloud *PointCloud;

	UPROPERTY(Category = Plot3D, EditAnywhere)
	bool OverridePointCount;

	UPROPERTY(Category = Plot3D, EditAnywhere)
	int32 PointCount;

	UFUNCTION(BlueprintCallable)
	void BrushPoints(TArray<int32> PointIndexes, bool Add, bool Rebuild);

	UFUNCTION(BlueprintCallable)
	void BrushPoint(int32 PointIndex, bool Add);

	UFUNCTION(BlueprintCallable)
	void ResetPoints(bool Rebuild);

	UFUNCTION(BlueprintCallable)
	void InvertPoints(bool Rebuild);

	UFUNCTION(BlueprintCallable)
	void AddFilter_Planes(FVector Normal, FVector Location, bool UseTwoPlanes, FVector NormalLeft, FVector LocationLeft, bool Add, bool Rebuild, bool Invert);

	UFUNCTION(BlueprintCallable)
146
	void AddFilter_ValueRange(EAxisType XType, float XMin, float XMax, EAxisType YType, float YMin, float YMax, bool Add, bool Rebuild, bool UseTwoValues);
Jan Kremer's avatar
Jan Kremer committed
147 148 149 150 151 152

	UFUNCTION(BlueprintCallable)
	void AddFilter_Box(FTransform Transform, FVector Extent, bool Add, bool Rebuild);

	UFUNCTION(BlueprintCallable)
	void AddFilter_Sphere(FVector Location, float Radius, bool Add, bool Rebuild);
Jan Kremer's avatar
Jan Kremer committed
153

Jan Kremer's avatar
Jan Kremer committed
154
	class UPointCloudComponent* GetPointCloudComponent() const { return PointCloudComponent; }
Jan Kremer's avatar
Jan Kremer committed
155
};