Skip to content
Snippets Groups Projects
Commit 0f38a63b authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Reformatting code, redefine key to action, adding fps counter

parent 7dd9f614
Branches
Tags
1 merge request!4Develop
No preview for this file type
This diff is collapsed.
......@@ -5,25 +5,16 @@
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DoorOverlayData.h"
#include "HeadMountedDisplayFunctionLibrary.h"
#include "IDisplayCluster.h"
#include "Engine/Engine.h"
#include "IXRTrackingSystem.h"
#include "Components/InputComponent.h"
#include "Cluster/IDisplayClusterClusterManager.h"
#include "IDisplayClusterGameManager.h"
#include "InputCoreTypes.h"
#include "UObject/ConstructorHelpers.h"
#include <array>
#include "Components/StaticMeshComponent.h"
#include "Engine/Engine.h"
#include "Materials/Material.h"
#include "Materials/MaterialInstanceDynamic.h"
#include "DisplayClusterExtensions/Public/VirtualRealityPawn.h"
#include "DisplayCluster/Public/DisplayClusterSceneComponent.h"
#include "CAVEOverlayController.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(CAVEOverlayLog, Log, All);
DECLARE_LOG_CATEGORY_EXTERN(LogCAVEOverlay, Log, All);
UCLASS()
class CAVEOVERLAY_API ACAVEOverlayController : public AActor
......@@ -38,45 +29,48 @@ protected:
private:
//Execution Modes
bool hmd_mode_ = false;
bool display_cluster_mode_ = false;
bool bHMD_Mode = false;
bool bDisplay_Cluster_Mode = false;
//Screen Types
enum SCREEEN_TYPE { SCREEN_MASTER, SCREEN_NORMAL, SCREEN_DOOR_PARTIAL, SCREEN_DOOR };
SCREEEN_TYPE screen_type_ = SCREEN_NORMAL;
const std::array<FString, 4> screens_door_ = {"node_bul_left_eye", "node_bul_right_eye", "node_bll_left_eye", "node_bll_right_eye"};
const std::array<FString, 4> screens_door_partial_ = {"node_bur_left_eye", "node_bur_right_eye", "node_blr_left_eye", "node_blr_right_eye"};
const FString screen_main = "node_main";
enum EScreen_Type { SCREEN_MASTER, SCREEN_NORMAL, SCREEN_DOOR_PARTIAL, SCREEN_DOOR };
EScreen_Type Screen_Type = SCREEN_NORMAL;
const std::array<FString, 4> Screens_Door = {"node_bul_left_eye", "node_bul_right_eye", "node_bll_left_eye", "node_bll_right_eye"};
const std::array<FString, 4> Screens_Door_Partial = {"node_bur_left_eye", "node_bur_right_eye", "node_blr_left_eye", "node_blr_right_eye"};
const std::array<FString, 5> Screens_FPS = {"node_rur_left_eye", "node_rur_right_eye", "node_lur_left_eye", "node_lur_right_eye", "node_main"};
const FString Screen_Main = "node_main";
//Door Mode
enum DOOR_MODE { DOOR_CLOSED = 0, DOOR_OPEN = 1, DOOR_PARTIALLY_OPEN = 2, DOOR_NUM_MODES = 3};
const FString door_mode_names_[DOOR_NUM_MODES] = {"Closed", "Open", "Partially Open" };
DOOR_MODE door_current_mode_ = DOOR_PARTIALLY_OPEN;
const float door_opening_width_relative_ = 0.522; //%, used for the overlay width on the screen
const float door_opening_width_absolute_ = 165; //cm, used for the non tape part at the door
const float wall_distance_ = 262.5; //cm, distance from center to a wall, *2 = wall width
const float wall_close_distance_ = 75; //cm, the distance considered to be too close to the walls
const float wall_fade_distance_ = 35; //cm, the distance over which the tape is faded
const float wall_warning_distance_ = 40; //cm, distance on which the tape turns red, measurred from wall
float door_current_opening_width_absolute_ = 0;
enum EDoor_Mode { DOOR_PARTIALLY_OPEN = 0, DOOR_OPEN = 1, DOOR_CLOSED = 2, DOOR_DEBUG = 3, DOOR_NUM_MODES = 4 };
const FString Door_Mode_Names[DOOR_NUM_MODES] = {"Partially Open", "Open", "Closed", "Debug"};
EDoor_Mode Door_Current_Mode = DOOR_PARTIALLY_OPEN;
const float Door_Opening_Width_Relative = 0.522; //%, used for the overlay width on the screen
const float Door_Opening_Width_Absolute = 165; //cm, used for the non tape part at the door
const float Wall_Distance = 262.5; //cm, distance from center to a wall, *2 = wall width
const float Wall_Close_Distance = 75; //cm, the distance considered to be too close to the walls
const float Wall_Fade_Distance = 35; //cm, the distance over which the tape is faded
const float Wall_Warning_Distance = 40; //cm, distance on which the tape turns red, measured from wall
float Door_Current_Opening_Width_Absolute = 0;
//Overlay
TSubclassOf<class UDoorOverlayData> overlay_class_;
UDoorOverlayData* overlay_;
TSubclassOf<class UDoorOverlayData> Overlay_Class;
UDoorOverlayData* Overlay;
//Geometry and Material
UStaticMeshComponent* createMeshComponent(const FName &name, UStaticMesh* mesh, USceneComponent* parent);
UMaterial* tape_material_ = nullptr;
UMaterial* sign_material_ = nullptr;
float calculateOpacityFromPosition(FVector position);
bool positionInDoorOpening(FVector position);
UStaticMeshComponent* CreateMeshComponent(const FName& Name, UStaticMesh* Mesh, USceneComponent* Parent);
UMaterial* Tape_Material = nullptr;
UMaterial* Sign_Material = nullptr;
float CalculateOpacityFromPosition(FVector Position);
bool PositionInDoorOpening(FVector Position);
//Pawn Components
bool attached_ = false;
void refreshPawnComponents();
AVirtualRealityPawn* player_pawn_;
UDisplayClusterSceneComponent* cave_origin_;
UDisplayClusterSceneComponent* shutter_glasses_;
bool bAttached = false;
void RefreshPawnComponents();
AVirtualRealityPawn* Player_Pawn;
UDisplayClusterSceneComponent* Cave_Origin;
UDisplayClusterSceneComponent* Shutter_Glasses;
public:
......@@ -84,24 +78,24 @@ public:
virtual void Tick(float DeltaTime) override;
void CycleDoorType();
void SetDoorMode(DOOR_MODE m);
void SetDoorMode(EDoor_Mode M);
//Signs and Banners
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* tape_root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* sign_root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* tape_negative_y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* tape_negative_x = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* tape_positive_y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* tape_positive_x = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* sign_negative_y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* sign_negative_x = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* sign_positive_y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* sign_positive_x = nullptr;
UMaterialInstanceDynamic* tape_material_dynamic_ = nullptr;
UMaterialInstanceDynamic* sign_material_dynamic_ = nullptr;
UStaticMesh* plane_mesh_ = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* Root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* Tape_Root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) USceneComponent* Sign_Root = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Negative_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Negative_X = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Positive_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Tape_Positive_X = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Negative_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Negative_X = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Positive_Y = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "CAVEOverlay", meta = (AllowPrivateAccess = "true")) UStaticMeshComponent* Sign_Positive_X = nullptr;
UMaterialInstanceDynamic* Tape_Material_Dynamic_ = nullptr;
UMaterialInstanceDynamic* Sign_Material_Dynamic_ = nullptr;
UStaticMesh* Plane_Mesh_ = nullptr;
};
......@@ -24,4 +24,7 @@ public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UBorder* BlackBox;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* FPS;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment