Plot3D.h 2.84 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 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
	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;

	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
95

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