2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CMODELDATA
|
|
|
|
#define _CMODELDATA
|
2022-08-13 01:26:00 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "MetroidPrime/TGameTypes.hpp"
|
|
|
|
|
2022-11-26 13:51:04 +00:00
|
|
|
#include "Kyoto/Animation/IAnimReader.hpp"
|
2022-08-13 01:26:00 +00:00
|
|
|
#include "Kyoto/Graphics/CColor.hpp"
|
|
|
|
#include "Kyoto/Math/CTransform4f.hpp"
|
2022-08-15 04:51:06 +00:00
|
|
|
#include "Kyoto/Math/CVector3f.hpp"
|
2022-08-13 01:26:00 +00:00
|
|
|
#include "Kyoto/TToken.hpp"
|
|
|
|
|
|
|
|
#include "rstl/auto_ptr.hpp"
|
|
|
|
#include "rstl/optional_object.hpp"
|
|
|
|
#include "rstl/pair.hpp"
|
2022-11-15 20:06:18 +00:00
|
|
|
#include "rstl/string.hpp"
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-08-15 04:51:06 +00:00
|
|
|
class CAABox;
|
2022-08-16 02:14:28 +00:00
|
|
|
class CActorLights;
|
2022-08-13 01:26:00 +00:00
|
|
|
class CAnimData;
|
2022-10-06 08:53:35 +00:00
|
|
|
class CAnimRes;
|
2022-08-16 02:14:28 +00:00
|
|
|
class CFrustumPlanes;
|
2022-08-13 01:26:00 +00:00
|
|
|
class CModel;
|
2022-08-16 02:14:28 +00:00
|
|
|
class CModelFlags;
|
2022-10-06 20:40:18 +00:00
|
|
|
class CStateManager;
|
2022-11-25 12:41:28 +00:00
|
|
|
class CSkinnedModel;
|
2022-11-26 13:51:04 +00:00
|
|
|
class CRandom16;
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-08-14 18:38:41 +00:00
|
|
|
// TODO move
|
|
|
|
#include "Kyoto/Math/CQuaternion.hpp"
|
2022-10-08 04:53:28 +00:00
|
|
|
struct CAdvancementDeltas {
|
2022-10-05 00:16:03 +00:00
|
|
|
public:
|
2022-10-08 04:53:28 +00:00
|
|
|
CAdvancementDeltas(const CVector3f& posDelta, const CQuaternion& rotDelta)
|
|
|
|
: x0_posDelta(posDelta), xc_rotDelta(rotDelta) {}
|
|
|
|
|
2022-10-05 00:16:03 +00:00
|
|
|
const CVector3f& GetOffsetDelta() const { return x0_posDelta; }
|
|
|
|
const CQuaternion& GetOrientationDelta() const { return xc_rotDelta; }
|
|
|
|
|
|
|
|
private:
|
2022-08-14 18:38:41 +00:00
|
|
|
CVector3f x0_posDelta;
|
|
|
|
CQuaternion xc_rotDelta;
|
|
|
|
};
|
2022-10-08 04:53:28 +00:00
|
|
|
CHECK_SIZEOF(CAdvancementDeltas, 0x1c)
|
2022-08-14 18:38:41 +00:00
|
|
|
|
2022-10-17 15:02:11 +00:00
|
|
|
class CStaticRes {
|
|
|
|
CAssetId x0_cmdlId;
|
|
|
|
CVector3f x4_scale;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CStaticRes(CAssetId id, const CVector3f& scale) : x0_cmdlId(id), x4_scale(scale) {}
|
|
|
|
};
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
class CModelData {
|
|
|
|
public:
|
2022-12-07 06:14:03 +00:00
|
|
|
enum EWhichModel {
|
|
|
|
kWM_Normal,
|
|
|
|
kWM_XRay,
|
|
|
|
kWM_Thermal,
|
|
|
|
kWM_ThermalHot,
|
|
|
|
};
|
|
|
|
|
2022-08-15 04:51:06 +00:00
|
|
|
// TODO these probably aren't real
|
|
|
|
bool HasNormalModel() const { return x1c_normalModel; }
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-08-15 04:51:06 +00:00
|
|
|
CModelData();
|
2022-10-06 08:53:35 +00:00
|
|
|
CModelData(const CAnimRes&);
|
2022-11-14 14:16:52 +00:00
|
|
|
CModelData(const CStaticRes&);
|
2024-10-15 05:47:46 +00:00
|
|
|
// CModelData(const CModelData& other);
|
2022-08-13 01:26:00 +00:00
|
|
|
~CModelData();
|
|
|
|
|
2022-10-08 04:53:28 +00:00
|
|
|
CAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);
|
2022-08-13 01:26:00 +00:00
|
|
|
void AdvanceParticles(const CTransform4f& xf, float dt, CStateManager& mgr);
|
2022-08-16 02:14:28 +00:00
|
|
|
void RenderParticles(const CFrustumPlanes& planes) const;
|
2022-09-18 06:05:46 +00:00
|
|
|
void RenderUnsortedParts(EWhichModel which, const CTransform4f& xf, const CActorLights* lights,
|
|
|
|
const CModelFlags& flags) const;
|
|
|
|
void RenderThermal(const CTransform4f& xf, const CColor& mulColor, const CColor& addColor,
|
|
|
|
const CModelFlags& flags) const;
|
|
|
|
void Render(const CStateManager&, const CTransform4f&, const CActorLights*,
|
|
|
|
const CModelFlags&) const;
|
2022-11-26 13:51:04 +00:00
|
|
|
void Render(EWhichModel, const CTransform4f&, const CActorLights*, const CModelFlags&) const;
|
2022-11-25 12:41:28 +00:00
|
|
|
void FlatDraw(EWhichModel which, const CTransform4f& xf, bool unsortedOnly,
|
|
|
|
const CModelFlags& flags) const;
|
|
|
|
CSkinnedModel& PickAnimatedModel(EWhichModel which) const;
|
|
|
|
void Touch(const CStateManager& mgr, int) const;
|
2022-11-26 13:51:04 +00:00
|
|
|
SAdvancementDeltas AdvanceAnimationIgnoreParticles(float dt, CRandom16& rand, bool advTree);
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-08-15 05:50:25 +00:00
|
|
|
const CAnimData* GetAnimationData() const { return xc_animData.get(); }
|
|
|
|
CAnimData* AnimationData() { return xc_animData.get(); }
|
2022-08-15 04:51:06 +00:00
|
|
|
CAABox GetBounds(const CTransform4f& xf) const;
|
|
|
|
CAABox GetBounds() const;
|
2022-11-25 12:41:28 +00:00
|
|
|
bool IsLoaded(int shaderIdx) const;
|
2023-10-19 22:51:57 +00:00
|
|
|
bool IsDefinitelyOpaque(EWhichModel which) const;
|
2022-08-15 04:51:06 +00:00
|
|
|
|
2023-10-19 22:51:57 +00:00
|
|
|
CTransform4f GetLocatorTransform(const rstl::string& name) const;
|
2022-11-15 20:06:18 +00:00
|
|
|
CTransform4f GetScaledLocatorTransform(const rstl::string& name) const;
|
|
|
|
|
2022-08-16 02:14:28 +00:00
|
|
|
bool HasAnimation() const { return !xc_animData.null(); }
|
|
|
|
bool IsNull() const { return xc_animData.null() && !x1c_normalModel; }
|
2022-08-13 01:26:00 +00:00
|
|
|
|
|
|
|
void SetXRayModel(const rstl::pair< CAssetId, CAssetId >& assets);
|
|
|
|
void SetInfraModel(const rstl::pair< CAssetId, CAssetId >& assets);
|
2022-09-13 04:26:54 +00:00
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
void SetAmbientColor(const CColor& color) { x18_ambientColor = color; }
|
2022-09-13 04:26:54 +00:00
|
|
|
bool GetSortThermal() const { return x14_25_sortThermal; }
|
2022-08-13 01:26:00 +00:00
|
|
|
void SetSortThermal(bool b) { x14_25_sortThermal = b; }
|
|
|
|
|
2022-10-25 19:35:44 +00:00
|
|
|
CVector3f GetScale() const { return x0_scale; }
|
2022-10-02 10:13:35 +00:00
|
|
|
void SetScale(const CVector3f& scale) { x0_scale = scale; }
|
|
|
|
|
2022-10-20 15:43:17 +00:00
|
|
|
bool GetIsLoop() const;
|
|
|
|
void EnableLooping(bool enable);
|
2022-09-14 02:25:08 +00:00
|
|
|
static CModelData CModelDataNull();
|
2022-08-16 02:14:28 +00:00
|
|
|
static EWhichModel GetRenderingModel(const CStateManager& mgr);
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
private:
|
|
|
|
CVector3f x0_scale;
|
|
|
|
rstl::auto_ptr< CAnimData > xc_animData;
|
|
|
|
bool x14_24_renderSorted : 1;
|
|
|
|
bool x14_25_sortThermal : 1;
|
|
|
|
CColor x18_ambientColor;
|
2024-10-15 05:47:46 +00:00
|
|
|
rstl::optional_object< TLockedToken< CModel > > x1c_normalModel;
|
|
|
|
rstl::optional_object< TLockedToken< CModel > > x2c_xrayModel;
|
|
|
|
rstl::optional_object< TLockedToken< CModel > > x3c_infraModel;
|
2022-08-13 01:26:00 +00:00
|
|
|
};
|
2022-09-18 17:51:07 +00:00
|
|
|
CHECK_SIZEOF(CModelData, 0x4c)
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CMODELDATA
|