2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 22:27:43 +00:00

All animation nodes implemented

This commit is contained in:
Jack Andersen
2018-01-29 15:04:01 -10:00
parent bb10423267
commit 36f1473f3e
31 changed files with 809 additions and 179 deletions

View File

@@ -19,33 +19,80 @@ CAnimTreeBlend::CAnimTreeBlend(bool b1,
}
SAdvancementResults CAnimTreeBlend::VAdvanceView(const CCharAnimTime& a)
SAdvancementResults CAnimTreeBlend::VAdvanceView(const CCharAnimTime& dt)
{
return {};
IncAdvancementDepth();
SAdvancementResults resA = x14_a->VAdvanceView(dt);
SAdvancementResults resB = x18_b->VAdvanceView(dt);
DecAdvancementDepth();
if (ShouldCullTree())
{
if (GetBlendingWeight() < 0.5f)
x20_25_cullSelector = 1;
else
x20_25_cullSelector = 2;
}
const SAdvancementResults& maxRemTime = (resA.x0_remTime < resB.x0_remTime) ? resB : resA;
if (x1c_flags & 0x1)
{
return {maxRemTime.x0_remTime, SAdvancementDeltas::Blend(resA.x8_deltas, resB.x8_deltas,
GetBlendingWeight())};
}
else
{
return resB;
}
}
CCharAnimTime CAnimTreeBlend::VGetTimeRemaining() const
{
return {};
CCharAnimTime remA = x14_a->VGetTimeRemaining();
CCharAnimTime remB = x18_b->VGetTimeRemaining();
return (remA < remB) ? remB : remA;
}
CSteadyStateAnimInfo CAnimTreeBlend::VGetSteadyStateAnimInfo() const
{
return {};
CSteadyStateAnimInfo ssA = x14_a->VGetSteadyStateAnimInfo();
CSteadyStateAnimInfo ssB = x18_b->VGetSteadyStateAnimInfo();
zeus::CVector3f resOffset;
if (ssA.GetDuration() < ssB.GetDuration())
{
resOffset = ssA.GetOffset() * (ssB.GetDuration() / ssA.GetDuration()) * x24_blendWeight +
ssB.GetOffset() * (1.f - x24_blendWeight);
}
else if (ssB.GetDuration() < ssA.GetDuration())
{
resOffset = ssA.GetOffset() * x24_blendWeight +
ssB.GetOffset() * (ssA.GetDuration() / ssB.GetDuration()) * (1.f - x24_blendWeight);
}
else
{
resOffset = ssA.GetOffset() + ssB.GetOffset();
}
return {ssA.IsLooping(),
(ssA.GetDuration() < ssB.GetDuration()) ? ssB.GetDuration() : ssA.GetDuration(),
resOffset};
}
std::unique_ptr<IAnimReader> CAnimTreeBlend::VClone() const
{
return {};
return std::make_unique<CAnimTreeBlend>(x20_24_b1,
CAnimTreeNode::Cast(x14_a->Clone()),
CAnimTreeNode::Cast(x18_b->Clone()),
x24_blendWeight, x4_name);
}
void CAnimTreeBlend::SetBlendingWeight(float w)
{
x24_blendWeight = w;
}
float CAnimTreeBlend::VGetBlendingWeight() const
{
return 0.f;
return x24_blendWeight;
}
}