126 lines
3.4 KiB
C++
126 lines
3.4 KiB
C++
/**
|
|
* @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 "Animation/AnimInstanceProxy.h"
|
|
#include "Containers/Array.h"
|
|
#include "HeadMountedDisplayTypes.h"
|
|
#include "Math/Quat.h"
|
|
#include "Math/Transform.h"
|
|
#include "Templates/UniquePtr.h"
|
|
#include "UObject/NameTypes.h"
|
|
|
|
#include "SGVirtualHandAnimInstanceProxy.generated.h"
|
|
|
|
class USkeletalMesh;
|
|
class USkeleton;
|
|
class USGVirtualHandComponent;
|
|
|
|
USTRUCT()
|
|
struct SENSEGLOVE_API FSGVirtualHandAnimInstanceProxy : public FAnimInstanceProxy
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
private:
|
|
bool bIsVirtualHandVisible;
|
|
USGVirtualHandComponent* VirtualHand;
|
|
USkeletalMesh* HandMeshAsset;
|
|
USkeleton* HandSkeleton;
|
|
bool bMarkRenderStateDirty;
|
|
|
|
FXRMotionControllerData MotionControllerData;
|
|
TMap<TArray<FQuat>::SizeType, FName> BoneNamesMap;
|
|
|
|
FTransform AnimationBoneCorrectionOffsetTransform;
|
|
bool bShouldAnimationApplyBoneLocation;
|
|
|
|
public:
|
|
FSGVirtualHandAnimInstanceProxy();
|
|
FSGVirtualHandAnimInstanceProxy(UAnimInstance* Instance);
|
|
|
|
protected:
|
|
FORCEINLINE bool IsVirtualHandVisible() const
|
|
{
|
|
return bIsVirtualHandVisible;
|
|
}
|
|
|
|
FORCEINLINE USGVirtualHandComponent* GetVirtualHand() const
|
|
{
|
|
return VirtualHand;
|
|
}
|
|
|
|
FORCEINLINE USkeletalMesh* GetHandMeshAsset() const
|
|
{
|
|
return HandMeshAsset;
|
|
}
|
|
|
|
FORCEINLINE USkeleton* GetHandSkeleton() const
|
|
{
|
|
return HandSkeleton;
|
|
}
|
|
|
|
FORCEINLINE bool IsRenderStateDirty() const
|
|
{
|
|
return bMarkRenderStateDirty;
|
|
}
|
|
|
|
FORCEINLINE const FXRMotionControllerData& GetMotionControllerData() const
|
|
{
|
|
return MotionControllerData;
|
|
}
|
|
|
|
FORCEINLINE const TMap<TArray<FQuat>::SizeType, FName>& GetBoneNamesMap() const
|
|
{
|
|
return BoneNamesMap;
|
|
}
|
|
|
|
FORCEINLINE const FTransform& GetAnimationBoneCorrectionOffsetTransform() const
|
|
{
|
|
return AnimationBoneCorrectionOffsetTransform;
|
|
}
|
|
|
|
FORCEINLINE bool ShouldAnimationApplyBoneLocation() const
|
|
{
|
|
return bShouldAnimationApplyBoneLocation;
|
|
}
|
|
|
|
protected:
|
|
virtual void PreEvaluateAnimation(UAnimInstance* InAnimInstance) override;
|
|
|
|
virtual bool Evaluate(FPoseContext& Output) override;
|
|
|
|
virtual void PostEvaluate(UAnimInstance* InAnimInstance) override;
|
|
}; |