/** * @file * * @author Mamadou Babaei * * @section LICENSE * * (The MIT License) * * Copyright (c) 2020 - 2022 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 "SGCore/SGHapticGlove.h" #include "Runtime/Launch/Resources/Version.h" #include "SGCore/SGBuzzCommand.h" #include "SGCore/SGForceFeedbackCommand.h" #include "SGCore/SGDeviceImplCast.h" #include "SGCoreImpl/SGDeviceImpl.h" #include "SGCoreImpl/SGHapticGloveImpl.h" #include "SGCoreImpl/SGExportedFunctions.h" #include "SGInterop/SGIC_ESGDeviceType.h" #include "SGInterop/SGIC_ESGPositionalTrackingHardware.h" #include "SGInterop/SGIC_FQuat.h" #include "SGInterop/SGIC_FSGBasicHandModelImpl.h" #include "SGInterop/SGIC_FSGBuzzCommandImpl.h" #include "SGInterop/SGIC_FSGForceFeedbackCommandImpl.h" #include "SGInterop/SGIC_FSGHandPoseImpl.h" #include "SGInterop/SGIC_FSGHandProfileImpl.h" #include "SGInterop/SGIC_FSGThumperCommandImpl.h" #include "SGInterop/SGIC_FString.h" #include "SGInterop/SGIC_FVector.h" #include "SGInterop/SGIC_TArray_FVector.h" #include "SGInterop/SGIC_TArray_TSharedRef_FSGHapticGloveImpl.h" #include "SGInterop/SGIC_TSharedPtr_FSGHapticGloveImpl.h" struct USGHapticGlove::FImpl { /************************ * Member variables ************************/ /************************ * Owner object ************************/ USGDevice* Owner; /************************ * Constructor / Destructor ************************/ explicit FImpl(USGHapticGlove* InOwner); ~FImpl(); /************************ * Default copy constructor & copy assignment operator ************************/ FImpl(const FImpl& Rhs) = default; FImpl& operator=(const FImpl& Rhs) = default; /************************ * Methods ************************/ void SyncUProperties(); void SyncImplObject(); }; USGHapticGlove* USGHapticGlove::NewHapticGlove(UObject* Outer, const FSGHapticGloveImpl& HapticGloveImpl) { USGHapticGlove* Instance = NewObject(Outer); Instance->SetSGDeviceImpl(HapticGloveImpl); return Instance; } USGHapticGlove* USGHapticGlove::NewHapticGlove(UObject* Outer, TSharedRef HapticGloveImpl) { USGHapticGlove* Instance = NewObject(Outer); Instance->SetSGDeviceImpl(MoveTemp(HapticGloveImpl)); return Instance; } USGHapticGlove* USGHapticGlove::NewHapticGlove(UObject* Outer) { FSGIC_TSharedPtr_FSGHapticGloveImpl OutSharedPtrContainer; SGCoreImpl_FSGBetaDeviceImpl_ctor_MakeShared(&OutSharedPtrContainer); return NewHapticGlove(Outer, OutSharedPtrContainer.Ptr.ToSharedRef()); } TArray USGHapticGlove::GetHapticGloves(UObject* Outer) { FSGIC_TArray_TSharedRef_FSGHapticGloveImpl OutGlovesContainer; SGCoreImpl_FSGHapticGloveImpl_GetHapticGloves(&OutGlovesContainer); TArray HapticGloves; for (TSharedRef HapticGloveImpl: OutGlovesContainer.Array) { HapticGloves.Add(NewHapticGlove(Outer, MoveTemp(HapticGloveImpl))); } return HapticGloves; } bool USGHapticGlove::GetGlove(UObject* Outer, USGHapticGlove*& OutGlove) { FSGIC_TSharedPtr_FSGHapticGloveImpl OutGloveContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetGlove_OutGlove(&OutGloveContainer); if (bResult) { OutGlove = NewHapticGlove(Outer, OutGloveContainer.Ptr.ToSharedRef()); } return bResult; } bool USGHapticGlove::GetGlove(UObject* Outer, const bool bRightHanded, USGHapticGlove*& OutGlove) { FSGIC_TSharedPtr_FSGHapticGloveImpl OutGloveContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetGlove_bRightHanded_OutGlove(bRightHanded, &OutGloveContainer); if (bResult) { OutGlove = NewHapticGlove(Outer, OutGloveContainer.Ptr.ToSharedRef()); } return bResult; } USGHapticGlove::USGHapticGlove() : USGDevice(), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { FSGIC_TSharedPtr_FSGHapticGloveImpl OutSharedPtrContainer; SGCoreImpl_FSGBetaDeviceImpl_ctor_MakeShared(&OutSharedPtrContainer); SetSGDeviceImpl(OutSharedPtrContainer.Ptr.ToSharedRef()); Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(const FSGDeviceImpl& SGDeviceImpl) : USGDevice(SGDeviceImpl), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(const FSGHapticGloveImpl& HapticGloveImpl) : USGDevice(HapticGloveImpl), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(const FSGNovaGloveImpl& NovaGloveImpl) : USGDevice(NovaGloveImpl), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(const FSGSenseGloveImpl& SenseGloveImpl) : USGDevice(SenseGloveImpl), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(TSharedRef SGDeviceImpl) : USGDevice(MoveTemp(SGDeviceImpl)), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(TSharedRef HapticGloveImpl) : USGDevice(MoveTemp(HapticGloveImpl)), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(TSharedRef NovaGloveImpl) : USGDevice(MoveTemp(NovaGloveImpl)), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::USGHapticGlove(TSharedRef SenseGloveImpl) : USGDevice(MoveTemp(SenseGloveImpl)), #if ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) #else Pimpl(TUniquePtr(new FImpl{this})) #endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 24 ) */ { Pimpl->SyncUProperties(); } USGHapticGlove::~USGHapticGlove() = default; TSharedRef USGHapticGlove::ToHapticGloveImpl() const { SyncImplObject(); return FSGDeviceImplCast::ToHapticGloveImpl(ToSGDeviceImpl()); } void USGHapticGlove::SyncImplObject() const { Super::SyncImplObject(); Pimpl->SyncImplObject(); } void USGHapticGlove::SyncUProperties() { Super::SyncUProperties(); Pimpl->SyncUProperties(); } ESGDeviceType USGHapticGlove::GetDeviceType() const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_ESGDeviceType OutTypeContainer; SGCoreImpl_FSGHapticGloveImpl_GetDeviceType(&InstanceContainer, &OutTypeContainer); return OutTypeContainer.Type; } FString USGHapticGlove::GetDeviceId() const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FString OutIdContainer; SGCoreImpl_FSGHapticGloveImpl_GetDeviceId(&InstanceContainer, &OutIdContainer); return MoveTemp(OutIdContainer.String); } FString USGHapticGlove::GetHardwareVersion() const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FString OutVersionContainer; SGCoreImpl_FSGHapticGloveImpl_GetHardwareVersion(&InstanceContainer, &OutVersionContainer); return MoveTemp(OutVersionContainer.String); } int32 USGHapticGlove::GetFirmwareVersion() const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; return SGCoreImpl_FSGHapticGloveImpl_GetFirmwareVersion(&InstanceContainer); } int32 USGHapticGlove::GetSubFirmwareVersion() const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; return SGCoreImpl_FSGHapticGloveImpl_GetSubFirmwareVersion(&InstanceContainer); } bool USGHapticGlove::IsRight() const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; return SGCoreImpl_FSGHapticGloveImpl_IsRight(&InstanceContainer); } bool USGHapticGlove::GetImuRotation(FQuat& OutImu) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FQuat OutImuContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetImuRotation(&InstanceContainer, &OutImuContainer); SyncUProperties(); if (bResult) { OutImu = MoveTemp(OutImuContainer.Quat); } return bResult; } bool USGHapticGlove::GetImuRotation(FRotator& OutImu) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FQuat OutImuContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetImuRotation(&InstanceContainer, &OutImuContainer); SyncUProperties(); if (bResult) { OutImu = OutImuContainer.Quat.Rotator(); } return bResult; } bool USGHapticGlove::GetHandPose( UObject* Outer, const USGBasicHandModel* HandGeometry, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGBasicHandModelImpl HandGeometryContainer{HandGeometry->ToBasicHandModelImpl()}; FSGIC_FSGHandProfileImpl HandProfileContainer{HandProfile->ToHandProfileImpl()}; FSGIC_FSGHandPoseImpl OutHandPoseContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandPose_HandGeometry_HandProfile_OutHandPose( &InstanceContainer, &HandGeometryContainer, &HandProfileContainer, &OutHandPoseContainer); SyncUProperties(); if (bResult) { OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl)); } return bResult; } bool USGHapticGlove::GetHandPose(UObject* Outer, const USGHandProfile* HandProfile, USGHandPose*& OutHandPose) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGHandProfileImpl HandProfileContainer{HandProfile->ToHandProfileImpl()}; FSGIC_FSGHandPoseImpl OutHandPoseContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandPose_HandProfile_OutHandPose( &InstanceContainer, &HandProfileContainer, &OutHandPoseContainer); SyncUProperties(); if (bResult) { OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl)); } return bResult; } bool USGHapticGlove::GetHandPose(UObject* Outer, const USGBasicHandModel* HandGeometry, USGHandPose*& OutHandPose) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGBasicHandModelImpl HandGeometryContainer{HandGeometry->ToBasicHandModelImpl()}; FSGIC_FSGHandPoseImpl OutHandPoseContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandPose_HandGeometry_OutHandPose( &InstanceContainer, &HandGeometryContainer, &OutHandPoseContainer); SyncUProperties(); if (bResult) { OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl)); } return bResult; } bool USGHapticGlove::GetHandPose(UObject* Outer, USGHandPose*& OutHandPose) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGHandPoseImpl OutHandPoseContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetHandPose_OutHandPose( &InstanceContainer, &OutHandPoseContainer); SyncUProperties(); if (bResult) { OutHandPose = USGHandPose::NewHandPose(Outer, MoveTemp(OutHandPoseContainer.HandPoseImpl)); } return bResult; } void USGHapticGlove::StopHaptics() { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; SGCoreImpl_FSGHapticGloveImpl_StopHaptics(&InstanceContainer); SyncUProperties(); } void USGHapticGlove::StopVibrations() { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; SGCoreImpl_FSGHapticGloveImpl_StopVibrations(&InstanceContainer); SyncUProperties(); } void USGHapticGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{ ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()}; SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ForceFeedbackCommand(&InstanceContainer, &ForceFeedbackCommandContainer); SyncUProperties(); } void USGHapticGlove::SendHaptics(const USGBuzzCommand* BuzzCommand) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()}; SGCoreImpl_FSGHapticGloveImpl_SendHaptics_BuzzCommand(&InstanceContainer, &BuzzCommandContainer); SyncUProperties(); } void USGHapticGlove::SendHaptics(const USGThumperCommand* ThumperCommand) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()}; SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ThumperCommand(&InstanceContainer, &ThumperCommandContainer); SyncUProperties(); } void USGHapticGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand, const USGBuzzCommand* BuzzCommand) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{ ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()}; FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()}; SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ForceFeedbackCommand_BuzzCommand( &InstanceContainer, &ForceFeedbackCommandContainer, &BuzzCommandContainer); SyncUProperties(); } void USGHapticGlove::SendHaptics(const USGForceFeedbackCommand* ForceFeedbackCommand, const USGBuzzCommand* BuzzCommand, const USGThumperCommand* ThumperCommand) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGForceFeedbackCommandImpl ForceFeedbackCommandContainer{ ForceFeedbackCommand->ToForceFeedbackCommandImpl().Get()}; FSGIC_FSGBuzzCommandImpl BuzzCommandContainer{BuzzCommand->ToBuzzCommandImpl().Get()}; FSGIC_FSGThumperCommandImpl ThumperCommandContainer{ThumperCommand->ToThumperCommandImpl()}; SGCoreImpl_FSGHapticGloveImpl_SendHaptics_ForceFeedbackCommand_BuzzCommand_ThumperCommand( &InstanceContainer, &ForceFeedbackCommandContainer, &BuzzCommandContainer, &ThumperCommandContainer); SyncUProperties(); } bool USGHapticGlove::GetCalibrationValues(TArray& OutValues) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_TArray_FVector OutValuesContainer; const bool bResult = SGCoreImpl_FSGHapticGloveImpl_GetCalibrationValues(&InstanceContainer, &OutValuesContainer); SyncUProperties(); if (bResult) { OutValues = MoveTemp(OutValuesContainer.Array); } return bResult; } void USGHapticGlove::ResetCalibrationRange() { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; SGCoreImpl_FSGHapticGloveImpl_ResetCalibrationRange(&InstanceContainer); SyncUProperties(); } void USGHapticGlove::UpdateCalibrationRange() { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; SGCoreImpl_FSGHapticGloveImpl_UpdateCalibrationRange(&InstanceContainer); SyncUProperties(); } void USGHapticGlove::UpdateCalibrationRange(const TArray& CalibrationValues) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_TArray_FVector CalibrationValuesContainer{CalibrationValues}; SGCoreImpl_FSGHapticGloveImpl_UpdateCalibrationRange_CalibrationValues( &InstanceContainer, &CalibrationValuesContainer); SyncUProperties(); } void USGHapticGlove::GetCalibrationRange(TArray& OutMinValues, TArray& OutMaxValues) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_TArray_FVector OutMinValuesContainer; FSGIC_TArray_FVector OutMaxValuesContainer; SGCoreImpl_FSGHapticGloveImpl_GetCalibrationRange(&InstanceContainer, &OutMinValues, &OutMaxValues); SyncUProperties(); OutMinValues = MoveTemp(OutMinValuesContainer.Array); OutMaxValues = MoveTemp(OutMaxValuesContainer.Array); } void USGHapticGlove::UpdateCalibration(UObject* Outer, USGHandProfile*& OutProfile) { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGHandProfileImpl OutProfileContainer; SGCoreImpl_FSGHapticGloveImpl_UpdateCalibration(&InstanceContainer, &OutProfileContainer); SyncUProperties(); OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl)); } void USGHapticGlove::ApplyCalibration(UObject* Outer, USGHandProfile*& OutProfile) const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FSGHandProfileImpl OutProfileContainer; SGCoreImpl_FSGHapticGloveImpl_ApplyCalibration(&InstanceContainer, &OutProfileContainer); OutProfile = USGHandProfile::NewHandProfile(Outer, MoveTemp(OutProfileContainer.HandProfileImpl)); } void USGHapticGlove::GetWristLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FQuat& OutWristRotation) const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FVector ReferencePositionContainer{ReferencePosition}; FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation}; FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; FSGIC_FVector OutWristPositionContainer; FSGIC_FQuat OutWristRotationContainer; SGCoreImpl_FSGHapticGloveImpl_GetWristLocation( &InstanceContainer, &ReferencePositionContainer, &ReferenceRotationContainer, &TrackingHardwareContainer, &OutWristPositionContainer, &OutWristRotationContainer); OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); OutWristRotation = MoveTemp(OutWristRotationContainer.Quat); } void USGHapticGlove::GetWristLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FRotator& OutWristRotation) const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FVector ReferencePositionContainer{ReferencePosition}; FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; FSGIC_FVector OutWristPositionContainer; FSGIC_FQuat OutWristRotationContainer; SGCoreImpl_FSGHapticGloveImpl_GetWristLocation( &InstanceContainer, &ReferencePositionContainer, &ReferenceRotationContainer, &TrackingHardwareContainer, &OutWristPositionContainer, &OutWristRotationContainer); OutWristPosition = MoveTemp(OutWristPositionContainer.Vector); OutWristRotation = OutWristRotationContainer.Quat.Rotator(); } void USGHapticGlove::GetGloveLocation(const FVector& ReferencePosition, const FQuat& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FQuat& OutGloveRotation) const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FVector ReferencePositionContainer{ReferencePosition}; FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation}; FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; FSGIC_FVector OutGlovePositionContainer; FSGIC_FQuat OutGloveRotationContainer; SGCoreImpl_FSGHapticGloveImpl_GetGloveLocation( &InstanceContainer, &ReferencePositionContainer, &ReferenceRotationContainer, &TrackingHardwareContainer, &OutGlovePositionContainer, &OutGloveRotationContainer); OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); OutGloveRotation = MoveTemp(OutGloveRotationContainer.Quat); } void USGHapticGlove::GetGloveLocation(const FVector& ReferencePosition, const FRotator& ReferenceRotation, const ESGPositionalTrackingHardware TrackingHardware, FVector& OutGlovePosition, FRotator& OutGloveRotation) const { SyncImplObject(); FSGIC_TSharedPtr_FSGHapticGloveImpl InstanceContainer{ToHapticGloveImpl()}; FSGIC_FVector ReferencePositionContainer{ReferencePosition}; FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()}; FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware}; FSGIC_FVector OutGlovePositionContainer; FSGIC_FQuat OutGloveRotationContainer; SGCoreImpl_FSGHapticGloveImpl_GetGloveLocation( &InstanceContainer, &ReferencePositionContainer, &ReferenceRotationContainer, &TrackingHardwareContainer, &OutGlovePositionContainer, &OutGloveRotationContainer); OutGlovePosition = MoveTemp(OutGlovePositionContainer.Vector); OutGloveRotation = OutGloveRotationContainer.Quat.Rotator(); } USGHapticGlove::FImpl::FImpl(USGHapticGlove* InOwner) : Owner(InOwner) { } USGHapticGlove::FImpl::~FImpl() = default; void USGHapticGlove::FImplDeleter::operator()(const FImpl* P) const { delete P; } void USGHapticGlove::FImpl::SyncUProperties() { } void USGHapticGlove::FImpl::SyncImplObject() { }