metaforce/Runtime/Character/CBoneTracking.hpp

53 lines
1.7 KiB
C++
Raw Permalink Normal View History

2018-11-17 14:49:32 -08:00
#pragma once
#include <optional>
#include <string_view>
2018-11-17 14:49:32 -08:00
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Character/CSegId.hpp"
#include <zeus/CQuaternion.hpp>
#include <zeus/CTransform.hpp>
#include <zeus/CVector3f.hpp>
2018-11-17 14:49:32 -08:00
2021-04-10 01:42:06 -07:00
namespace metaforce {
2018-11-17 14:49:32 -08:00
class CAnimData;
class CStateManager;
class CBodyController;
2019-04-02 21:32:31 -07:00
2021-06-07 12:29:18 -07:00
enum class EBoneTrackingFlags { None = 0, NoParent = 1, NoParentOrigin = 2, NoHorizontalAim = 4, ParentIk = 8 };
2019-04-02 21:32:31 -07:00
ENABLE_BITWISE_ENUM(EBoneTrackingFlags)
2018-12-07 21:30:43 -08:00
class CBoneTracking {
zeus::CQuaternion x0_curRotation = zeus::CQuaternion();
2018-12-12 23:39:16 -08:00
float x10_ = 0.f;
2018-12-07 21:30:43 -08:00
CSegId x14_segId;
float x18_time = 0.f;
2018-12-12 23:39:16 -08:00
float x1c_maxTrackingAngle;
float x20_angSpeed;
std::optional<zeus::CVector3f> x24_targetPosition;
2018-12-07 21:30:43 -08:00
TUniqueId x34_target = kInvalidUniqueId;
bool x36_24_active : 1 = false;
bool x36_25_hasTrackedRotation : 1 = false;
bool x36_26_noParent : 1;
bool x36_27_noParentOrigin : 1;
bool x36_28_noHorizontalAim : 1;
bool x36_29_parentIk : 1;
2018-12-07 21:30:43 -08:00
2018-11-17 14:49:32 -08:00
public:
2021-06-07 12:29:18 -07:00
CBoneTracking(const CAnimData& animData, std::string_view bone, float maxTrackingAngle, float angSpeed,
EBoneTrackingFlags flags);
2018-12-07 21:30:43 -08:00
void Update(float dt);
2021-06-07 12:29:18 -07:00
void PreRender(const CStateManager& mgr, CAnimData& animData, const zeus::CTransform& xf, const zeus::CVector3f& vec,
const CBodyController& bodyController);
2018-12-12 23:39:16 -08:00
void PreRender(const CStateManager& mgr, CAnimData& animData, const zeus::CTransform& worldXf,
const zeus::CVector3f& localOffsetScale, bool tracking);
void SetActive(bool active);
2018-12-12 23:39:16 -08:00
void SetTarget(TUniqueId id);
void UnsetTarget();
void SetTargetPosition(const zeus::CVector3f& pos);
void SetNoHorizontalAim(bool b);
2018-11-17 14:49:32 -08:00
};
2019-05-14 15:30:15 -07:00
2021-04-10 01:42:06 -07:00
} // namespace metaforce