169 lines
4.4 KiB
C++
169 lines
4.4 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2023 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 "Containers/UnrealString.h"
|
|
#include "Math/Vector.h"
|
|
#include "Runtime/Launch/Resources/Version.h"
|
|
#include "Templates/UniquePtr.h"
|
|
|
|
#include "SGCoreImpl/SGPlatform.h"
|
|
#include "SGTypes/SGCoreTypes.h"
|
|
|
|
namespace SGCore
|
|
{
|
|
namespace SG
|
|
{
|
|
class SenseGloveInfo;
|
|
}
|
|
}
|
|
|
|
class SENSEGLOVECOREIMPL_API FSGSenseGloveInfoImpl final
|
|
{
|
|
public:
|
|
typedef SGCore::SG::SenseGloveInfo FSenseGloveInfoType;
|
|
|
|
public:
|
|
static bool Parse(const FString& ConstantsString, FSGSenseGloveInfoImpl& OutGloveInfo,
|
|
bool bUpdateOldModels = true);
|
|
|
|
static FSGSenseGloveInfoImpl Deserialize(const FString& SerializedString);
|
|
|
|
private:
|
|
struct FImpl;
|
|
|
|
struct FImplDeleter
|
|
{
|
|
void operator()(const FImpl* P) const;
|
|
};
|
|
|
|
TUniquePtr<FImpl, FImplDeleter> Pimpl;
|
|
FImplDeleter PimplDeleter;
|
|
|
|
public:
|
|
FSGSenseGloveInfoImpl();
|
|
|
|
FSGSenseGloveInfoImpl(const FString& DeviceId,
|
|
const FString& HardwareVersion, int32 FirmwareVersion, int32 SubFirmwareVersion,
|
|
bool bRightHanded, int32 NumberOfSensors,
|
|
const FQuat& ImuCorrection,
|
|
const TArray<FVector>& StartPositions,
|
|
const TArray<FQuat>& StartRotations,
|
|
const TArray<TArray<FVector>>& GloveLengths,
|
|
const TArray<bool>& Functions);
|
|
|
|
public:
|
|
/**
|
|
* The cast from underlying type constructor.
|
|
*/
|
|
explicit FSGSenseGloveInfoImpl(const FSenseGloveInfoType& GloveInfo);
|
|
|
|
public:
|
|
/**
|
|
* The copy constructor.
|
|
*/
|
|
FSGSenseGloveInfoImpl(const FSGSenseGloveInfoImpl& Rhs);
|
|
|
|
/**
|
|
* The move constructor.
|
|
*/
|
|
FSGSenseGloveInfoImpl(FSGSenseGloveInfoImpl&& Rhs) SG_NOEXCEPT;
|
|
|
|
public:
|
|
/**
|
|
* The destructor.
|
|
*/
|
|
virtual ~FSGSenseGloveInfoImpl();
|
|
|
|
public:
|
|
/**
|
|
* The copy assignment operator.
|
|
*/
|
|
FSGSenseGloveInfoImpl& operator=(const FSGSenseGloveInfoImpl& Rhs);
|
|
|
|
/**
|
|
* The move assignment operator.
|
|
*/
|
|
FSGSenseGloveInfoImpl& operator=(FSGSenseGloveInfoImpl&& Rhs) SG_NOEXCEPT;
|
|
|
|
public:
|
|
/**
|
|
* The cast to underlying type method.
|
|
*/
|
|
const FSenseGloveInfoType& ToSenseGloveInfo() const;
|
|
|
|
public:
|
|
FString GetDeviceId() const;
|
|
|
|
FString GetHardwareVersion() const;
|
|
|
|
int32 GetFirmwareVersion() const;
|
|
|
|
int32 GetSubFirmwareVersion() const;
|
|
|
|
bool IsRight() const;
|
|
|
|
int32 GetNumberOfSensors() const;
|
|
|
|
FQuat GetImuCorrection() const;
|
|
|
|
TArray<FVector> GetStartPositions() const;
|
|
|
|
TArray<FQuat> GetStartRotations() const;
|
|
|
|
TArray<TArray<FVector>> GetGloveLengths() const;
|
|
|
|
TArray<bool> GetFunctions() const;
|
|
|
|
public:
|
|
FVector GetStartPosition(ESGFinger Finger) const;
|
|
|
|
FQuat GetStartRotation(ESGFinger Finger) const;
|
|
|
|
TArray<FVector> GetGloveLengths(ESGFinger Finger) const;
|
|
|
|
public:
|
|
TArray<TArray<FVector>> ToGloveAngles(const TArray<TArray<float>>& SensorAngles) const;
|
|
|
|
bool Equals(const FSGSenseGloveInfoImpl& SGSenseGloveInfo, bool bGeometryOnly = false) const;
|
|
|
|
public:
|
|
FString ToString(bool bShortNotation) const;
|
|
|
|
FString ToString() const;
|
|
|
|
FString Serialize() const;
|
|
}; |