Skip to content
Snippets Groups Projects
Commit 7ce82dae authored by Marius Schmeling's avatar Marius Schmeling
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 916 additions and 0 deletions
# Visual Studio 2015 user specific files
.vs/
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.ipa
# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga
# Binary Files
Binaries/*
Plugins/*/Binaries/*
# Builds
Build/*
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt
# Don't ignore icon files in Build
!Build/**/*.ico
# Configuration files generated by the Editor
Saved/*
!Saved/AutoScreenshot.png
# Compiled source files for the engine to use
Intermediate/*
Plugins/*/Intermediate/*
# Cache files for the editor to use
DerivedDataCache/*
LocalDerivedDataCache/*
\ No newline at end of file
#-------------------------------------------------------------------------------
# Copyright (c) 2019 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualisation Group.
#-------------------------------------------------------------------------------
#The include file can be change to either be removed or reference a specific commit.
#Reference the Gitlab CI website for this
include:
- project: 'vr-group/unreal-development/unreal-ci'
ref: master
file: '/shared_scripts.yml'
#In this file you are able to configure your pipeline.
#If you want to use the standard pipeline with all steps and deployment mechanisms, you are set-up correctly now.
#If you want to customize something, either overwrite things that are defined in the shared_scripts repository,
#or remove the "extends" and write your own scripts
#
#If you want your pipeline to run on every commit, just remove the "only" blocks. Keep in mind, that a build
#can take some time.
#
#If you want to alter the unreal-building process two variables are defined for either changing the CLIENT_CONFIG or
#for adding EXTRA_ARGS to the building process
stages:
- build
- deploy
Build_Windows:
only: ['web', 'schedules']
extends: .Build_Windows_
tags:
- windows
- unreal-4.22
# variables:
# CLIENT_CONFIG: "DebugGame"
Build_CentOS:
only: ['web', 'schedules']
extends: .Build_CentOS_
tags:
- centos
- unreal-4.22
# variables:
# CLIENT_CONFIG: "DebugGame"
Deploy_CAVE:
only: ['web', 'schedules']
extends: .Deploy_CAVE_
dependencies:
- Build_CentOS
Deploy_Windows:
only: ['web', 'schedules']
extends: .Deploy_VRDev_
dependencies:
- Build_Windows
\ No newline at end of file
[submodule "Plugins/nDisplayExtensions"]
path = Plugins/nDisplayExtensions
url = https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/ndisplayextensions.git
[submodule "Plugins/CaveOverlay"]
path = Plugins/CaveOverlay
url = https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-cave-overlay.git
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum
[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Maps/Main.Main
GameDefaultMap=/Game/Maps/Main.Main
GlobalDefaultGameMode=/Script/DisplayClusterExtensions.VirtualRealityGameMode
[/Script/Engine.Engine]
GameEngine=/Script/DisplayCluster.DisplayClusterGameEngine
UnrealEdEngine=/Script/DisplayClusterEditor.DisplayClusterEditorEngine
+ActiveGameNameRedirects=(OldGameName="RwthVrTemplate",NewGameName="/Script/StudyFramework")
+ActiveGameNameRedirects=(OldGameName="/Script/RwthVrTemplate",NewGameName="/Script/StudyFramework")
+ActiveGameNameRedirects=(OldGameName="TP_nDisplayBP",NewGameName="/Script/StudyFramework")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_nDisplayBP",NewGameName="/Script/StudyFramework")
[/Script/DisplayClusterEditor.DisplayClusterEditorSettings]
bEnabled=True
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
Compiler=Default
-TargetedRHIs=PCD3D_SM5
-TargetedRHIs=PCD3D_SM4
+TargetedRHIs=PCD3D_SM5
+TargetedRHIs=PCD3D_SM4
+TargetedRHIs=GLSL_430
+TargetedRHIs=GLSL_150
MinimumOSVersion=MSOS_Vista
AudioDevice=
AudioSampleRate=48000
AudioCallbackBufferFrameSize=1024
AudioNumBuffersToEnqueue=1
AudioMaxChannels=0
AudioNumSourceWorkers=4
SpatializationPlugin=
ReverbPlugin=
OcclusionPlugin=
[/Script/Engine.RendererSettings]
r.DefaultFeature.Bloom=False
r.DefaultFeature.AutoExposure=False
r.DefaultFeature.MotionBlur=False
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
bSupportsPortraitOrientation=False
bSupportsUpsideDownOrientation=False
bSupportsLandscapeLeftOrientation=True
PreferredLandscapeOrientation=LandscapeLeft
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
[/Script/Engine.PhysicsSettings]
DefaultGravityZ=-980.000000
DefaultTerminalVelocity=4000.000000
DefaultFluidFriction=0.300000
SimulateScratchMemorySize=262144
RagdollAggregateThreshold=4
TriangleMeshTriangleMinAreaThreshold=5.000000
bEnableShapeSharing=False
bEnablePCM=True
bEnableStabilization=False
bWarnMissingLocks=True
bEnable2DPhysics=False
PhysicErrorCorrection=(PingExtrapolation=0.100000,PingLimit=100.000000,ErrorPerLinearDifference=1.000000,ErrorPerAngularDifference=1.000000,MaxRestoredStateError=1.000000,MaxLinearHardSnapDistance=400.000000,PositionLerp=0.000000,AngleLerp=0.400000,LinearVelocityCoefficient=100.000000,AngularVelocityCoefficient=10.000000,ErrorAccumulationSeconds=0.500000,ErrorAccumulationDistanceSq=15.000000,ErrorAccumulationSimilarity=100.000000)
LockedAxis=Invalid
DefaultDegreesOfFreedom=Full3D
BounceThresholdVelocity=200.000000
FrictionCombineMode=Average
RestitutionCombineMode=Average
MaxAngularVelocity=3600.000000
MaxDepenetrationVelocity=0.000000
ContactOffsetMultiplier=0.020000
MinContactOffset=2.000000
MaxContactOffset=8.000000
bSimulateSkeletalMeshOnDedicatedServer=True
DefaultShapeComplexity=CTF_UseSimpleAndComplex
bDefaultHasComplexCollision=True
bSuppressFaceRemapTable=False
bSupportUVFromHitResults=False
bDisableActiveActors=False
bDisableKinematicStaticPairs=False
bDisableKinematicKinematicPairs=False
bDisableCCD=False
bEnableEnhancedDeterminism=False
MaxPhysicsDeltaTime=0.033333
bSubstepping=False
bSubsteppingAsync=False
MaxSubstepDeltaTime=0.016667
MaxSubsteps=6
SyncSceneSmoothingFactor=0.000000
InitialAverageFrameRate=0.016667
PhysXTreeRebuildRate=10
DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2)
[/Script/EngineSettings.GeneralProjectSettings]
ProjectID=31FEC43547424656436266B9445F516C
ProjectName=StudyFramework
bUseBorderlessWindow=True
[/Script/Engine.InputSettings]
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_Z",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_Z",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Left_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Left_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Left_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Right_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Right_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MotionController_Right_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
bAltEnterTogglesFullscreen=True
bF11TogglesFullscreen=True
bUseMouseForTouch=False
bEnableMouseSmoothing=True
bEnableFOVScaling=True
bCaptureMouseOnLaunch=True
bDefaultViewportMouseLock=False
bAlwaysShowTouchInterface=False
bShowConsoleOnFourFingerTap=True
bEnableGestureRecognizer=False
bUseAutocorrect=False
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
DefaultViewportMouseLockMode=LockOnCapture
FOVScale=0.011110
DoubleClickTime=0.200000
+ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
+ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=nDisplayButton0)
+ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_Trigger)
+ActionMappings=(ActionName="Action1",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=One)
+ActionMappings=(ActionName="Action1",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=nDisplayButton1)
+ActionMappings=(ActionName="Action1",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_FaceButton1)
+ActionMappings=(ActionName="Action2",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Two)
+ActionMappings=(ActionName="Action2",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=nDisplayButton2)
+ActionMappings=(ActionName="Action2",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_FaceButton2)
+ActionMappings=(ActionName="Action3",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Three)
+ActionMappings=(ActionName="Action3",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=nDisplayButton3)
+ActionMappings=(ActionName="Action3",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_FaceButton3)
+ActionMappings=(ActionName="Action4",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Four)
+ActionMappings=(ActionName="Action4",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=nDisplayButton4)
+ActionMappings=(ActionName="Action4",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_FaceButton4)
+ActionMappings=(ActionName="Action5",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Five)
+ActionMappings=(ActionName="Action5",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=nDisplayButton5)
+ActionMappings=(ActionName="Action5",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Right_Grip1)
+AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W)
+AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S)
+AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=nDisplayAnalog1)
+AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=MotionController_Left_Thumbstick_Y)
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
+AxisMappings=(AxisName="MoveRight",Scale=-1.000000,Key=A)
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=nDisplayAnalog0)
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=MotionController_Left_Thumbstick_X)
+AxisMappings=(AxisName="MoveUp",Scale=1.000000,Key=E)
+AxisMappings=(AxisName="MoveUp",Scale=-1.000000,Key=Q)
+AxisMappings=(AxisName="TurnRate",Scale=-1.000000,Key=Left)
+AxisMappings=(AxisName="TurnRate",Scale=1.000000,Key=Right)
+AxisMappings=(AxisName="LookUpRate",Scale=-1.000000,Key=Up)
+AxisMappings=(AxisName="LookUpRate",Scale=1.000000,Key=Down)
+AxisMappings=(AxisName="TurnRate",Scale=1.000000,Key=MouseX)
+AxisMappings=(AxisName="LookUpRate",Scale=-1.000000,Key=MouseY)
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
ConsoleKey=None
-ConsoleKeys=Tilde
+ConsoleKeys=Insert
File added
#####################################################################
# nDisplay config file
#
# This file demonstrates how to configure for the AixCAVE.
#####################################################################
[cluster_node] id=node_main addr=10.0.1.29 screen=screen_main viewport=vp_1000 port_cs=41001 port_ss=41002 master=true sound=true
[screen] id=screen_main loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" size="X=0.433333,Y=0.270833" parent=display_main
[viewport] id=vp_1000 x=0 y=0 width=1600 height=1000 flip_h=False flip_v=False
[camera] id=camera_dynamic loc="X=0,Y=0,Z=0" parent=shutter_glasses
[scene_node] id=cave_origin loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0"
[scene_node] id=cave_center loc="X=0,Y=0,Z=1.65" rot="P=0,Y=0,R=0" parent=cave_origin
[scene_node] id=flystick loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" parent=cave_origin
[scene_node] id=shutter_glasses loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" parent=cave_origin
[scene_node] id=display_main loc="X=0.4,Y=0,Z=0" rot="P=0,Y=0,R=0" parent=shutter_glasses
[stereo] eye_swap=True eye_dist=0.064
[general] swap_sync_policy=2
\ No newline at end of file
# Visual Studio 2015 user specific files
.vs/
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.ipa
# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga
# Binary Files
Binaries/*
Plugins/*/Binaries/*
# Builds
Build/*
# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt
# Don't ignore icon files in Build
!Build/**/*.ico
# Configuration files generated by the Editor
Saved/*
# Compiled source files for the engine to use
Intermediate/*
Plugins/*/Intermediate/*
# Cache files for the editor to use
DerivedDataCache/*
LocalDerivedDataCache/*
\ No newline at end of file
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "CAVEOverlay",
"Description": "Adds the ability to black out the CAVE door and display the magic tape",
"Category": "Other",
"CreatedBy": "",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": true,
"IsBetaVersion": false,
"Installed": false,
"Modules": [
{
"Name": "CAVEOverlay",
"Type": "Runtime",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "nDisplay",
"Enabled": true
}
],
"Plugins": [
{
"Name": "nDisplayExtensions",
"Enabled": true
}
]
}
\ No newline at end of file
File added
File added
File added
File added
File added
Plugins/CaveOverlay/Resources/Icon128.png

7.33 KiB

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class CAVEOverlay : ModuleRules
{
public CAVEOverlay(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"UMG",
"DisplayCluster",
"DisplayClusterExtensions",
"InputCore",
"CoreUObject",
"Engine",
"Slate",
"SlateCore"
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "CAVEOverlay.h"
#define LOCTEXT_NAMESPACE "FCAVEOverlayModule"
void FCAVEOverlayModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}
void FCAVEOverlayModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FCAVEOverlayModule, CAVEOverlay)
\ No newline at end of file
// Fill out your copyright notice in the Description page of Project Settings.
#include "CAVEOverlayController.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DoorOverlayData.h"
#include "IDisplayCluster.h"
#include "Engine/Engine.h"
#include "IXRTrackingSystem.h"
#include "Components/InputComponent.h"
#include "Cluster/IDisplayClusterClusterManager.h"
#include "IDisplayClusterGameManager.h"
#include "IDisplayClusterConfigManager.h"
#include "UObject/ConstructorHelpers.h"
#include <array>
#include "Components/StaticMeshComponent.h"
#include "Materials/Material.h"
#include "Materials/MaterialInstanceDynamic.h"
#include "DisplayClusterExtensions/Public/VirtualRealityPawn.h"
#include "DisplayCluster/Public/DisplayClusterSceneComponent.h"
DEFINE_LOG_CATEGORY(LogCAVEOverlay);
template <std::size_t S>
bool ContainsFString(const std::array<FString, S>& Array, const FString& Entry)
{
for (FString Current_Entry : Array)
{
if (Current_Entry.Equals(Entry, ESearchCase::IgnoreCase)) return true;
}
return false;
}
UStaticMeshComponent* ACAVEOverlayController::CreateMeshComponent(const FName& Name, UStaticMesh* Mesh, USceneComponent* Parent)
{
UStaticMeshComponent* Result = CreateDefaultSubobject<UStaticMeshComponent>(Name);
Result->SetStaticMesh(Mesh);
Result->SetupAttachment(Parent);
Result->SetVisibility(false);
return Result;
}
template <typename T>
bool LoadAsset(const FString& Path, T* & Result)
{
ConstructorHelpers::FObjectFinder<T> Loader(*Path);
Result = Loader.Object;
if (!Loader.Succeeded()) UE_LOG(LogCAVEOverlay, Error, TEXT("Could not find %s. Have you renamed it?"), *Path);
return Loader.Succeeded();
}
// Sets default values
ACAVEOverlayController::ACAVEOverlayController()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
bAllowTickBeforeBeginPlay = false;
AutoReceiveInput = EAutoReceiveInput::Player0;
ConstructorHelpers::FClassFinder<UDoorOverlayData> WidgetClassFinder(TEXT("Blueprint'/CAVEOverlay/DoorOverlay'"));
if (WidgetClassFinder.Succeeded())
{
Overlay_Class = WidgetClassFinder.Class;
}
else
{
UE_LOG(LogCAVEOverlay, Error, TEXT("Could not find the DoorOverlay class. Have you renamed it?"));
}
//Creation of sub-components
Root = CreateDefaultSubobject<USceneComponent>("DefaultSceneRoot");
SetRootComponent(Root);
Tape_Root = CreateDefaultSubobject<USceneComponent>("TapeRoot");
Sign_Root = CreateDefaultSubobject<USceneComponent>("SignRoot");
Tape_Root->SetupAttachment(Root);
Sign_Root->SetupAttachment(Root);
//Loading of Materials and Meshes
LoadAsset("/CAVEOverlay/Stripes", Tape_Material);
LoadAsset("/CAVEOverlay/StopMaterial", Sign_Material);
LoadAsset("/CAVEOverlay/Plane", Plane_Mesh_);
Tape_Negative_Y = CreateMeshComponent("TapeNegY", Plane_Mesh_, Tape_Root);
Tape_Negative_X = CreateMeshComponent("TapeNegX", Plane_Mesh_, Tape_Root);
Tape_Positive_Y = CreateMeshComponent("TapePosY", Plane_Mesh_, Tape_Root);
Tape_Positive_X = CreateMeshComponent("TapePosX", Plane_Mesh_, Tape_Root);
Sign_Negative_Y = CreateMeshComponent("SignNegY", Plane_Mesh_, Sign_Root);
Sign_Negative_X = CreateMeshComponent("SignNegX", Plane_Mesh_, Sign_Root);
Sign_Positive_Y = CreateMeshComponent("SignPosY", Plane_Mesh_, Sign_Root);
Sign_Positive_X = CreateMeshComponent("SignPosX", Plane_Mesh_, Sign_Root);
//Set initial Position, Rotation and Scale of Tape
Tape_Negative_Y->SetRelativeLocationAndRotation(FVector(0, -Wall_Distance, 0), FRotator(0, 0, 90));
Tape_Positive_Y->SetRelativeLocationAndRotation(FVector(0, +Wall_Distance, 0), FRotator(0, 180, 90));
Tape_Negative_X->SetRelativeLocationAndRotation(FVector(-Wall_Distance, 0, 0), FRotator(0, -90, 90));
Tape_Positive_X->SetRelativeLocationAndRotation(FVector(+Wall_Distance, 0, 0), FRotator(0, 90, 90));
Tape_Negative_Y->SetRelativeScale3D(FVector(Wall_Distance / 100 * 2, 0.15, 1));
Tape_Positive_Y->SetRelativeScale3D(FVector(Wall_Distance / 100 * 2, 0.15, 1));
Tape_Negative_X->SetRelativeScale3D(FVector(Wall_Distance / 100 * 2, 0.15, 1));
Tape_Positive_X->SetRelativeScale3D(FVector(Wall_Distance / 100 * 2, 0.15, 1));
//Set initial Position, Rotation and Scale of Signs
Sign_Negative_Y->SetRelativeLocationAndRotation(FVector(0, -Wall_Distance, 0), FRotator(0, 0, 90));
Sign_Positive_Y->SetRelativeLocationAndRotation(FVector(0, +Wall_Distance, 0), FRotator(0, 180, 90));
Sign_Negative_X->SetRelativeLocationAndRotation(FVector(-Wall_Distance, 0, 0), FRotator(0, -90, 90));
Sign_Positive_X->SetRelativeLocationAndRotation(FVector(+Wall_Distance, 0, 0), FRotator(0, 90, 90));
Sign_Negative_Y->SetRelativeScale3D(FVector(0.5f));
Sign_Positive_Y->SetRelativeScale3D(FVector(0.5f));
Sign_Negative_X->SetRelativeScale3D(FVector(0.5f));
Sign_Positive_X->SetRelativeScale3D(FVector(0.5f));
}
void ACAVEOverlayController::PostInitializeComponents()
{
Super::PostInitializeComponents();
//Create dynamic materials in runtime
Tape_Material_Dynamic_ = UMaterialInstanceDynamic::Create(Tape_Material, Tape_Root);
Sign_Material_Dynamic_ = UMaterialInstanceDynamic::Create(Sign_Material, Sign_Root);
Tape_Negative_Y->SetMaterial(0, Tape_Material_Dynamic_);
Tape_Negative_X->SetMaterial(0, Tape_Material_Dynamic_);
Tape_Positive_Y->SetMaterial(0, Tape_Material_Dynamic_);
Tape_Positive_X->SetMaterial(0, Tape_Material_Dynamic_);
Sign_Negative_Y->SetMaterial(0, Sign_Material_Dynamic_);
Sign_Negative_X->SetMaterial(0, Sign_Material_Dynamic_);
Sign_Positive_Y->SetMaterial(0, Sign_Material_Dynamic_);
Sign_Positive_X->SetMaterial(0, Sign_Material_Dynamic_);
}
void ACAVEOverlayController::CycleDoorType()
{
Door_Current_Mode = static_cast<EDoor_Mode>((Door_Current_Mode + 1) % DOOR_NUM_MODES);
IDisplayClusterClusterManager* const Manager = IDisplayCluster::Get().GetClusterMgr();
if (Manager)
{
FDisplayClusterClusterEvent cluster_event;
cluster_event.Name = "CAVEOverlay Change Door to " + Door_Mode_Names[Door_Current_Mode];
cluster_event.Type = "DoorChange";
cluster_event.Category = "CAVEOverlay";
cluster_event.Parameters.Add("NewDoorState", FString::FromInt(Door_Current_Mode));
Manager->EmitClusterEvent(cluster_event, true);
}
}
void ACAVEOverlayController::HandleClusterEvent(const FDisplayClusterClusterEvent& Event)
{
if (Event.Category.Equals("CAVEOverlay") && Event.Type.Equals("DoorChange") && Event.Parameters.Contains("NewDoorState"))
{
SetDoorMode(static_cast<EDoor_Mode>(FCString::Atoi(*Event.Parameters["NewDoorState"])));
}
}
void ACAVEOverlayController::SetDoorMode(EDoor_Mode NewMode)
{
Door_Current_Mode = NewMode;
switch (Door_Current_Mode)
{
case EDoor_Mode::DOOR_DEBUG:
case EDoor_Mode::DOOR_PARTIALLY_OPEN:
Door_Current_Opening_Width_Absolute = Door_Opening_Width_Absolute;
if (Screen_Type == SCREEN_DOOR) Overlay->BlackBox->SetRenderScale(FVector2D(0, 1));
if (Screen_Type == SCREEN_DOOR_PARTIAL) Overlay->BlackBox->SetRenderScale(FVector2D(Door_Opening_Width_Relative, 1));
if (Screen_Type == SCREEN_MASTER) Overlay->BlackBox->SetRenderScale(FVector2D(0, 1));
Overlay->BlackBox->SetVisibility(ESlateVisibility::Visible);
break;
case EDoor_Mode::DOOR_OPEN:
Door_Current_Opening_Width_Absolute = Wall_Distance * 2;
if (Screen_Type == SCREEN_DOOR) Overlay->BlackBox->SetRenderScale(FVector2D(1, 1));
if (Screen_Type == SCREEN_DOOR_PARTIAL) Overlay->BlackBox->SetRenderScale(FVector2D(1, 1));
if (Screen_Type == SCREEN_MASTER) Overlay->BlackBox->SetRenderScale(FVector2D(0, 1));
Overlay->BlackBox->SetVisibility(ESlateVisibility::Visible);
break;
case EDoor_Mode::DOOR_CLOSED:
Door_Current_Opening_Width_Absolute = 0;
if (Screen_Type == SCREEN_DOOR) Overlay->BlackBox->SetRenderScale(FVector2D(0, 1));
if (Screen_Type == SCREEN_DOOR_PARTIAL) Overlay->BlackBox->SetRenderScale(FVector2D(0, 1));
if (Screen_Type == SCREEN_MASTER) Overlay->BlackBox->SetRenderScale(FVector2D(0, 1));
Overlay->BlackBox->SetVisibility(ESlateVisibility::Hidden);
break;
default: ;
}
if (Screen_Type == SCREEN_NORMAL) Overlay->BlackBox->SetRenderScale(FVector2D(0, 1)); //no overlay
UE_LOG(LogCAVEOverlay, Log, TEXT("Switched door state to '%s'. New opening width is %f."), *Door_Mode_Names[Door_Current_Mode], Door_Current_Opening_Width_Absolute);
if (Screen_Type == SCREEN_MASTER)
{
Overlay->CornerText->SetText(FText::FromString(Door_Mode_Names[Door_Current_Mode]));
}
}
// Called when the game starts or when spawned
void ACAVEOverlayController::BeginPlay()
{
Super::BeginPlay();
//Read situation
if (IDisplayCluster::Get().GetOperationMode() == EDisplayClusterOperationMode::Cluster)
{
auto ClusterConfigCustom = IDisplayCluster::Get().GetConfigMgr()->GetConfigCustom();
bCAVE_Mode = ClusterConfigCustom.Args.Contains("Hardware_Platform") && ClusterConfigCustom.Args.Find("Hardware_Platform")->Equals("aixcave", ESearchCase::IgnoreCase);
}
if (!bCAVE_Mode) return; // Not our business
//Input config
InputComponent->BindKey(EKeys::F10, EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
IDisplayClusterClusterManager* ClusterManager = IDisplayCluster::Get().GetClusterMgr();
if (ClusterManager && !ClusterEventListenerDelegate.IsBound())
{
ClusterEventListenerDelegate = FOnClusterEventListener::CreateUObject(this, &ACAVEOverlayController::HandleClusterEvent);
ClusterManager->AddClusterEventListener(ClusterEventListenerDelegate);
}
//Determine the screen-type for later usage
if (IDisplayCluster::Get().GetClusterMgr()->GetNodeId().Equals(Screen_Main, ESearchCase::IgnoreCase))
{
Screen_Type = SCREEN_MASTER;
}
else if (ContainsFString(Screens_Door, IDisplayCluster::Get().GetClusterMgr()->GetNodeId()))
{
Screen_Type = SCREEN_DOOR;
}
else if (ContainsFString(Screens_Door_Partial, IDisplayCluster::Get().GetClusterMgr()->GetNodeId()))
{
Screen_Type = SCREEN_DOOR_PARTIAL;
}
else
{
Screen_Type = SCREEN_NORMAL;
}
Overlay = CreateWidget<UDoorOverlayData>(GetWorld()->GetFirstPlayerController(), Overlay_Class);
Overlay->AddToViewport(0);
SetDoorMode(Door_Current_Mode);
Overlay->CornerText->SetText(FText::FromString("")); //Set Text to "" until someone presses the key for the first time
Player_Pawn = Cast<AVirtualRealityPawn>(GetWorld()->GetFirstPlayerController()->GetPawn());
RefreshPawnComponents();
if (!bAttached && Cave_Origin)
{
AttachToComponent(Cave_Origin, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
bAttached = true;
}
}
void ACAVEOverlayController::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
IDisplayClusterClusterManager* ClusterManager = IDisplayCluster::Get().GetClusterMgr();
if (ClusterManager && ClusterEventListenerDelegate.IsBound())
{
ClusterManager->RemoveClusterEventListener(ClusterEventListenerDelegate);
}
Super::EndPlay(EndPlayReason);
}
float ACAVEOverlayController::CalculateOpacityFromPosition(FVector Position)
{
return FMath::Max(
FMath::Clamp((FMath::Abs(Position.X) - (Wall_Distance - Wall_Close_Distance)) / Wall_Fade_Distance, 0.0f, 1.0f),
FMath::Clamp((FMath::Abs(Position.Y) - (Wall_Distance - Wall_Close_Distance)) / Wall_Fade_Distance, 0.0f, 1.0f)
);
}
bool ACAVEOverlayController::PositionInDoorOpening(FVector Position)
{
return FMath::IsWithinInclusive(-Position.X, Wall_Distance + 10 - 20 - Wall_Close_Distance, Wall_Distance + 10) //Overlap both sides 10cm
&& FMath::IsWithinInclusive(-Position.Y, Wall_Distance + 10 - Door_Current_Opening_Width_Absolute, Wall_Distance + 10); //Overlap one side 10cm
}
void ACAVEOverlayController::RefreshPawnComponents()
{
Cave_Origin = Player_Pawn->GetTrackingOriginComponent();
Shutter_Glasses = Player_Pawn->GetHeadComponent();
}
// Called every frame
void ACAVEOverlayController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (!bCAVE_Mode) return; // Not our business
if (!Cave_Origin || !Shutter_Glasses)
{
RefreshPawnComponents();
}
if (!bAttached && Cave_Origin)
{
AttachToComponent(Cave_Origin, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
bAttached = true;
}
//FPS Counter
if (Overlay)
{
if (Door_Current_Mode == EDoor_Mode::DOOR_DEBUG && ContainsFString(Screens_FPS, IDisplayCluster::Get().GetClusterMgr()->GetNodeId()))
{
Overlay->FPS->SetText(FText::FromString(FString::Printf(TEXT("FPS: %.1f"), 1.0f / DeltaTime)));
}
else
{
Overlay->FPS->SetText(FText::FromString(""));
}
}
if (!Shutter_Glasses) return; //Display Cluster not initialized
//Tape Logic
FVector Shutter_Position = Shutter_Glasses->GetRelativeTransform().GetLocation();
bool bOverlay_Visible = FMath::IsWithinInclusive(Shutter_Position.GetAbsMax(), Wall_Distance - Wall_Close_Distance, Wall_Distance);
if (bOverlay_Visible && !PositionInDoorOpening(Shutter_Position))
{
Tape_Root->SetVisibility(true, true);
Tape_Root->SetRelativeLocation(Shutter_Position * FVector(0, 0, 1)); //Only apply Z
float Tape_Opacity = CalculateOpacityFromPosition(Shutter_Position);
Tape_Material_Dynamic_->SetScalarParameterValue("BarrierOpacity", Tape_Opacity);
if (FMath::IsWithin(FVector2D(Shutter_Position).GetAbsMax(), Wall_Distance - Wall_Warning_Distance, Wall_Distance))
{
//in warning distance == red tape
Tape_Material_Dynamic_->SetVectorParameterValue("StripeColor", FVector(1, 0, 0));
}
else
{
Tape_Material_Dynamic_->SetVectorParameterValue("StripeColor", FVector(1, 1, 0));
}
}
else
{
Tape_Root->SetVisibility(false, true);
}
//Sign Logic
UDisplayClusterSceneComponent* Flystick = IDisplayCluster::Get().GetGameMgr()->GetNodeById(TEXT("flystick"));
if (Flystick)
{
FVector Flystick_Position = Flystick->GetRelativeTransform().GetLocation();
bool bFlystick_In_Door = PositionInDoorOpening(Flystick_Position);
float Sign_Opacity = CalculateOpacityFromPosition(Flystick_Position);
Sign_Negative_X->SetRelativeLocation(FVector(-Wall_Distance, Flystick_Position.Y, Flystick_Position.Z));
Sign_Negative_Y->SetRelativeLocation(FVector(Flystick_Position.X, -Wall_Distance, Flystick_Position.Z));
Sign_Positive_X->SetRelativeLocation(FVector(+Wall_Distance, Flystick_Position.Y, Flystick_Position.Z));
Sign_Positive_Y->SetRelativeLocation(FVector(Flystick_Position.X, +Wall_Distance, Flystick_Position.Z));
Sign_Negative_X->SetVisibility(FMath::IsWithin(-Flystick_Position.X, Wall_Distance - Wall_Close_Distance, Wall_Distance) && !bFlystick_In_Door);
Sign_Negative_Y->SetVisibility(FMath::IsWithin(-Flystick_Position.Y, Wall_Distance - Wall_Close_Distance, Wall_Distance) && !bFlystick_In_Door);
Sign_Positive_X->SetVisibility(FMath::IsWithin(+Flystick_Position.X, Wall_Distance - Wall_Close_Distance, Wall_Distance) && !bFlystick_In_Door);
Sign_Positive_Y->SetVisibility(FMath::IsWithin(+Flystick_Position.Y, Wall_Distance - Wall_Close_Distance, Wall_Distance) && !bFlystick_In_Door);
Sign_Material_Dynamic_->SetScalarParameterValue("SignOpacity", Sign_Opacity);
}
else
{
Sign_Negative_X->SetVisibility(false);
Sign_Negative_Y->SetVisibility(false);
Sign_Positive_X->SetVisibility(false);
Sign_Positive_Y->SetVisibility(false);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment