SenseGloveCore modules, so that the C++ users of the API don't need to explicitly add it as a dependency * Clean up the redundant headers/modules dependency from SGCore headers * Fix RunUAT build issues for Epic Store submission
210 lines
5.6 KiB
C++
210 lines
5.6 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @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
|
|
*
|
|
* A profile containing all the information required for HapticGloves.
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "Containers/Array.h"
|
|
#include "Containers/UnrealString.h"
|
|
#include "Templates/UniquePtr.h"
|
|
#include "UObject/Object.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
|
|
#include "SGHandProfile.generated.h"
|
|
|
|
class FSGHandProfileImpl;
|
|
class USGNovaGloveHandProfile;
|
|
class USGSenseGloveHandProfile;
|
|
|
|
/**
|
|
* Interpolation profiles for a user's hand, compatible with all HapticGloves.
|
|
*/
|
|
UCLASS(BlueprintType)
|
|
class SENSEGLOVECORE_API USGHandProfile final : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
static USGHandProfile* NewHandProfile(
|
|
UObject* Outer, const FSGHandProfileImpl& HandProfileImpl);
|
|
|
|
public:
|
|
/**
|
|
* The default constructor.
|
|
*/
|
|
static USGHandProfile* NewHandProfile(UObject* Outer);
|
|
|
|
/**
|
|
* Creates a new instance of a HandProfile.
|
|
*/
|
|
static USGHandProfile* NewHandProfile(
|
|
UObject* Outer,
|
|
bool bRightHanded,
|
|
const USGSenseGloveHandProfile* SenseGloveHandProfile,
|
|
const USGNovaGloveHandProfile* NovaGloveHandProfile);
|
|
|
|
public:
|
|
/**
|
|
* Generate a new handProfile for either a left or right hand.
|
|
*/
|
|
static USGHandProfile* Default(UObject* Outer, bool bRightHanded);
|
|
|
|
/**
|
|
* Convert a string notation of a NovaGloveHandProfile into a new instance.
|
|
*/
|
|
static USGHandProfile* Deserialize(UObject* Outer, const FString& SerializedString);
|
|
|
|
public:
|
|
/**
|
|
* Returns the directory where HandProfiles are being stored. Does not include a '\\' at the end.
|
|
*/
|
|
static FString GetProfileDirectory();
|
|
|
|
/**
|
|
* Filename for the left hand profile.
|
|
*/
|
|
static FString GetLeftHandFileName();
|
|
|
|
/**
|
|
* Filename for the right hand profile.
|
|
*/
|
|
static FString GetRightHandFileName();
|
|
|
|
/**
|
|
* Returns the fileName of the left or right-handed profiles.
|
|
*/
|
|
static FString GetProfileFileName(bool bRightHanded);
|
|
|
|
/**
|
|
* Retrieves the latest HandProfile from disk. If this function returns false, latestProfils is equal to SGCOre::HandProfile::Default(rightHand).
|
|
*/
|
|
static bool GetLatestProfile(UObject* Outer, bool bRightHanded, USGHandProfile*& OutLatestProfile);
|
|
|
|
/**
|
|
* Stores a HandProfile on disk for other programs to access. Call this function only if your software handles calibration functions.
|
|
*/
|
|
static bool StoreProfile(const USGHandProfile* ProfileToStore);
|
|
|
|
/**
|
|
* Resets the Calibration of a specific back to default values.
|
|
*/
|
|
static bool ResetCalibration(bool bRightHanded, bool bOnDisk = true);
|
|
|
|
/**
|
|
* Resets the Calibration of both hands back to default values.
|
|
*/
|
|
static void ResetCalibration(bool bOnDisk = true);
|
|
|
|
private:
|
|
struct FImpl;
|
|
|
|
struct FImplDeleter
|
|
{
|
|
void operator()(const FImpl* P) const;
|
|
};
|
|
|
|
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
|
FImplDeleter PimplDeleter;
|
|
|
|
public:
|
|
/**
|
|
* The default constructor.
|
|
*/
|
|
USGHandProfile();
|
|
|
|
/**
|
|
* Creates a new instance of a HandProfile.
|
|
*/
|
|
USGHandProfile(bool bRightHanded,
|
|
const USGSenseGloveHandProfile* SenseGloveHandProfile,
|
|
const USGNovaGloveHandProfile* NovaGloveHandProfile);
|
|
|
|
public:
|
|
/**
|
|
* The cast from underlying type constructor.
|
|
*/
|
|
explicit USGHandProfile(const FSGHandProfileImpl& HandProfileImpl);
|
|
|
|
public:
|
|
/**
|
|
* The destructor.
|
|
*/
|
|
virtual ~USGHandProfile() override;
|
|
|
|
protected:
|
|
/**
|
|
* Allows to set the underlying object after construction.
|
|
*/
|
|
void SetHandProfileImpl(const FSGHandProfileImpl& HandProfileImpl);
|
|
|
|
public:
|
|
/**
|
|
* The cast to underlying type method.
|
|
*/
|
|
const FSGHandProfileImpl& ToHandProfileImpl() const;
|
|
|
|
public:
|
|
/**
|
|
* Whether this profile was created for a left or right hand.
|
|
*/
|
|
bool IsRight() const;
|
|
|
|
/**
|
|
* Profile for SenseGloves.
|
|
*/
|
|
USGSenseGloveHandProfile* GetSenseGloveHandProfile(UObject* Outer) const;
|
|
|
|
/**
|
|
* User profile for Nova.
|
|
*/
|
|
USGNovaGloveHandProfile* GetNovaGloveHandProfile(UObject* Outer) const;
|
|
|
|
public:
|
|
/**
|
|
*
|
|
*/
|
|
bool Equals(const USGHandProfile* HandProfile) const;
|
|
|
|
/**
|
|
* Reset this profile back to its default values.
|
|
*/
|
|
void Reset();
|
|
|
|
public:
|
|
/**
|
|
* Convert this NovaGloveHandProfile into a string notation so it can be stored on disk.
|
|
*/
|
|
FString SGSerialize() const;
|
|
};
|