metaforce/Runtime/Character/CLayoutDescription.hpp

42 lines
1.2 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-04-13 23:07:18 +00:00
#include <optional>
2016-04-13 23:07:18 +00:00
#include "CToken.hpp"
#include "zeus/CVector3f.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
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;
2018-12-08 05:30:43 +00:00
float xc_scale;
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:
2018-12-08 05:30:43 +00:00
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
2018-12-08 05:30:43 +00:00
} // namespace urde