2022-08-13 01:26:00 +00:00
|
|
|
#ifndef _CMODELDATA_HPP
|
|
|
|
#define _CMODELDATA_HPP
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
#include "MetroidPrime/TGameTypes.hpp"
|
|
|
|
|
|
|
|
#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-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-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-08-13 01:26:00 +00:00
|
|
|
|
2022-08-14 18:38:41 +00:00
|
|
|
// TODO move
|
|
|
|
#include "Kyoto/Math/CQuaternion.hpp"
|
|
|
|
struct SAdvancementDeltas {
|
2022-10-05 00:16:03 +00:00
|
|
|
public:
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
CHECK_SIZEOF(SAdvancementDeltas, 0x1c)
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
class CModelData {
|
|
|
|
public:
|
2022-08-16 02:14:28 +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();
|
|
|
|
// __ct__10CModelDataFRC8CAnimRes
|
|
|
|
// __ct__10CModelDataFRC10CStaticRes
|
2022-08-13 01:26:00 +00:00
|
|
|
CModelData(const CModelData& other);
|
|
|
|
~CModelData();
|
|
|
|
|
|
|
|
SAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);
|
|
|
|
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;
|
|
|
|
void Render(CModelData::EWhichModel, const CTransform4f&, const CActorLights*,
|
|
|
|
const CModelFlags&) const;
|
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-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-02 10:13:35 +00:00
|
|
|
const CVector3f& GetScale() const { return x0_scale; }
|
|
|
|
void SetScale(const CVector3f& scale) { x0_scale = scale; }
|
|
|
|
|
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;
|
|
|
|
rstl::optional_object< TCachedToken< CModel > > x1c_normalModel;
|
|
|
|
rstl::optional_object< TCachedToken< CModel > > x2c_xrayModel;
|
|
|
|
rstl::optional_object< TCachedToken< CModel > > x3c_infraModel;
|
|
|
|
};
|
2022-09-18 17:51:07 +00:00
|
|
|
CHECK_SIZEOF(CModelData, 0x4c)
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-08-15 05:50:25 +00:00
|
|
|
#endif
|