Plot3D.h 3.95 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"
Jan Kremer's avatar
Jan Kremer committed
10 11
#include "Plot3D.generated.h"

Jan Kremer's avatar
Jan Kremer committed
12 13 14 15 16 17
UENUM(BlueprintType)		//"BlueprintType" is essential to include
enum class EAxisType : uint8
{
	X,Y,Z,U,V,W,LengthUVW,Count
};

Jan Kremer's avatar
Jan Kremer committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
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
34 35 36 37 38 39
	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
40 41 42 43 44 45

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

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
Jan Kremer's avatar
Jan Kremer committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59
	TArray<FPointCloudPoint> Points;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	TArray<float> U;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	TArray<float> V;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	TArray<float> W;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	TArray<float> Length;

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MinLength;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MaxLength;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MinX;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MaxX;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MinY;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MaxY;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MinZ;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MaxZ;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MinU;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MaxU;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MinV;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MaxV;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MinW;

	UPROPERTY(Category = Plot3D, VisibleAnywhere, BlueprintReadOnly)
	float MaxW;

Jan Kremer's avatar
Jan Kremer committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
	UPROPERTY(EditDefaultsOnly, Category = Plot3D)
	UCurveVector* TransferFunction;

	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)
	void AddFilter_ValueRange(EAxisType XType, float XMin, float XMax, EAxisType YType, float YMin, float YMax, bool Add, bool Rebuild);

	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
137

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