implement the game user settings system

This commit is contained in:
Mamadou Babaei
2024-08-16 18:01:37 +02:00
parent 0405f6bc7c
commit 32073d34f4
16 changed files with 891 additions and 34 deletions
@@ -35,6 +35,9 @@
#include "SenseGlove/Engine/SGGameInstance.h"
#include "Engine/Engine.h"
#include "SenseGlove/GameFramework/SGGameUserSettings.h"
#include "SGLog/SGLog.h"
USGGameInstance::USGGameInstance(const FObjectInitializer& ObjectInitializer)
@@ -47,6 +50,8 @@ void USGGameInstance::Init()
Super::Init();
SGLOG("Initializing the SenseGlove GameInstance...")
SGLOG("The SenseGlove GameInstance has been initialized successfully!")
}
void USGGameInstance::Shutdown()
@@ -54,4 +59,6 @@ void USGGameInstance::Shutdown()
Super::Shutdown();
SGLOG("Shutting down the SenseGlove GameInstance...")
SGLOG("The SenseGlove GameInstance has been shutdown successfully!")
}
@@ -0,0 +1,254 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SenseGlove/GameFramework/SGGameUserSettings.h"
#include "SGSettings/SGSettings.h"
struct USGGameUserSettings::FImpl
{
/************************
* Static methods
************************/
/************************
* Owner object
************************/
USGGameUserSettings* Owner;
/************************
* Constructor / Destructor
************************/
explicit FImpl(USGGameUserSettings* InOwner);
~FImpl();
/************************
* Default copy constructor & copy assignment operator
************************/
FImpl(const FImpl& Rhs) = default;
FImpl& operator=(const FImpl& Rhs) = default;
/************************
* Methods
************************/
bool DoesCurrentSettingsMatch(ESGEngineScalabilitySettings Scalability, float ResolutionScaleNormalized) const;
};
USGGameUserSettings::USGGameUserSettings(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer),
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}, PimplDeleter))
{
}
USGGameUserSettings* USGGameUserSettings::GetInstance()
{
USGGameUserSettings* Instance{GEngine ? Cast<USGGameUserSettings>(GEngine->GetGameUserSettings()) : nullptr};
ensureAlwaysMsgf(Instance, TEXT("Invalid GameUserSettings!"));
return Instance;
}
ESGEngineScalabilitySettings USGGameUserSettings::GetEngineScalabilitySettings() const
{
const FSGGameUserSettingSettings& Settings{USGSettings::GetInstance()->GetGameUserSettings()};
const bool bDoesCurrentSettingsMatchLow = Pimpl->DoesCurrentSettingsMatch(
ESGEngineScalabilitySettings::Low, Settings.ResolutionScaleNormalizedLow);
if (bDoesCurrentSettingsMatchLow)
{
return ESGEngineScalabilitySettings::Low;
}
const bool bDoesCurrentSettingsMatchMedium = Pimpl->DoesCurrentSettingsMatch(
ESGEngineScalabilitySettings::Medium, Settings.ResolutionScaleNormalizedMedium);
if (bDoesCurrentSettingsMatchMedium)
{
return ESGEngineScalabilitySettings::Medium;
}
const bool bDoesCurrentSettingsMatchHigh = Pimpl->DoesCurrentSettingsMatch(
ESGEngineScalabilitySettings::High, Settings.ResolutionScaleNormalizedHigh);
if (bDoesCurrentSettingsMatchHigh)
{
return ESGEngineScalabilitySettings::High;
}
const bool bDoesCurrentSettingsMatchEpic = Pimpl->DoesCurrentSettingsMatch(
ESGEngineScalabilitySettings::Epic, Settings.ResolutionScaleNormalizedEpic);
if (bDoesCurrentSettingsMatchEpic)
{
return ESGEngineScalabilitySettings::Epic;
}
const bool bDoesCurrentSettingsMatchCinematic = Pimpl->DoesCurrentSettingsMatch(
ESGEngineScalabilitySettings::Cinematic, Settings.ResolutionScaleNormalizedCinematic);
if (bDoesCurrentSettingsMatchCinematic)
{
return ESGEngineScalabilitySettings::Cinematic;
}
static constexpr int32 ScalabilityMinValue = 0;
static constexpr int32 ScalabilityMaxValue = static_cast<int32>(ESGEngineScalabilitySettings::Cinematic);
const int32 OverallScalabilityLevel = GetOverallScalabilityLevel();
if (OverallScalabilityLevel >= ScalabilityMinValue && OverallScalabilityLevel <= ScalabilityMaxValue)
{
return static_cast<ESGEngineScalabilitySettings>(OverallScalabilityLevel);
}
return ESGEngineScalabilitySettings::Epic;
}
void USGGameUserSettings::SetEngineScalabilitySettings(ESGEngineScalabilitySettings Scalability)
{
const FSGGameUserSettingSettings& Settings{USGSettings::GetInstance()->GetGameUserSettings()};
if (IsDirty())
{
ValidateSettings();
ConfirmVideoMode();
}
if (Scalability != ESGEngineScalabilitySettings::Auto)
{
float ResolutionScaleNormalized = 0.0f;
switch (Scalability)
{
case ESGEngineScalabilitySettings::Low:
ResolutionScaleNormalized = Settings.ResolutionScaleNormalizedLow;
break;
case ESGEngineScalabilitySettings::Medium:
ResolutionScaleNormalized = Settings.ResolutionScaleNormalizedMedium;
break;
case ESGEngineScalabilitySettings::High:
ResolutionScaleNormalized = Settings.ResolutionScaleNormalizedHigh;
break;
case ESGEngineScalabilitySettings::Epic:
ResolutionScaleNormalized = Settings.ResolutionScaleNormalizedEpic;
break;
case ESGEngineScalabilitySettings::Cinematic:
ResolutionScaleNormalized = Settings.ResolutionScaleNormalizedCinematic;
break;
default:
break;
}
SetResolutionScaleNormalized(ResolutionScaleNormalized);
const int32 ScalabilityValue = static_cast<int32>(Scalability);
SetViewDistanceQuality(ScalabilityValue);
SetAntiAliasingQuality(ScalabilityValue);
SetShadowQuality(ScalabilityValue);
SetGlobalIlluminationQuality(ScalabilityValue);
SetReflectionQuality(ScalabilityValue);
SetPostProcessingQuality(ScalabilityValue);
SetTextureQuality(ScalabilityValue);
SetVisualEffectQuality(ScalabilityValue);
SetFoliageQuality(ScalabilityValue);
SetShadingQuality(ScalabilityValue);
SetOverallScalabilityLevel(ScalabilityValue);
}
else
{
RunHardwareBenchmark(
Settings.HardwareBenchmarkWorkScale,
Settings.HardwareBenchmarkCPUMultiplier,
Settings.HardwareBenchmarkGPUMultiplier);
ApplyHardwareBenchmarkResults();
}
ConfirmVideoMode();
ApplySettings(false);
}
USGGameUserSettings::FImpl::FImpl(USGGameUserSettings* InOwner)
: Owner(InOwner)
{
}
USGGameUserSettings::FImpl::~FImpl() = default;
bool USGGameUserSettings::FImpl::DoesCurrentSettingsMatch(
const ESGEngineScalabilitySettings Scalability, const float ResolutionScaleNormalized) const
{
const ESGEngineScalabilitySettings CurrentViewDistanceQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetViewDistanceQuality());
const ESGEngineScalabilitySettings CurrentAntiAliasingQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetAntiAliasingQuality());
const ESGEngineScalabilitySettings CurrentShadowQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetShadowQuality());
const ESGEngineScalabilitySettings CurrentGlobalIlluminationQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetGlobalIlluminationQuality());
const ESGEngineScalabilitySettings CurrentReflectionQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetReflectionQuality());
const ESGEngineScalabilitySettings CurrentPostProcessingQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetPostProcessingQuality());
const ESGEngineScalabilitySettings CurrentTextureQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetTextureQuality());
const ESGEngineScalabilitySettings CurrentVisualEffectQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetVisualEffectQuality());
const ESGEngineScalabilitySettings CurrentFoliageQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetFoliageQuality());
const ESGEngineScalabilitySettings CurrentShadingQuality =
static_cast<ESGEngineScalabilitySettings>(Owner->GetShadingQuality());
const float CurrentResolutionScaleNormalized = Owner->GetResolutionScaleNormalized();
if (FMath::IsNearlyEqual(CurrentResolutionScaleNormalized, ResolutionScaleNormalized)
&& CurrentViewDistanceQuality == Scalability
&& CurrentAntiAliasingQuality == Scalability
&& CurrentShadowQuality == Scalability
&& CurrentGlobalIlluminationQuality == Scalability
&& CurrentReflectionQuality == Scalability
&& CurrentPostProcessingQuality == Scalability
&& CurrentTextureQuality == Scalability
&& CurrentVisualEffectQuality == Scalability
&& CurrentFoliageQuality == Scalability
&& CurrentShadingQuality == Scalability)
{
return true;
}
return false;
}
void USGGameUserSettings::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
@@ -34,13 +34,21 @@
#include "SenseGloveModule.h"
#include "GameMapsSettings.h"
#include "SGLog/SGLog.h"
#include "SenseGlove/Engine/SGGameInstance.h"
#include "SenseGlove/GameFramework/SGGameModeBase.h"
#include "SenseGlove/GameFramework/SGGameUserSettings.h"
#define LOCTEXT_NAMESPACE "FSenseGloveModule"
void FSenseGloveModule::StartupModule()
{
SGLOG("Starting up the SenseGlove module...");
OnPostEngineInitHandle = FCoreDelegates::OnPostEngineInit.AddRaw(
this, &FSenseGloveModule::OnPostEngineInit);
}
void FSenseGloveModule::PreUnloadCallback()
@@ -56,6 +64,143 @@ void FSenseGloveModule::PostLoadCallback()
void FSenseGloveModule::ShutdownModule()
{
SGLOG("Shutting down the SenseGlove module...");
FCoreDelegates::OnPostEngineInit.Remove(OnPostEngineInitHandle);
}
void FSenseGloveModule::OnPostEngineInit() const
{
SGLOG("Checking whether the GameMapsSettings is compliant with SenseGlove, or not...");
UGameMapsSettings* GameMapsSettings{UGameMapsSettings::GetGameMapsSettings()};
if (ensureAlwaysMsgf(GameMapsSettings, TEXT("Invalid GameMapsSettings!")))
{
/*************************************************************************************************************
* GameInstanceClass
*************************************************************************************************************/
{
SGLOG("Validating if the GameInstanceClass is a SenseGlove GameInstance...");
bool bValidGameInstance = false;
const UClass* CurrentGameInstanceClass{GameMapsSettings->GameInstanceClass.TryLoadClass<UObject>()};
if (CurrentGameInstanceClass)
{
if (CurrentGameInstanceClass->IsChildOf(USGGameInstance::StaticClass()))
{
bValidGameInstance = true;
SGLOG("The GameInstanceClass is a SenseGlove GameInstance, or a subclass.");
}
else
{
SGLOG("The GameInstanceClass is not a SenseGlove GameInstance, or a subclass.");
}
}
else
{
SGLOG_ERROR("Failed to construct a valid GameInstance from the current settings!");
}
if (!bValidGameInstance)
{
SGLOG("Setting the SenseGlove GameInstance as the GameInstanceClass...");
static const FSoftClassPath GameInstanceClassPath{TEXT("/Script/SenseGlove.SGGameInstance")};
GameMapsSettings->GameInstanceClass = GameInstanceClassPath;
SGLOG("Successfully set the SenseGlove GameInstance as the GameInstanceClass!");
}
}
/*************************************************************************************************************
* DefaultGameMode
*************************************************************************************************************/
{
SGLOG("Validating if the DefaultGameMode is a SenseGlove GameMode...");
bool bValidDefaultGameMode = false;
const FSoftClassPath CurrentDefaultGameModeClassPath{GameMapsSettings->GetGlobalDefaultGameMode()};
const UClass* CurrentDefaultGameMode{CurrentDefaultGameModeClassPath.TryLoadClass<UObject>()};
if (CurrentDefaultGameMode)
{
if (CurrentDefaultGameMode->IsChildOf(ASGGameModeBase::StaticClass()))
{
bValidDefaultGameMode = true;
SGLOG("The DefaultGameMode is a SenseGlove GameMode, or a subclass.");
}
else
{
SGLOG("The DefaultGameMode is not a SenseGlove GameMode, or a subclass.");
}
}
else
{
SGLOG_ERROR("Failed to construct a valid GameMode from the current settings!");
}
if (!bValidDefaultGameMode)
{
SGLOG("Setting the SenseGlove GameMode as the DefaultGameMode...");
static const FString DefaultGameMode{TEXT("/Script/SenseGlove.SGGameModeBase")};
GameMapsSettings->SetGlobalDefaultGameMode(DefaultGameMode);
SGLOG("Successfully set the SenseGlove GameMode as the DefaultGameMode!");
}
}
/*************************************************************************************************************
*
*************************************************************************************************************/
}
else
{
SGLOG_ERROR("Failed to check whether the GameMapsSettings is compliant with SenseGlove, or not!");
}
SGLOG("Checking whether the GameUserSettingsClass is compliant with SenseGlove, or not...");
if (ensureAlwaysMsgf(GEngine, TEXT("Invalid GEngine!")))
{
SGLOG("Validating if the GameUserSettingsClass is a SenseGlove GameUserSettings...");
bool bValidGameUserSettings = false;
const UClass* CurrentGameUserSettingsClass{GEngine->GameUserSettingsClassName.TryLoadClass<UObject>()};
if (CurrentGameUserSettingsClass)
{
if (CurrentGameUserSettingsClass->IsChildOf(USGGameUserSettings::StaticClass()))
{
bValidGameUserSettings = true;
SGLOG("The GameUserSettingsClass is a SenseGlove GameUserSettings, or a subclass.");
}
else
{
SGLOG("The GameUserSettingsClass is not a SenseGlove GameUserSettings, or a subclass.");
}
}
else
{
SGLOG_ERROR("Failed to construct a valid GameUserSettings from the current settings!");
}
if (!bValidGameUserSettings)
{
SGLOG("Setting the SenseGlove GameUserSettings as the GameUserSettingsClass...");
static const FSoftClassPath GameUserSettingsClassPath{TEXT("/Script/SenseGlove.SGGameUserSettings")};
GEngine->GameUserSettingsClassName = GameUserSettingsClassPath;
GEngine->GameUserSettingsClass = USGGameUserSettings::StaticClass();
GEngine->GameUserSettings = NewObject<USGGameUserSettings>();
GEngine->GetGameUserSettings()->LoadSettings(true);
SGLOG("Successfully set the SenseGlove GameInstance as the GameInstanceClass!");
}
}
else
{
SGLOG_ERROR("Failed to check whether the GameUserSettings is compliant with SenseGlove, or not!");
}
}
#undef LOCTEXT_NAMESPACE
@@ -41,9 +41,15 @@
class FSenseGloveModule : public IModuleInterface
{
private:
FDelegateHandle OnPostEngineInitHandle;
public:
virtual void StartupModule() override;
virtual void PreUnloadCallback() override;
virtual void PostLoadCallback() override;
virtual void ShutdownModule() override;
private:
void OnPostEngineInit() const;
};
@@ -0,0 +1,67 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "GameFramework/GameUserSettings.h"
#include "Templates/UniquePtr.h"
#include "SGTypes/SGTypes.h"
#include "SGGameUserSettings.generated.h"
UCLASS(config=GameUserSettings, configdonotcheckdefaults, BlueprintType, Blueprintable)
class SENSEGLOVE_API USGGameUserSettings : public UGameUserSettings
{
GENERATED_UCLASS_BODY()
public:
static USGGameUserSettings* GetInstance();
private:
struct FImpl;
struct FImplDeleter
{
void operator()(const FImpl* P) const;
};
TUniquePtr<FImpl, FImplDeleter> Pimpl;
FImplDeleter PimplDeleter;
public:
ESGEngineScalabilitySettings GetEngineScalabilitySettings() const;
void SetEngineScalabilitySettings(ESGEngineScalabilitySettings Scalability);
};
+1
View File
@@ -49,6 +49,7 @@ public class SenseGlove : ModuleRules
"Core",
"CoreUObject",
"Engine",
"EngineSettings",
"HeadMountedDisplay",
"InputCore",
// NOTE
@@ -0,0 +1,55 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SGKismet/SGGameUserSettingsKismetLibrary.h"
#include "SenseGlove/GameFramework/SGGameUserSettings.h"
USGGameUserSettings* UGameUserSettingsKismetLibrary::GetInstance()
{
return USGGameUserSettings::GetInstance();
}
ESGEngineScalabilitySettings UGameUserSettingsKismetLibrary::GetEngineScalabilitySettings(
const USGGameUserSettings* GameUserSettings)
{
return GameUserSettings->GetEngineScalabilitySettings();
}
void UGameUserSettingsKismetLibrary::SetEngineScalabilitySettings(USGGameUserSettings* GameUserSettings,
const ESGEngineScalabilitySettings Scalability)
{
GameUserSettings->SetEngineScalabilitySettings(Scalability);
}
@@ -0,0 +1,60 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGTypes/SGTypes.h"
#include "SGGameUserSettingsKismetLibrary.generated.h"
class USGGameUserSettings;
UCLASS(meta=(ScriptName = "SesneGloveGameUserSettingsKismetLibrary"))
class SENSEGLOVEKISMET_API UGameUserSettingsKismetLibrary final : public USGBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Game User Settings")
static USGGameUserSettings* GetInstance();
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Game User Settings")
static ESGEngineScalabilitySettings GetEngineScalabilitySettings(const USGGameUserSettings* GameUserSettings);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Game Framework | Game User Settings")
static void SetEngineScalabilitySettings(UPARAM(ref) USGGameUserSettings* GameUserSettings,
ESGEngineScalabilitySettings Scalability);
};
@@ -0,0 +1,69 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SGSettings/SGGameUserSettingSettings.h"
FSGGameUserSettingSettings::FSGGameUserSettingSettings()
: FSGGameUserSettingSettings(
0.5f,
0.71f,
0.87f,
1.0f,
1.0f,
10.0f,
1.0f,
1.0f)
{
}
FSGGameUserSettingSettings::FSGGameUserSettingSettings(
const float InResolutionScaleNormalizedLow,
const float InResolutionScaleNormalizedMedium,
const float InResolutionScaleNormalizedHigh,
const float InResolutionScaleNormalizedEpic,
const float InResolutionScaleNormalizedCinematic,
const float InHardwareBenchmarkWorkScale,
const float InHardwareBenchmarkCPUMultiplier,
const float InHardwareBenchmarkGPUMultiplier)
: ResolutionScaleNormalizedLow(InResolutionScaleNormalizedLow),
ResolutionScaleNormalizedMedium(InResolutionScaleNormalizedMedium),
ResolutionScaleNormalizedHigh(InResolutionScaleNormalizedHigh),
ResolutionScaleNormalizedEpic(InResolutionScaleNormalizedEpic),
ResolutionScaleNormalizedCinematic(InResolutionScaleNormalizedCinematic),
HardwareBenchmarkWorkScale(InHardwareBenchmarkWorkScale),
HardwareBenchmarkCPUMultiplier(InHardwareBenchmarkCPUMultiplier),
HardwareBenchmarkGPUMultiplier(InHardwareBenchmarkGPUMultiplier)
{
}
@@ -45,34 +45,35 @@ struct SENSEGLOVESETTINGS_API FSGDebugGizmoSettings
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
float Length;
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
float Thickness;
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
FColor XAxisColor;
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
FColor YAxisColor;
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
FColor ZAxisColor;
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
uint8 bPersistentLines : 1;
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
float LifeTimeModifier;
UPROPERTY(EditAnywhere, Category = "Debug Gizmo Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Gizmo Settings")
uint8 DepthPriority;
public:
FSGDebugGizmoSettings();
FSGDebugGizmoSettings(float InLength,
FSGDebugGizmoSettings(
float InLength,
float InThickness,
const FColor& InXAxisColor,
const FColor& InYAxisColor,
@@ -47,64 +47,64 @@ struct SENSEGLOVESETTINGS_API FSGDebugVirtualHandSettings
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings")
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings")
uint8 bDrawDebugVirtualHand : 1;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand", EditConditionHides))
ESGDebugVirtualHandDrawingMode DrawingMode;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints",
EditConditionHides))
FVector CubeExtent;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints",
EditConditionHides))
FColor CubeColor;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints",
EditConditionHides))
float CubeThickness;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
float GizmoLength;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
float GizmoThickness;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
FColor GizmoXAxisColor;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
FColor GizmoYAxisColor;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
FColor GizmoZAxisColor;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
uint8 bPersistentLines : 1;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
float LifeTimeModifier;
UPROPERTY(EditAnywhere, Category = "Debug Virtual Hand Settings",
UPROPERTY(Config, EditDefaultsOnly, Category = "Debug Virtual Hand Settings",
meta=(EditCondition="bDrawDebugVirtualHand && DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints",
EditConditionHides))
uint8 DepthPriority;
@@ -0,0 +1,84 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "UObject/ObjectMacros.h"
#include "SGGameUserSettingSettings.generated.h"
USTRUCT(BlueprintType)
struct SENSEGLOVESETTINGS_API FSGGameUserSettingSettings
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(Config, VisibleDefaultsOnly, Category = "Game User Settings")
float ResolutionScaleNormalizedLow;
UPROPERTY(Config, VisibleDefaultsOnly, Category = "Game User Settings")
float ResolutionScaleNormalizedMedium;
UPROPERTY(Config, VisibleDefaultsOnly, Category = "Game User Settings")
float ResolutionScaleNormalizedHigh;
UPROPERTY(Config, VisibleDefaultsOnly, Category = "Game User Settings")
float ResolutionScaleNormalizedEpic;
UPROPERTY(Config, VisibleDefaultsOnly, Category = "Game User Settings")
float ResolutionScaleNormalizedCinematic;
UPROPERTY(Config, EditDefaultsOnly, Category = "Game User Settings")
float HardwareBenchmarkWorkScale;
UPROPERTY(Config, EditDefaultsOnly, Category = "Game User Settings")
float HardwareBenchmarkCPUMultiplier;
UPROPERTY(Config, EditDefaultsOnly, Category = "Game User Settings")
float HardwareBenchmarkGPUMultiplier;
public:
FSGGameUserSettingSettings();
FSGGameUserSettingSettings(
float InResolutionScaleNormalizedLow,
float InResolutionScaleNormalizedMedium,
float InResolutionScaleNormalizedHigh,
float InResolutionScaleNormalizedEpic,
float InResolutionScaleNormalizedCinematic,
float InHardwareBenchmarkWorkScale,
float InHardwareBenchmarkCPUMultiplier,
float InHardwareBenchmarkGPUMultiplier);
};
@@ -42,6 +42,7 @@
#include "Templates/UniquePtr.h"
#include "UObject/ObjectMacros.h"
#include "SGSettings/SGGameUserSettingSettings.h"
#include "SGSettings/SGTrackingSettings.h"
#include "SGSettings.generated.h"
@@ -69,6 +70,9 @@ private:
FImplDeleter PimplDeleter;
private:
UPROPERTY(Config, EditDefaultsOnly, Category = "SenseGlove")
FSGGameUserSettingSettings GameUserSettings;
UPROPERTY(Config, EditDefaultsOnly, Category = "SenseGlove")
FSGTrackingSettings TrackingSettings;
@@ -76,6 +80,16 @@ private:
USGSettings();
public:
FORCEINLINE const FSGGameUserSettingSettings& GetGameUserSettings() const
{
return GameUserSettings;
}
void SetGameUserSettings(const FSGGameUserSettingSettings& InGameUserSettings)
{
GameUserSettings = InGameUserSettings;
}
FORCEINLINE const FSGTrackingSettings& GetTrackingSettings() const
{
return TrackingSettings;
@@ -0,0 +1,36 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SGTypes/SGTypes.h"
@@ -0,0 +1,58 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "CoreTypes.h"
#include "UObject/ObjectMacros.h"
/**
* The engine scalability settings.
*/
UENUM(BlueprintType)
enum class ESGEngineScalabilitySettings : uint8
{
Low UMETA(DisplayName = "Low"),
Medium UMETA(DisplayName = "Medium"),
High UMETA(DisplayName = "High"),
Epic UMETA(DisplayName = "Epic"),
Cinematic UMETA(DisplayName = "Cinematic"),
/**
* This will be used for benchmarking purpose. Then it should set the engine scalability settings to one of the
* other levels.
*/
Auto UMETA(DisplayName = "Auto"),
};