metaforce/Runtime/Character/CLayoutDescription.hpp

44 lines
1.2 KiB
C++
Raw Permalink Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-04-13 23:07:18 +00:00
#include <optional>
#include "Runtime/CToken.hpp"
#include <zeus/CVector3f.hpp>
2016-04-13 23:07:18 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
2016-04-13 23:07:18 +00:00
class CCharLayoutInfo;
2018-12-08 05:30:43 +00:00
class CLayoutDescription {
2016-04-13 23:07:18 +00:00
public:
2018-12-08 05:30:43 +00:00
class CScaledLayoutDescription {
2016-04-13 23:07:18 +00:00
TLockedToken<CCharLayoutInfo> x0_layoutToken;
float xc_scale = 0.0f;
std::optional<zeus::CVector3f> x10_scaleVec;
2018-12-08 05:30:43 +00:00
public:
const TLockedToken<CCharLayoutInfo>& ScaledLayout() const { return x0_layoutToken; }
float GlobalScale() const { return xc_scale; }
const std::optional<zeus::CVector3f>& GetScaleVec() const { return x10_scaleVec; }
2018-12-08 05:30:43 +00:00
};
private:
TLockedToken<CCharLayoutInfo> x0_layoutToken;
std::optional<CScaledLayoutDescription> xc_scaled;
2018-12-08 05:30:43 +00:00
2016-04-13 23:07:18 +00:00
public:
explicit CLayoutDescription(const TLockedToken<CCharLayoutInfo>& token) : x0_layoutToken(token) {}
2016-04-13 23:07:18 +00:00
const std::optional<CScaledLayoutDescription>& GetScaledLayoutDescription() const { return xc_scaled; }
2018-12-08 05:30:43 +00:00
const TLockedToken<CCharLayoutInfo>& GetCharLayoutInfo() const { return x0_layoutToken; }
bool UsesScale() const { return bool(xc_scaled); }
const TLockedToken<CCharLayoutInfo>& ScaledLayout() const {
if (UsesScale())
return xc_scaled->ScaledLayout();
return x0_layoutToken;
}
};
2016-04-13 23:07:18 +00:00
2021-04-10 08:42:06 +00:00
} // namespace metaforce