metaforce/Runtime/GuiSys/CGuiObject.hpp

50 lines
1.8 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-03-10 03:47:37 +00:00
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
2016-09-14 05:45:46 +00:00
#include "zeus/CQuaternion.hpp"
2016-03-10 03:47:37 +00:00
#include "zeus/CTransform.hpp"
namespace urde
{
2016-03-17 02:18:01 +00:00
struct CGuiWidgetDrawParms;
2016-03-10 03:47:37 +00:00
class CGuiObject : public std::enable_shared_from_this<CGuiObject>
2016-03-10 03:47:37 +00:00
{
2016-03-16 03:37:51 +00:00
protected:
2016-03-10 03:47:37 +00:00
zeus::CTransform x4_localXF;
zeus::CTransform x34_worldXF;
CGuiObject* x64_parent = nullptr;
CGuiObject* x68_child = nullptr;
CGuiObject* x6c_nextSibling = nullptr;
2016-03-10 03:47:37 +00:00
public:
virtual ~CGuiObject() = default;
2016-03-10 03:47:37 +00:00
virtual void Update(float dt);
virtual void Draw(const CGuiWidgetDrawParms& parms) const;
2016-12-16 04:35:49 +00:00
virtual void Initialize()=0;
2016-03-10 03:47:37 +00:00
void MoveInWorld(const zeus::CVector3f& vec);
const zeus::CVector3f& GetLocalPosition() const { return x4_localXF.origin; }
2017-04-02 03:03:37 +00:00
const zeus::CTransform& GetLocalTransform() const { return x4_localXF; }
2016-03-14 00:58:19 +00:00
void SetLocalPosition(const zeus::CVector3f& pos);
const zeus::CVector3f& GetWorldPosition() const { return x34_worldXF.origin; }
2017-04-02 03:03:37 +00:00
const zeus::CTransform& GetWorldTransform() const { return x34_worldXF; }
2016-03-10 03:47:37 +00:00
void RotateReset();
zeus::CVector3f RotateW2O(const zeus::CVector3f& vec) const;
zeus::CVector3f RotateO2P(const zeus::CVector3f& vec) const;
zeus::CVector3f RotateTranslateW2O(const zeus::CVector3f& vec) const;
void MultiplyO2P(const zeus::CTransform& xf);
2016-03-11 00:23:16 +00:00
void AddChildObject(CGuiObject* obj, bool makeWorldLocal, bool atEnd);
2016-03-10 03:47:37 +00:00
CGuiObject* RemoveChildObject(CGuiObject* obj, bool makeWorldLocal);
CGuiObject* GetParent() const { return x64_parent; }
CGuiObject* GetChildObject() const { return x68_child; }
CGuiObject* GetNextSibling() const { return x6c_nextSibling; }
2016-03-10 03:47:37 +00:00
void RecalculateTransforms();
void Reorthogonalize();
void SetO2WTransform(const zeus::CTransform& xf);
2016-12-16 04:35:49 +00:00
void SetLocalTransform(const zeus::CTransform& xf);
2016-03-10 03:47:37 +00:00
};
}