2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CMODELDATA_HPP__
|
|
|
|
#define __URDE_CMODELDATA_HPP__
|
|
|
|
|
|
|
|
#include "zeus/CVector3f.hpp"
|
2016-04-14 03:32:27 +00:00
|
|
|
#include "zeus/CAABox.hpp"
|
2016-04-14 21:42:47 +00:00
|
|
|
#include "zeus/CColor.hpp"
|
2016-04-14 03:32:27 +00:00
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "CToken.hpp"
|
2016-04-19 00:17:49 +00:00
|
|
|
#include "CAnimData.hpp"
|
2016-04-13 06:07:23 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2016-04-14 03:32:27 +00:00
|
|
|
class CCharAnimTime;
|
|
|
|
class CStateManager;
|
|
|
|
class CActorLights;
|
|
|
|
class CModelFlags;
|
|
|
|
class CRandom16;
|
|
|
|
class CFrustumPlanes;
|
|
|
|
class CAnimData;
|
|
|
|
class CModel;
|
2016-04-14 21:42:47 +00:00
|
|
|
class CSkinnedModel;
|
|
|
|
struct SAdvancementDeltas;
|
2016-04-13 06:07:23 +00:00
|
|
|
|
2016-04-14 03:32:27 +00:00
|
|
|
struct CStaticRes
|
|
|
|
{
|
2016-04-19 21:25:26 +00:00
|
|
|
ResId x0_cmdlId = 0;
|
2016-04-19 00:17:49 +00:00
|
|
|
zeus::CVector3f x4_scale;
|
2016-04-14 03:32:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CAnimRes
|
2016-04-13 06:07:23 +00:00
|
|
|
{
|
2016-04-19 21:25:26 +00:00
|
|
|
ResId x0_ancsId = 0;
|
|
|
|
s32 x4_charIdx = 0;
|
2016-04-19 00:17:49 +00:00
|
|
|
zeus::CVector3f x8_scale;
|
2016-04-19 21:25:26 +00:00
|
|
|
bool x14_ = false;
|
|
|
|
s32 x1c_defaultAnim = 0;
|
2016-04-13 06:07:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CModelData
|
|
|
|
{
|
2016-04-22 20:22:45 +00:00
|
|
|
friend class CActor;
|
2016-04-14 03:32:27 +00:00
|
|
|
zeus::CVector3f x0_particleScale;
|
|
|
|
std::unique_ptr<CAnimData> xc_animData;
|
2016-04-14 21:42:47 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool x14_24_renderSorted : 1;
|
|
|
|
bool x14_25_sortThermal : 1;
|
|
|
|
};
|
|
|
|
u32 _flags = 0;
|
|
|
|
};
|
|
|
|
zeus::CColor x18_ambientColor;
|
2016-04-14 03:32:27 +00:00
|
|
|
TLockedToken<CModel> x1c_normalModel;
|
|
|
|
TLockedToken<CModel> x2c_xrayModel;
|
|
|
|
TLockedToken<CModel> x3c_infraModel;
|
2016-04-15 03:02:21 +00:00
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
public:
|
2016-04-14 03:32:27 +00:00
|
|
|
enum class EWhichModel
|
|
|
|
{
|
2016-04-14 21:42:47 +00:00
|
|
|
Normal,
|
|
|
|
XRay,
|
|
|
|
Thermal
|
2016-04-14 03:32:27 +00:00
|
|
|
};
|
|
|
|
|
2016-04-15 03:02:21 +00:00
|
|
|
~CModelData();
|
2016-04-14 03:32:27 +00:00
|
|
|
CModelData(const CStaticRes& res);
|
2016-04-13 06:07:23 +00:00
|
|
|
CModelData(const CAnimRes& res);
|
2016-04-15 03:02:21 +00:00
|
|
|
CModelData(CModelData&&) = default;
|
2016-04-19 00:17:49 +00:00
|
|
|
CModelData& operator=(CModelData&&) = default;
|
|
|
|
CModelData();
|
2016-04-19 21:25:26 +00:00
|
|
|
static CModelData CModelDataNull();
|
2016-04-14 03:32:27 +00:00
|
|
|
|
2016-04-14 21:42:47 +00:00
|
|
|
SAdvancementDeltas GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
void Render(const CStateManager& stateMgr, const zeus::CTransform& xf,
|
|
|
|
const CActorLights* lights, const CModelFlags& drawFlags) const;
|
2016-04-14 21:42:47 +00:00
|
|
|
EWhichModel GetRenderingModel(const CStateManager& stateMgr) const;
|
|
|
|
const CSkinnedModel& PickAnimatedModel(EWhichModel which) const;
|
|
|
|
const TLockedToken<CModel>& PickStaticModel(EWhichModel which) const;
|
|
|
|
void SetXRayModel(const std::pair<ResId, ResId>& modelSkin);
|
|
|
|
void SetInfraModel(const std::pair<ResId, ResId>& modelSkin);
|
2016-04-14 03:32:27 +00:00
|
|
|
bool IsDefinitelyOpaque(EWhichModel) const;
|
|
|
|
bool GetIsLoop() const;
|
|
|
|
float GetAnimationDuration(int) const;
|
|
|
|
void EnableLooping(bool);
|
|
|
|
void AdvanceParticles(const zeus::CTransform& xf, float, CStateManager& stateMgr);
|
|
|
|
zeus::CAABox GetBounds() const;
|
|
|
|
zeus::CAABox GetBounds(const zeus::CTransform& xf) const;
|
|
|
|
zeus::CTransform GetScaledLocatorTransformDynamic(const std::string& name, const CCharAnimTime* time) const;
|
|
|
|
zeus::CTransform GetScaledLocatorTransform(const std::string& name) const;
|
|
|
|
zeus::CTransform GetLocatorTransformDynamic(const std::string& name, const CCharAnimTime* time) const;
|
|
|
|
zeus::CTransform GetLocatorTransform(const std::string& name) const;
|
2016-04-14 21:42:47 +00:00
|
|
|
SAdvancementDeltas AdvanceAnimationIgnoreParticles(float dt, CRandom16&, bool);
|
|
|
|
SAdvancementDeltas AdvanceAnimation(float dt, CStateManager& stateMgr, bool);
|
2016-04-14 03:32:27 +00:00
|
|
|
bool IsAnimating() const;
|
|
|
|
bool IsInFrustum(const zeus::CTransform& xf, const CFrustumPlanes& frustum) const;
|
|
|
|
void RenderParticles(const CFrustumPlanes& frustum) const;
|
2016-04-14 21:42:47 +00:00
|
|
|
void Touch(EWhichModel, int shaderIdx) const;
|
|
|
|
void Touch(const CStateManager& stateMgr, int shaderIdx) const;
|
2016-04-14 03:32:27 +00:00
|
|
|
void RenderThermal(const zeus::CTransform& xf, const zeus::CColor& a, const zeus::CColor& b) const;
|
|
|
|
void RenderUnsortedParts(EWhichModel, const zeus::CTransform& xf,
|
|
|
|
const CActorLights* lights, const CModelFlags& drawFlags) const;
|
|
|
|
void Render(EWhichModel, const zeus::CTransform& xf,
|
|
|
|
const CActorLights* lights, const CModelFlags& drawFlags) const;
|
2016-04-22 20:22:45 +00:00
|
|
|
|
|
|
|
std::unique_ptr<CAnimData>& AnimationData() { return xc_animData; }
|
2016-04-13 06:07:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CMODELDATA_HPP__
|