mirror of https://github.com/AxioDL/metaforce.git
Add CPOINode family of classes
This commit is contained in:
parent
8242c3edda
commit
64d85d7427
|
@ -23,9 +23,18 @@ struct EVNT : BigYAML
|
|||
Value<atUint16> type;
|
||||
struct CharAnimTime : BigYAML
|
||||
{
|
||||
enum class Type : atUint32
|
||||
{
|
||||
NonZero,
|
||||
ZeroIncreasing,
|
||||
ZeroSteady,
|
||||
ZeroDecreasing,
|
||||
Infinity
|
||||
};
|
||||
|
||||
DECL_YAML
|
||||
Value<float> time;
|
||||
Value<atUint32> unk1;
|
||||
Value<Type> type;
|
||||
};
|
||||
|
||||
CharAnimTime animTime;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace urde
|
|||
class CAnimTreeDoubleChild : public CAnimTreeNode
|
||||
{
|
||||
public:
|
||||
void VAdvanceView(const CCharAnimTime& a);
|
||||
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
|
||||
void VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32, u32, u32) const;
|
||||
void VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32, u32, u32) const;
|
||||
void VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32, u32, u32) const;
|
||||
|
|
|
@ -9,7 +9,7 @@ CAnimTreeSingleChild::CAnimTreeSingleChild(const std::weak_ptr<CAnimTreeNode>& n
|
|||
|
||||
}
|
||||
|
||||
void CAnimTreeSingleChild::VAdvanceView(const CCharAnimTime& a)
|
||||
SAdvancementResults CAnimTreeSingleChild::VAdvanceView(const CCharAnimTime& a)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class CAnimTreeSingleChild : public CAnimTreeNode
|
|||
public:
|
||||
CAnimTreeSingleChild(const std::weak_ptr<CAnimTreeNode>& node, const std::string& name);
|
||||
|
||||
void VAdvanceView(const CCharAnimTime& a);
|
||||
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
|
||||
void VGetTimeRemaining() const;
|
||||
bool VHasOffset(const CSegId& seg) const;
|
||||
void VGetOffset(const CSegId& seg) const;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#include "CBoolPOINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CBoolPOINode::CBoolPOINode()
|
||||
: CPOINode("root", 1, CCharAnimTime(), -1, false, 1.f, -1, 0) {}
|
||||
|
||||
CBoolPOINode::CBoolPOINode(CInputStream& in)
|
||||
: CPOINode(in), x38_val(in.readBool()) {}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __PSHAG_CBOOLPOINODE_HPP__
|
||||
#define __PSHAG_CBOOLPOINODE_HPP__
|
||||
|
||||
#include "CPOINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CBoolPOINode : public CPOINode
|
||||
{
|
||||
bool x38_val = false;
|
||||
public:
|
||||
CBoolPOINode();
|
||||
CBoolPOINode(CInputStream& in);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CBOOLPOINODE_HPP__
|
|
@ -1,4 +1,5 @@
|
|||
#include "CCharAnimTime.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __PSHAG_CCHARANIMTIME_HPP__
|
||||
#define __PSHAG_CCHARANIMTIME_HPP__
|
||||
|
||||
#include <algorithm>
|
||||
#include "IOStreams.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -19,6 +19,9 @@ class CCharAnimTime
|
|||
} m_type = Type::ZeroSteady;
|
||||
public:
|
||||
CCharAnimTime() = default;
|
||||
CCharAnimTime(CInputStream& in)
|
||||
: m_time(in.readFloatBig()),
|
||||
m_type(Type(in.readUint32Big())) {}
|
||||
CCharAnimTime(float time)
|
||||
: m_time(time),
|
||||
m_type(m_time != 0.f ? Type::NonZero : Type::ZeroSteady) {}
|
||||
|
|
|
@ -5,9 +5,7 @@ namespace urde
|
|||
|
||||
SObjectTag CEffectComponent::GetSObjectTagFromStream(CInputStream& in)
|
||||
{
|
||||
char tpChars[4];
|
||||
in.readBytesToBuf(tpChars, 4);
|
||||
return {tpChars, in.readUint32Big()};
|
||||
return SObjectTag(in);
|
||||
}
|
||||
|
||||
CEffectComponent::CEffectComponent(CInputStream& in)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __PSHAG_CEFFECTCOMPONENT_HPP__
|
||||
|
||||
#include "IOStreams.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include "CInt32POINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CInt32POINode::CInt32POINode(CInputStream& in)
|
||||
: CPOINode(in), x38_val(in.readUint32Big()), x3c_boneName(in.readString()) {}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __PSHAG_CINT32POINODE_HPP__
|
||||
#define __PSHAG_CINT32POINODE_HPP__
|
||||
|
||||
#include "CPOINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CInt32POINode : public CPOINode
|
||||
{
|
||||
u32 x38_val;
|
||||
std::string x3c_boneName;
|
||||
public:
|
||||
CInt32POINode(CInputStream& in);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CINT32POINODE_HPP__
|
|
@ -3,7 +3,7 @@ add_library(RuntimeCommonCharacter
|
|||
CCharacterFactory.hpp CCharacterFactory.cpp
|
||||
CAnimData.hpp CAnimData.cpp
|
||||
CCharAnimTime.hpp CCharAnimTime.cpp
|
||||
IMetaAnim.hpp
|
||||
IMetaAnim.hpp IMetaAnim.cpp
|
||||
IMetaTrans.hpp
|
||||
CAnimationDatabase.hpp
|
||||
CAnimationDatabaseGame.hpp
|
||||
|
@ -54,4 +54,10 @@ add_library(RuntimeCommonCharacter
|
|||
CPrimitive.hpp CPrimitive.cpp
|
||||
CHalfTransition.hpp CHalfTransition.cpp
|
||||
CTimeScaleFunctions.hpp CTimeScaleFunctions.cpp
|
||||
CParticleData.hpp CParticleData.cpp
|
||||
CPOINode.hpp CPOINode.cpp
|
||||
CBoolPOINode.hpp CBoolPOINode.cpp
|
||||
CInt32POINode.hpp CInt32POINode.cpp
|
||||
CSoundPOINode.hpp CSoundPOINode.cpp
|
||||
CParticlePOINode.hpp CParticlePOINode.cpp
|
||||
CBodyState.hpp)
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#include "CPOINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CPOINode::CPOINode(const std::string& name, u16 a, const CCharAnimTime& time,
|
||||
u32 index, bool c, float d, u32 e, u32 f)
|
||||
: x4_(1),
|
||||
x8_name(name),
|
||||
x18_(a),
|
||||
x1c_time(time),
|
||||
x24_index(index),
|
||||
x28_(c),
|
||||
x2c_(d),
|
||||
x30_(e),
|
||||
x34_(f)
|
||||
{}
|
||||
|
||||
CPOINode::CPOINode(CInputStream& in)
|
||||
: x4_(in.readUint16Big()),
|
||||
x8_name(in.readString()),
|
||||
x18_(in.readUint16Big()),
|
||||
x1c_time(in),
|
||||
x24_index(in.readUint32Big()),
|
||||
x28_(in.readBool()),
|
||||
x2c_(in.readFloatBig()),
|
||||
x30_(in.readUint32Big()),
|
||||
x34_(in.readUint32Big())
|
||||
{}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef __PSHAG_CPOINODE_HPP__
|
||||
#define __PSHAG_CPOINODE_HPP__
|
||||
|
||||
#include "IOStreams.hpp"
|
||||
#include "CCharAnimTime.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CPOINode
|
||||
{
|
||||
u16 x4_ = 1;
|
||||
std::string x8_name;
|
||||
u16 x18_;
|
||||
CCharAnimTime x1c_time;
|
||||
u32 x24_index;
|
||||
bool x28_;
|
||||
float x2c_;
|
||||
u32 x30_;
|
||||
u32 x34_;
|
||||
public:
|
||||
CPOINode(const std::string& name, u16, const CCharAnimTime& time, u32 index, bool, float, u32, u32);
|
||||
CPOINode(CInputStream& in);
|
||||
virtual ~CPOINode() = default;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CPOINODE_HPP__
|
|
@ -0,0 +1,14 @@
|
|||
#include "CParticleData.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CParticleData::CParticleData(CInputStream& in)
|
||||
: x0_duration(in.readUint32Big()),
|
||||
x4_particle(in),
|
||||
xc_boneName(in.readString()),
|
||||
x1c_scale(in.readFloatBig()),
|
||||
x20_parentMode(EParentedMode(in.readUint32Big()))
|
||||
{}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef __PSHAG_CPARTICLEDATA_HPP__
|
||||
#define __PSHAG_CPARTICLEDATA_HPP__
|
||||
|
||||
#include "IOStreams.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
enum class EParentedMode
|
||||
{
|
||||
Initial,
|
||||
ContinuousEmitter,
|
||||
ContinuousSystem
|
||||
};
|
||||
|
||||
class CParticleData
|
||||
{
|
||||
u32 x0_duration;
|
||||
SObjectTag x4_particle;
|
||||
std::string xc_boneName;
|
||||
float x1c_scale;
|
||||
EParentedMode x20_parentMode;
|
||||
public:
|
||||
CParticleData(CInputStream& in);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CPARTICLEDATA_HPP__
|
|
@ -0,0 +1,9 @@
|
|||
#include "CParticlePOINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CParticlePOINode::CParticlePOINode(CInputStream& in)
|
||||
: CPOINode(in), x38_data(in) {}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __PSHAG_CPARTICLEPOINODE_HPP__
|
||||
#define __PSHAG_CPARTICLEPOINODE_HPP__
|
||||
|
||||
#include "CPOINode.hpp"
|
||||
#include "CParticleData.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CParticlePOINode : public CPOINode
|
||||
{
|
||||
CParticleData x38_data;
|
||||
public:
|
||||
CParticlePOINode(CInputStream& in);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CPARTICLEPOINODE_HPP__
|
|
@ -2,6 +2,7 @@
|
|||
#define __PSHAG_CPRIMITIVE_HPP__
|
||||
|
||||
#include "IOStreams.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#include "CSoundPOINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CSoundPOINode::CSoundPOINode(CInputStream& in)
|
||||
: CPOINode(in),
|
||||
x38_sfxId(in.readUint32Big()),
|
||||
x3c_falloff(in.readFloatBig()),
|
||||
x40_maxDist(in.readFloatBig())
|
||||
{}
|
||||
|
||||
CSoundPOINode::CSoundPOINode(const std::string& name, u16 a,
|
||||
const CCharAnimTime& time, u32 b, bool c,
|
||||
float d, u32 e, u32 f, u32 sfxId, float falloff, float maxDist)
|
||||
: CPOINode(name, a, time, b, c, d, e, f),
|
||||
x38_sfxId(sfxId), x3c_falloff(falloff), x40_maxDist(maxDist) {}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef __PSHAG_CSOUNDPOINODE_HPP__
|
||||
#define __PSHAG_CSOUNDPOINODE_HPP__
|
||||
|
||||
#include "CPOINode.hpp"
|
||||
#include "CCharAnimTime.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CSoundPOINode : public CPOINode
|
||||
{
|
||||
u32 x38_sfxId;
|
||||
float x3c_falloff;
|
||||
float x40_maxDist;
|
||||
public:
|
||||
CSoundPOINode(CInputStream& in);
|
||||
CSoundPOINode(const std::string& name, u16 a,
|
||||
const CCharAnimTime& time, u32 b, bool c,
|
||||
float d, u32 e, u32 f, u32 sfxId, float falloff, float maxDist);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __PSHAG_CSOUNDPOINODE_HPP__
|
|
@ -7,8 +7,24 @@ namespace urde
|
|||
SAdvancementResults IAnimReader::VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const
|
||||
{
|
||||
SAdvancementResults ret;
|
||||
ret.x0_animTime = a;
|
||||
ret.x0_remTime = a;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void IAnimReader::GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32, u32, u32) const
|
||||
{
|
||||
}
|
||||
|
||||
void IAnimReader::GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32, u32, u32) const
|
||||
{
|
||||
}
|
||||
|
||||
void IAnimReader::GetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32, u32, u32) const
|
||||
{
|
||||
}
|
||||
|
||||
void IAnimReader::GetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32, u32, u32) const
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class CSegStatementSet;
|
|||
|
||||
struct SAdvancementResults
|
||||
{
|
||||
CCharAnimTime x0_animTime;
|
||||
CCharAnimTime x0_remTime;
|
||||
zeus::CVector3f x8_posDelta;
|
||||
zeus::CQuaternion x14_rotDelta;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ class IAnimReader
|
|||
public:
|
||||
virtual ~IAnimReader() = default;
|
||||
virtual bool IsCAnimTreeNode() const {return false;}
|
||||
virtual void VAdvanceView(const CCharAnimTime& a)=0;
|
||||
virtual SAdvancementResults VAdvanceView(const CCharAnimTime& a)=0;
|
||||
virtual void VGetTimeRemaining() const=0;
|
||||
virtual void VGetSteadyStateAnimInfo() const=0;
|
||||
virtual bool VHasOffset(const CSegId& seg) const=0;
|
||||
|
@ -51,6 +51,11 @@ public:
|
|||
virtual void VGetContributionOfHighestInfluence() const=0;
|
||||
virtual void VGetNumChildren() const=0;
|
||||
virtual void VGetBestUnblendedChild() const=0;
|
||||
|
||||
void GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32, u32, u32) const;
|
||||
void GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32, u32, u32) const;
|
||||
void GetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32, u32, u32) const;
|
||||
void GetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32, u32, u32) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#include "IMetaAnim.hpp"
|
||||
#include "CCharAnimTime.hpp"
|
||||
#include "IAnimReader.hpp"
|
||||
#include "CBoolPOINode.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
std::shared_ptr<CAnimTreeNode>
|
||||
IMetaAnim::GetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void IMetaAnim::AdvanceAnim(IAnimReader& anim, const CCharAnimTime& dt)
|
||||
{
|
||||
CCharAnimTime remDt = dt;
|
||||
while (remDt > CCharAnimTime())
|
||||
{
|
||||
SAdvancementResults res = anim.VAdvanceView(remDt);
|
||||
remDt = res.x0_remTime;
|
||||
}
|
||||
}
|
||||
|
||||
CCharAnimTime IMetaAnim::GetTime(const CPreAdvanceIndicator& ind, const IAnimReader& anim)
|
||||
{
|
||||
if (ind.IsTime())
|
||||
return ind.GetTime();
|
||||
|
||||
CBoolPOINode nodes[64];
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
#define __PSHAG_IMETAANIM_HPP__
|
||||
|
||||
#include "../RetroTypes.hpp"
|
||||
#include "CCharAnimTime.hpp"
|
||||
#include <set>
|
||||
|
||||
namespace urde
|
||||
|
@ -10,6 +11,7 @@ class CAnimTreeNode;
|
|||
class CAnimSysContext;
|
||||
class CMetaAnimTreeBuildOrders;
|
||||
class CPrimitive;
|
||||
class IAnimReader;
|
||||
|
||||
enum class EMetaAnimType
|
||||
{
|
||||
|
@ -20,16 +22,35 @@ enum class EMetaAnimType
|
|||
Sequence
|
||||
};
|
||||
|
||||
class CPreAdvanceIndicator
|
||||
{
|
||||
bool x0_isTime;
|
||||
CCharAnimTime x4_time;
|
||||
const char* xc_string;
|
||||
public:
|
||||
CPreAdvanceIndicator(const CCharAnimTime& time)
|
||||
: x0_isTime(true), x4_time(time) {}
|
||||
CPreAdvanceIndicator(const char* string)
|
||||
: x0_isTime(false), xc_string(string) {}
|
||||
const char* GetString() const {return xc_string;}
|
||||
bool IsString() const {return !x0_isTime;}
|
||||
const CCharAnimTime& GetTime() const {return x4_time;}
|
||||
bool IsTime() const {return x0_isTime;}
|
||||
};
|
||||
|
||||
class IMetaAnim
|
||||
{
|
||||
public:
|
||||
virtual ~IMetaAnim() = default;
|
||||
virtual std::shared_ptr<CAnimTreeNode> GetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const=0;
|
||||
const CMetaAnimTreeBuildOrders& orders) const;
|
||||
virtual void GetUniquePrimitives(std::set<CPrimitive>& primsOut) const=0;
|
||||
virtual EMetaAnimType GetType() const=0;
|
||||
virtual std::shared_ptr<CAnimTreeNode> VGetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const=0;
|
||||
|
||||
static void AdvanceAnim(IAnimReader& anim, const CCharAnimTime& dt);
|
||||
CCharAnimTime GetTime(const CPreAdvanceIndicator& ind, const IAnimReader& anim);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#ifndef __PSHAG_IOSTREAMS_HPP__
|
||||
#define __PSHAG_IOSTREAMS_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "GCNTypes.hpp"
|
||||
#include <athena/IStreamReader.hpp>
|
||||
#include <athena/IStreamWriter.hpp>
|
||||
#include <athena/MemoryReader.hpp>
|
||||
#include <athena/MemoryWriter.hpp>
|
||||
#include <zlib.h>
|
||||
|
||||
namespace urde
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "GCNTypes.hpp"
|
||||
#include "rstl.hpp"
|
||||
#include "DataSpec/DNACommon/DNACommon.hpp"
|
||||
#include "IOStreams.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -23,6 +24,11 @@ struct SObjectTag
|
|||
bool operator==(const SObjectTag& other) const {return id == other.id;}
|
||||
SObjectTag() = default;
|
||||
SObjectTag(FourCC tp, TResId rid) : type(tp), id(rid) {}
|
||||
SObjectTag(CInputStream& in)
|
||||
{
|
||||
in.readBytesToBuf(&type, 4);
|
||||
id = in.readUint32Big();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue