154 lines
5.9 KiB
C++
154 lines
5.9 KiB
C++
// Copyright 2023 PICO Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "GameFramework/WorldSettings.h"
|
|
#include "GameFrameWork/Actor.h"
|
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
|
#include "HeadMountedDisplayTypes.h"
|
|
#include "PICO_HMDFunctionLibrary.generated.h"
|
|
|
|
DECLARE_LOG_CATEGORY_EXTERN(LogPICOOpenXRHMD, Log, All);
|
|
|
|
UENUM(BlueprintType)
|
|
enum class EPerfSettingsDomainPICO : uint8
|
|
{
|
|
None = 0 UMETA(Hidden),
|
|
CPU = 1,
|
|
GPU = 2,
|
|
};
|
|
|
|
UENUM(BlueprintType)
|
|
enum class EPerfSettingsSubDomainPICO : uint8
|
|
{
|
|
None = 0 UMETA(Hidden),
|
|
Compositing = 1,
|
|
Rendering = 2,
|
|
Thermal = 3,
|
|
};
|
|
|
|
UENUM(BlueprintType)
|
|
enum class EPerfSettingsLevelPICO : uint8
|
|
{
|
|
PowerSavings = 0,
|
|
SustainedLow = 25,
|
|
SustainedHigh = 50,
|
|
Boost = 75,
|
|
};
|
|
|
|
UENUM(BlueprintType)
|
|
enum class EPerfSettingsNotificationLevelPICO : uint8
|
|
{
|
|
Normal = 0,
|
|
Warning = 25,
|
|
Impaired = 75,
|
|
};
|
|
|
|
UENUM(BlueprintType)
|
|
enum class EBoundaryTypePICO : uint8
|
|
{
|
|
Outer UMETA(DisplayName = "The Outer Boundary"),
|
|
PlayArea UMETA(DisplayName = "The Play Area Boundary"),
|
|
};
|
|
|
|
// Delegates
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnDeviceDisplayRefreshRateChangedDelegatePICO, float, NewDisplayRefreshRate, float, OldDisplayRefreshRate);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnDevicePerformanceSettingsChangedDelegatePICO, EPerfSettingsDomainPICO, Domain, EPerfSettingsSubDomainPICO, SubDomain, EPerfSettingsNotificationLevelPICO, ToLevel, EPerfSettingsNotificationLevelPICO, FromLevel);
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMRCStatusChangedDelegatePICO, bool, Enable);
|
|
|
|
UCLASS(BlueprintType)
|
|
class PICOOPENXRHMD_API UDelegateManagerPICO : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UPROPERTY(BlueprintAssignable)
|
|
FOnDeviceDisplayRefreshRateChangedDelegatePICO OnDeviceDisplayRefreshRateChanged;
|
|
|
|
UPROPERTY(BlueprintAssignable)
|
|
FOnDevicePerformanceSettingsChangedDelegatePICO OnDevicePerformanceSettingsChanged;
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "PICO|HMD|MRC")
|
|
FOnMRCStatusChangedDelegatePICO OnMRCStatusChanged;
|
|
};
|
|
|
|
UCLASS()
|
|
class PICOOPENXRHMD_API UHMDFunctionLibraryPICO : public UBlueprintFunctionLibrary
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static bool GetDevicePoseForTimePICO(const EControllerHand Hand, bool UseDefaultTime, FTimespan Timespan, bool& OutTimeWasUsed, FRotator& OutOrientation, FVector& OutPosition, bool& OutbProvidedLinearVelocity, FVector& OutLinearVelocity, bool& OutbProvidedAngularVelocity, FVector& OutAngularVelocityRadPerSec, bool& OutbProvidedLinearAcceleration, FVector& OutLinearAcceleration, float InWorldToMetersScale);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static EHMDWornState::Type GetHMDWornStatePICO(bool& ResultValid);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static bool GetFieldOfViewPICO(float& OutHFOVInDegrees, float& OutVFOVInDegrees);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static bool GetInterpupillaryDistancePICO(float& IPD);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static bool GetSupportedDisplayRefreshRatesPICO(TArray<float>& DisplayRefreshRates);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static bool GetCurrentDisplayRefreshRatePICO(float& DisplayRefreshRate);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static bool SetDisplayRefreshRatePICO(float DisplayRefreshRate);
|
|
|
|
static UDelegateManagerPICO* PICODelegateManager;
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static UDelegateManagerPICO* GetDelegateManagerPICO();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static void EnableContentProtectPICO(bool Enable);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD", meta = (Domain = "CPU"))
|
|
static bool SetPerformanceSettingsPICO(EPerfSettingsDomainPICO Domain, EPerfSettingsLevelPICO Level);
|
|
|
|
/**
|
|
* Sets 'base rotation' - the rotation that will be subtracted from
|
|
* the actual HMD orientation.
|
|
* Sets base position offset (in cm). The base position offset is the distance from the physical (0, 0, 0) position
|
|
* to current HMD position (bringing the (0, 0, 0) point to the current HMD position)
|
|
* Note, this vector is set by ResetPosition call; use this method with care.
|
|
* The axis of the vector are the same as in Unreal: X - forward, Y - right, Z - up.
|
|
*
|
|
* @param Rotation (in) Rotator object with base rotation
|
|
* @param BaseOffset (in) the vector to be set as base offset, in cm.
|
|
* @param Options (in) specifies either position, orientation or both should be set.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static void SetBaseRotationAndBaseOffsetPICO(FRotator Rotation, FVector BaseOffset, EOrientPositionSelector::Type Options);
|
|
|
|
/**
|
|
* Returns current base rotation and base offset.
|
|
* The base offset is currently used base position offset, previously set by the
|
|
* ResetPosition or SetBasePositionOffset calls. It represents a vector that translates the HMD's position
|
|
* into (0,0,0) point, in cm.
|
|
* The axis of the vector are the same as in Unreal: X - forward, Y - right, Z - up.
|
|
*
|
|
* @param OutRotation (out) Rotator object with base rotation
|
|
* @param OutBaseOffset (out) base position offset, vector, in cm.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static void GetBaseRotationAndBaseOffsetPICO(FRotator& OutRotation, FVector& OutBaseOffset);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static FTimespan GetDisplayTimePICO();
|
|
|
|
//UFUNCTION(BlueprintCallable, Category = "PICO|HMD|MRC", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
|
|
static void EnableMRCDebugModePICO(UObject* WorldContextObject, bool Enable, bool ViewInHMD, bool UseCustomTransform, const FTransform& Pose, bool UseCustomCameraInfo, int Width, int Height, float Fov);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static FIntPoint GetDefaultRenderTargetSizePICO();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "PICO|HMD")
|
|
static FIntPoint GetCurrentRenderTargetSizePICO();
|
|
|
|
UFUNCTION(BlueprintPure, Category = "PICO|HMD")
|
|
static bool IsEyeTrackerSupportedPICO(bool& Supported);
|
|
}; |