diff --git a/LaunchConfig/minicave.cfg b/LaunchConfig/minicave.cfg new file mode 100644 index 0000000000000000000000000000000000000000..b58e85793decb841a6885d311626affe358e432f --- /dev/null +++ b/LaunchConfig/minicave.cfg @@ -0,0 +1,235 @@ +##################################################################### +# nDisplay config file for aixCAVE +##################################################################### + +##################################################################### +# Config info +#******************************************************************** +# This is a config file header. +# +# Properties: +# version - specifies the version of the configuration file (UE4.xx) +#******************************************************************** +[info] version=22 + +##################################################################### +# Cluster nodes +#******************************************************************** +# Cluster node is an application instance. It's allowed to use +# multiple instances on the same PC. Sometimes its necessary. +# +# Properties: +# id - Unique node name +# window - Window ID +# addr - Network address (IPv4 only) +# master - Specifies if current node is master; default is 'false' +# port_cs - Cluster Synchronization port (required on master node only) +# port_ss - Swap Synchronization port (required on master node only) +# port_ce - Cluster Events port (required on master node only) +# +# Optional properties: +# eye_swap - Swap eyes for this node; default is 'false' +# sound - turns on/off sound for this application instance; default is 'false' +#******************************************************************** +[cluster_node] id=node_floor addr=127.0.0.1 window=wnd_floor port_cs=41001 port_ss=41002 port_ce=41003 master=true sound=true +[cluster_node] id=node_front addr=127.0.0.1 window=wnd_front +[cluster_node] id=node_left addr=127.0.0.1 window=wnd_left +[cluster_node] id=node_right addr=127.0.0.1 window=wnd_right +[cluster_node] id=node_back addr=127.0.0.1 window=wnd_back + +##################################################################### +# Application windows +#******************************************************************** +# The window entitty defines properties of application's game window. +# +# Properties: +# id - Unique window name +# fullscreen - Fullscreen or windowed mode +# winx - X location +# winy - Y location +# resx - Width +# resy - Height +# viewports - Array of viewports +#******************************************************************** + +[window] id=wnd_floor viewports=vp_floor +[window] id=wnd_front viewports=vp_front +[window] id=wnd_left viewports=vp_left +[window] id=wnd_right viewports=vp_right +[window] id=wnd_back viewports=vp_back + +##################################################################### +# Projection screens +#******************************************************************** +# Projection screen is a rectangle which determines the camera frustum. +# Usually the projection screen has the same dimensions as an output +# display but in some cases it may differ. +# +# Properties: +# id - unique projection screen name +# loc - relative location to the parent component. Location is relative +# to the VR root if no parent specified. The pivot is a screen's +# center and the values are in meters. +# rot - relative rotation to the parent component. Rotation is relative +# to the VR root if no parent specified. The pivot is a screen's +# center and the values are in degrees. +# size - width (X) and height (Y) of the screen. Values are in meters. +# +# Optional properties: +# parent - ID of parent component in VR hierarchy; default is VR root. +# tracker_id - ID of tracking device; no tracking by default. +# tracker_ch - ID of tracking device's channel; no tracking by default. +#******************************************************************** + +[screen] id=screen_floor loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" size="X=5.25,Y=5.25" parent=loc_floor +[screen] id=screen_front loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" size="X=5.25,Y=3.3" parent=loc_front +[screen] id=screen_left loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" size="X=3.3,Y=5.25" parent=loc_left +[screen] id=screen_right loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" size="X=3.3,Y=5.25" parent=loc_right +[screen] id=screen_back loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" size="X=5.25,Y=3.3" parent=loc_back + +##################################################################### +# Viewports +#******************************************************************** +# Viewport is a rectangle area of game window where rendered frame is +# mapped. Usually the viewport starts at 0:0 and has the same size as +# its parent window but in some cases these settings may differ. +# +# Properties: +# id - unique viewport name +# x - X coordinate of viewport's top left corner +# y - Y coordinate of viewport's top left corner +# width - width of viewport in pixels +# height - height of viewport in pixels +#******************************************************************** + +[viewport] id=vp_floor screen=screen_floor x=0 y=0 width=480 height=480 +[viewport] id=vp_front screen=screen_front x=0 y=0 width=480 height=300 +[viewport] id=vp_left screen=screen_left x=0 y=0 width=300 height=480 +[viewport] id=vp_right screen=screen_right x=0 y=0 width=300 height=480 +[viewport] id=vp_back screen=screen_back x=0 y=0 width=480 height=300 + +##################################################################### +# Cameras +#******************************************************************** +# Camera is a predefined point frome where the stereoscopic view built. +# It's possible to define multiple cameras and swith the active one +# during runtime. You're free to attach any camera to a tracking device +# for head tracking. Consider a camera as a viewer's head. +# +# Properties: +# id - unique camera name +# loc - relative location to the parent component. Location is relative +# to the VR root if no parent specified. +# rot - relative rotation to the parent component. Rotation is relative +# to the VR root if no parent specified. +# +# Optional properties: +# parent - ID of parent component in VR hierarchy; default is VR root. +# tracker_id - ID of tracking device; no tracking by default. +# tracker_ch - ID of tracking device's channel; no tracking by default. +#******************************************************************** + +[camera] id=camera_dynamic loc="X=0,Y=0,Z=0" parent=shutter_glasses + +##################################################################### +# Scene nodes (hierarchy transforms) +#******************************************************************** +# Scene node is an actor component which is basically a transformation +# matrix. Scene nodes can be helpful to build a component hierarchy, to +# define some special places (like a socket) within VR space. +# +# It might be difficult to understand what VR space origin is. Consider +# it as a point in space where VR space starts. Any componenent listed +# in this config file is relative to its parent or this origin. +# +# Properties: +# id - unique scene node name +# loc - relative location to the parent component. Location is relative +# to the VR root if no parent specified. +# rot - relative rotation to the parent component. Rotation is relative +# to the VR root if no parent specified. +# +# Optional properties: +# parent - ID of parent component in VR hierarchy; default is VR root. +# tracker_id - ID of tracking device; no tracking by default. +# tracker_ch - ID of tracking device's channel; no tracking by default. +#******************************************************************** + +[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=1.65" rot="P=0,Y=0,R=0" parent=cave_origin + +[scene_node] id=angle_front loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" parent=cave_center +[scene_node] id=angle_left loc="X=0,Y=0,Z=0" rot="P=0,Y=-90,R=90" parent=cave_center +[scene_node] id=angle_right loc="X=0,Y=0,Z=0" rot="P=0,Y=90,R=-90" parent=cave_center +[scene_node] id=angle_back loc="X=0,Y=0,Z=0" rot="P=0,Y=180,R=180" parent=cave_center +[scene_node] id=angle_floor loc="X=0,Y=0,Z=0" rot="P=-90,Y=0,R=0" parent=cave_origin + +[scene_node] id=loc_front loc="X=2.625,Y=0.01,Z=0.01" rot="P=0,Y=0,R=0" parent=angle_front +[scene_node] id=loc_left loc="X=2.625,Y=0.01,Z=0.01" rot="P=0,Y=0,R=0" parent=angle_left +[scene_node] id=loc_right loc="X=2.625,Y=0.01,Z=0.01" rot="P=0,Y=0,R=0" parent=angle_right +[scene_node] id=loc_back loc="X=2.625,Y=0.01,Z=0.01" rot="P=0,Y=0,R=0" parent=angle_back +[scene_node] id=loc_floor loc="X=0.001,Y=0.01,Z=0.01" rot="P=0,Y=0,R=0" parent=angle_floor + +##################################################################### +# Input devices +#******************************************************************** +# Input devices are VRPN devices. The nDisplay supports the following +# types: analog, button and tracker. Many of physical input devices +# can be connected via VRPN. +# +# Properties: +# id - nique device name +# type - VRPN type (analog, button or tracker). +# addr - address of a VRPN server which handles this particular device. +# The value must match the following format: DEVICENAME@SERVER_ADDRESS +# where DEVICENAME is a VRPN name of this device and SERVER_ADDRESS +# is IPv4 address of VRPN server. +# loc - relative location to the parent component. Location is relative +# to the VR root if no parent specified. +# rot - relative rotation to the parent component. Rotation is relative +# to the VR root if no parent specified. +# +# front (tracker only) - mapping of a tracking system axis to X axis of VR origin +# right (tracker only) - mapping of a tracking system axis to Y axis of VR origin +# up (tracker only) - mapping of a tracking system axis to Z axis of VR origin +# * The following values are allowed for axes mapping: X, -X, Y, -Y, Z, -Z +# +# Optional properties: +# remap - VRPN device channel remapping. Value format is: "from0:to0,from1:to1,...,fromN:toN". +# For example: remap="0:3,1:4,5:2" +#******************************************************************** + +##################################################################### +# Stereoscopic settings +#******************************************************************** +# Properties: +# eye_dist - interoccular distance in meters +[stereo] eye_dist=0.064 +##################################################################### +# General settings +#******************************************************************** +# Properties: +# swap_sync_policy - swap synchronization policy +# - 0 - no synchronization +# - 1 - software swap synchronization +# - 2 - NV swap lock (Nvidia cards only, OpenGL only) +[general] swap_sync_policy=1 + +##################################################################### +# Network settings +#******************************************************************** +# Optional properties: +# cln_conn_tries_amount - how many times a client tries to connect to a server +# cln_conn_retry_delay - delay before next client connection try (milliseconds) +# game_start_timeout - timeout before all data is loaded and game started (milliseconds) +# barrier_wait_timeout - barrier timeout for both game and render threads (milliseconds) +[network] cln_conn_tries_amount=300 cln_conn_retry_delay=1000 game_start_timeout=60000 barrier_wait_timeout=60000 + +##################################################################### +# Custom arguments +#******************************************************************** +# Any custom arguments available in runtime can be specified here. +# Format: ARG_NAME=ARG_VAL +[custom] Hardware_Platform=VirtualCAVE diff --git a/Resources/ButtonIcon_40x.png b/Resources/CAVEIcon_40x.png similarity index 100% rename from Resources/ButtonIcon_40x.png rename to Resources/CAVEIcon_40x.png diff --git a/Resources/Icon128.png b/Resources/Icon128.png deleted file mode 100644 index 9d68baba746cc3b0e99650a88e6ce306205c2351..0000000000000000000000000000000000000000 Binary files a/Resources/Icon128.png and /dev/null differ diff --git a/Resources/ROLVIcon_40x.png b/Resources/ROLVIcon_40x.png new file mode 100644 index 0000000000000000000000000000000000000000..8b79e58416229a9dea1599bcf973b9ceddb75cc2 Binary files /dev/null and b/Resources/ROLVIcon_40x.png differ diff --git a/Source/CAVELaunchButton/Private/CAVELaunchButton.cpp b/Source/CAVELaunchButton/Private/CAVELaunchButton.cpp index 0aba3ae2713b0d96c043127971bb29fdf665beb8..342df538331339494ccb85a998772b0a7735a7c2 100644 --- a/Source/CAVELaunchButton/Private/CAVELaunchButton.cpp +++ b/Source/CAVELaunchButton/Private/CAVELaunchButton.cpp @@ -1,12 +1,13 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "CAVELaunchButton.h" -#include <stdlib.h> - #include "CAVELaunchButtonStyle.h" +#include "CAVELaunchButtonSettings.h" #include "CAVELaunchButtonCommands.h" #include "Misc/MessageDialog.h" #include "Framework/MultiBox/MultiBoxBuilder.h" +#include "IPluginManager.h" +#include "Misc/EngineVersion.h" #include "LevelEditor.h" @@ -33,7 +34,7 @@ void FCAVELaunchButtonModule::StartupModule() { TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender); ToolbarExtender->AddToolBarExtension("Game", EExtensionHook::First, PluginCommands, FToolBarExtensionDelegate::CreateRaw(this, &FCAVELaunchButtonModule::AddToolbarExtension)); - + LevelEditorModule.GetToolBarExtensibilityManager()->AddExtender(ToolbarExtender); } } @@ -49,12 +50,42 @@ void FCAVELaunchButtonModule::ShutdownModule() void FCAVELaunchButtonModule::PluginButtonClicked() { - int result = system("C:\\test.bat"); -} +// minimize the root window to provide max performance for the preview. +TSharedPtr<SWindow> RootWindow = FGlobalTabmanager::Get()->GetRootWindow(); +if (RootWindow.IsValid()) RootWindow->Minimize(); + +#if PLATFORM_WINDOWS + const UCAVELaunchButtonSettings* Settings = GetDefault<UCAVELaunchButtonSettings>(); -void FCAVELaunchButtonModule::AddMenuExtension(FMenuBuilder& Builder) -{ - Builder.AddMenuEntry(FCAVELaunchButtonCommands::Get().PluginAction); + if (Settings->StartROLVInsteadOfCAVE) { + UE_LOG(LogTemp, Log, TEXT("This would launch ROLV!")); + } else { + FString Config = IPluginManager::Get().FindPlugin("CAVELaunchButton")->GetBaseDir() + "/LaunchConfig/minicave.cfg"; + FString EditorExecutable = "UE4Editor.exe"; //FPaths::ConvertRelativePathToFull(FPaths::EngineDir()) + "/Binaries/Win64/UE4Editor.exe"; + FString Parameters = "\"" + FPaths::GetProjectFilePath() + "\" -game -windowed -fixedseed -notexturestreaming -opengl4 dc_cfg=\"" + Config + "\" -dc_cluster -dc_dev_mono"; + + const int num_nodes = 5; + FString Windows_Node_Specific_Commands[num_nodes] = { + "dc_node=node_floor WinX=720 WinY=300 ResX=480 ResY=480 -log ABSLOG=" + FPaths::ProjectDir() + "\\MiniCaveMulti.log " + Settings->AdditionalParameters + " " + Settings->AdditionalParametersMaster, + "dc_node=node_front WinX=720 WinY=0 ResX=480 ResY=300 " + Settings->AdditionalParameters, + "dc_node=node_left WinX=420 WinY=300 ResX=300 ResY=480 " + Settings->AdditionalParameters, + "dc_node=node_right WinX=1200 WinY=300 ResX=300 ResY=480 " + Settings->AdditionalParameters, + "dc_node=node_back WinX=720 WinY=780 ResX=480 ResY=300 " + Settings->AdditionalParameters + }; + + FProcHandle processes[num_nodes]; + + for(int i = 0; i < num_nodes; i++){ + processes[i] = FPlatformProcess::CreateProc(*EditorExecutable, *(Parameters + " " + Windows_Node_Specific_Commands[i]), true, false, false, NULL, 0, NULL, NULL); + } + FPlatformProcess::WaitForProc(processes[num_nodes - 1]); + } +#elif PLATFORM_LINUX + FProcHandle process = FPlatformProcess::CreateProc(*FString("/home/av006de/demos_UNREAL/.misc/scripts/cave/launch_aixcave_editor.sh"), *("\"" + (FPaths::ConvertRelativePathToFull(FPaths::EngineDir()) + "\\Binaries\\Linux\\UE4Editor\" ") + FPaths::GetProjectFilePath() + " " + FEngineVersion::Current().GetMajor() + FEngineVersion::Current().GetMinor()), true, false, false, NULL, 0, NULL, NULL); + FPlatformProcess::WaitForProc(process); +#endif + + if (RootWindow.IsValid()) RootWindow->Maximize(); } void FCAVELaunchButtonModule::AddToolbarExtension(FToolBarBuilder& Builder) diff --git a/Source/CAVELaunchButton/Private/CAVELaunchButtonCommands.cpp b/Source/CAVELaunchButton/Private/CAVELaunchButtonCommands.cpp index 111b18c20b188ea58bb9f8866e5c9501d3cfe0c9..5836330db940c3d14d1bacd6501d785d707e25c2 100644 --- a/Source/CAVELaunchButton/Private/CAVELaunchButtonCommands.cpp +++ b/Source/CAVELaunchButton/Private/CAVELaunchButtonCommands.cpp @@ -1,12 +1,19 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "CAVELaunchButtonCommands.h" +#include "CAVELaunchButtonSettings.h" #define LOCTEXT_NAMESPACE "FCAVELaunchButtonModule" void FCAVELaunchButtonCommands::RegisterCommands() { - UI_COMMAND(PluginAction, "PlayInCAVE", "Launch current project in CAVE", EUserInterfaceActionType::Button, FInputGesture()); + if(GetDefault<UCAVELaunchButtonSettings>()->StartROLVInsteadOfCAVE) + { + UI_COMMAND(PluginAction, "PlayOnROLV", "Launch current project on ROLV", EUserInterfaceActionType::Button, FInputGesture()); + }else + { + UI_COMMAND(PluginAction, "PlayInCAVE", "Launch current project in CAVE", EUserInterfaceActionType::Button, FInputGesture()); + } } #undef LOCTEXT_NAMESPACE diff --git a/Source/CAVELaunchButton/Private/CAVELaunchButtonStyle.cpp b/Source/CAVELaunchButton/Private/CAVELaunchButtonStyle.cpp index ff84cf8ae221a189719224161bbd42ab6b2f692e..2cb329f18368979abce2c3c59ab8ba056fa3a2c6 100644 --- a/Source/CAVELaunchButton/Private/CAVELaunchButtonStyle.cpp +++ b/Source/CAVELaunchButton/Private/CAVELaunchButtonStyle.cpp @@ -6,6 +6,7 @@ #include "Styling/SlateStyleRegistry.h" #include "Slate/SlateGameResources.h" #include "Interfaces/IPluginManager.h" +#include "CAVELaunchButtonSettings.h" TSharedPtr< FSlateStyleSet > FCAVELaunchButtonStyle::StyleInstance = NULL; @@ -46,8 +47,14 @@ TSharedRef< FSlateStyleSet > FCAVELaunchButtonStyle::Create() TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("CAVELaunchButtonStyle")); Style->SetContentRoot(IPluginManager::Get().FindPlugin("CAVELaunchButton")->GetBaseDir() / TEXT("Resources")); - Style->Set("CAVELaunchButton.PluginAction", new IMAGE_BRUSH(TEXT("ButtonIcon_40x"), Icon40x40)); - + if (GetDefault<UCAVELaunchButtonSettings>()->StartROLVInsteadOfCAVE) + { + Style->Set("CAVELaunchButton.PluginAction", new IMAGE_BRUSH(TEXT("ROLVIcon_40x"), Icon40x40)); + }else + { + Style->Set("CAVELaunchButton.PluginAction", new IMAGE_BRUSH(TEXT("CAVEIcon_40x"), Icon40x40)); + } + return Style; } diff --git a/Source/CAVELaunchButton/Public/CAVELaunchButton.h b/Source/CAVELaunchButton/Public/CAVELaunchButton.h index 22b0a82e723931220d8c6c2a81f756c9c0357172..b0f7a5554557aaa53b34cd2bc998de70ccc417be 100644 --- a/Source/CAVELaunchButton/Public/CAVELaunchButton.h +++ b/Source/CAVELaunchButton/Public/CAVELaunchButton.h @@ -8,6 +8,7 @@ class FToolBarBuilder; class FMenuBuilder; + class FCAVELaunchButtonModule : public IModuleInterface { public: @@ -22,8 +23,7 @@ public: private: void AddToolbarExtension(FToolBarBuilder& Builder); - void AddMenuExtension(FMenuBuilder& Builder); - + private: TSharedPtr<class FUICommandList> PluginCommands; }; diff --git a/Source/CAVELaunchButton/Public/CAVELaunchButtonSettings.h b/Source/CAVELaunchButton/Public/CAVELaunchButtonSettings.h new file mode 100644 index 0000000000000000000000000000000000000000..632c66375cc9e99249ada8ef9599b9d25422c55c --- /dev/null +++ b/Source/CAVELaunchButton/Public/CAVELaunchButtonSettings.h @@ -0,0 +1,20 @@ +#pragma once +#include "CoreMinimal.h" +#include "Engine/DeveloperSettings.h" +#include "CAVELaunchButtonSettings.generated.h" + +UCLASS(config=Engine, defaultconfig, meta=(DisplayName="nDisplay Launch Button")) +class UCAVELaunchButtonSettings : public UDeveloperSettings +{ + GENERATED_BODY() +public: + + UPROPERTY(EditAnywhere, config, Category = LaunchParametersWindows) + FString AdditionalParameters = ""; + + UPROPERTY(EditAnywhere, config, Category = LaunchParametersWindows) + FString AdditionalParametersMaster = ""; + + UPROPERTY(EditAnywhere, config, Category = Platform, meta = (ConfigRestartRequired = true)) + bool StartROLVInsteadOfCAVE = false; +}; diff --git a/Source/CAVELaunchButton/Public/CAVELaunchButtonStyle.h b/Source/CAVELaunchButton/Public/CAVELaunchButtonStyle.h index a6fcf0168d765f2aec655bb0b91307567162fa8a..617d0e7b700369c0a4ea31fd1601c3b86fc524ce 100644 --- a/Source/CAVELaunchButton/Public/CAVELaunchButtonStyle.h +++ b/Source/CAVELaunchButton/Public/CAVELaunchButtonStyle.h @@ -20,12 +20,12 @@ public: static const ISlateStyle& Get(); static FName GetStyleSetName(); - + private: - + static TSharedRef< class FSlateStyleSet > Create(); private: static TSharedPtr< class FSlateStyleSet > StyleInstance; -}; \ No newline at end of file +};