2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2017-03-01 03:42:06 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <optional>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/Collision/CJointCollisionDescription.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CAABox.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2017-03-01 03:42:06 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2017-03-01 03:42:06 +00:00
|
|
|
class CAnimData;
|
|
|
|
class CCollisionActor;
|
2019-09-28 02:53:03 +00:00
|
|
|
class CMaterialList;
|
2017-03-01 03:42:06 +00:00
|
|
|
class CStateManager;
|
2019-09-28 02:53:03 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCollisionActorManager {
|
2017-03-01 03:42:06 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EUpdateOptions { ObjectSpace, WorldSpace };
|
2017-03-01 03:42:06 +00:00
|
|
|
|
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
std::vector<CJointCollisionDescription> x0_jointDescriptions;
|
|
|
|
TUniqueId x10_ownerId;
|
|
|
|
bool x12_active;
|
|
|
|
bool x13_destroyed = false;
|
|
|
|
bool x14_movable = true;
|
2017-03-01 03:42:06 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
public:
|
|
|
|
CCollisionActorManager(CStateManager& mgr, TUniqueId owner, TAreaId area,
|
|
|
|
const std::vector<CJointCollisionDescription>& descs, bool active);
|
2017-03-01 03:42:06 +00:00
|
|
|
|
2020-04-10 00:32:35 +00:00
|
|
|
void Update(float dt, CStateManager& mgr, EUpdateOptions opts);
|
|
|
|
void Destroy(CStateManager& mgr);
|
2018-12-08 05:30:43 +00:00
|
|
|
void SetActive(CStateManager& mgr, bool active);
|
2021-05-02 00:28:04 +00:00
|
|
|
[[nodiscard]] bool GetActive() const { return x12_active; }
|
2018-12-08 05:30:43 +00:00
|
|
|
void AddMaterial(CStateManager& mgr, const CMaterialList& list);
|
|
|
|
void SetMovable(CStateManager& mgr, bool movable);
|
2018-11-17 05:05:57 +00:00
|
|
|
|
2021-05-02 00:28:04 +00:00
|
|
|
[[nodiscard]] u32 GetNumCollisionActors() const { return x0_jointDescriptions.size(); }
|
2019-06-12 02:05:17 +00:00
|
|
|
std::optional<zeus::CVector3f> GetDeviation(const CStateManager&, CSegId);
|
2021-06-07 19:29:18 +00:00
|
|
|
[[nodiscard]] const CJointCollisionDescription& GetCollisionDescFromIndex(u32 i) const {
|
|
|
|
return x0_jointDescriptions[i];
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
static zeus::CTransform GetWRLocatorTransform(const CAnimData& animData, CSegId id, const zeus::CTransform& worldXf,
|
|
|
|
const zeus::CTransform& localXf);
|
2017-03-01 03:42:06 +00:00
|
|
|
};
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|