Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
pane.h
Go to the documentation of this file.
1#ifndef NW4HBM_LYT_PANE_H
2#define NW4HBM_LYT_PANE_H
3
4#include <revolution/types.h>
5
6#include "../ut/Color.h"
7#include "../ut/LinkList.h"
8#include "../ut/Rect.h"
10
11#include "../db/assert.h"
12
13#include "../math/types.h"
14
15#include "animation.h"
16#include "drawInfo.h"
17#include "lyt_types.h"
18#include "material.h"
19
20
21namespace nw4hbm {
22 namespace lyt {
23 class Pane;
24
25 namespace detail {
26 class PaneBase {
27 public:
28 inline PaneBase() : mLink() {}
29
30 /* 0x08 */ virtual ~PaneBase() {}
31
32 /* 0x00 (vtable) */
34 };
35 } // namespace detail
36 typedef ut::LinkList<Pane, offsetof(detail::PaneBase, mLink)> PaneList;
37
38 enum {
39 /* 1 */ ANIMOPTION_SKIP_INVISIBLE = (1 << 0),
40 };
41
43 private:
44 enum {
45 /* 0 */ BIT_VISIBLE = 0,
48 };
49
50 public:
51 Pane();
52 Pane(const res::Pane* pBlock);
53
54 /* 0x08 */ virtual ~Pane();
56 /* 0x10 */ virtual void CalculateMtx(const DrawInfo& drawInfo);
57 /* 0x14 */ virtual void Draw(const DrawInfo& drawInfo);
58 /* 0x18 */ virtual void DrawSelf(const DrawInfo& drawInfo);
59 /* 0x1C */ virtual void Animate(u32 option = 0);
60 /* 0x20 */ virtual void AnimateSelf(u32 option = 0);
61 /* 0x24 */ virtual ut::Color GetVtxColor(u32 idx) const;
62 /* 0x28 */ virtual void SetVtxColor(u32 idx, ut::Color valuw);
63 /* 0x2C */ virtual u8 GetColorElement(u32 idx) const;
64 /* 0x30 */ virtual void SetColorElement(u32 idx, u8 color);
65 /* 0x34 */ virtual u8 GetVtxColorElement(u32 idx) const;
66 /* 0x38 */ virtual void SetVtxColorElement(u32 idx, u8 element);
67 /* 0x3C */ virtual Pane* FindPaneByName(const char* findName, bool bRecursive = true);
68 /* 0x40 */ virtual Material* FindMaterialByName(const char* findName,
69 bool bRecursive = true);
70 /* 0x44 */ virtual void BindAnimation(AnimTransform* animTrans, bool bRecursive = true);
71 /* 0x48 */ virtual void UnbindAnimation(AnimTransform* animTrans,
72 bool bRecursive = true);
73 /* 0x4C */ virtual void UnbindAllAnimation(bool bRecursive = true);
74 /* 0x50 */ virtual void UnbindAnimationSelf(AnimTransform* animTrans);
75 /* 0x54 */ virtual AnimationLink* FindAnimationLink(AnimTransform* animTrans);
76 /* 0x58 */ virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable,
77 bool bRecursive = true);
78 /* 0x5C */ virtual Material* GetMaterial() const;
79 /* 0x60 */ virtual void LoadMtx(const DrawInfo& drawInfo);
80
81 Pane* GetParent() const { return mpParent; }
83
84 const math::VEC3& GetTranslate() { return mTranslate; }
85 void SetTranslate(const math::VEC3& translate) { mTranslate = translate; }
86 void SetTranslate(const math::VEC2& translate) {
87 SetTranslate(math::VEC3(translate.x, translate.y, 0.0f));
88 }
89
90 const math::VEC3& GetRotate() const { return mRotate; }
91 void SetRotate(const math::VEC3& rotate) { mRotate = rotate; }
92
93 const math::VEC2& GetScale() const { return mScale; }
94 void SetScale(const math::VEC2& scale) { mScale = scale; }
95
96 const Size& GetSize() const { return mSize; }
97 void SetSize(const Size& size) { mSize = size; }
98
100 void SetVisible(bool visible) { detail::SetBit(&mFlag, BIT_VISIBLE, visible); };
101
103 void SetInfluencedAlpha(bool visible) {
105 };
106
108 void SetLocationAdjust(bool visible) {
110 };
111
112 const math::MTX34& GetGlobalMtx() const { return mGlbMtx; }
114
115 const math::MTX34& GetMtx() const { return mMtx; }
116 void SetMtx(const math::MTX34& mtx) { mMtx = mtx; }
117
118 u8 GetAlpha() { return mAlpha; }
119 void SetAlpha(u8 alpha) { mAlpha = alpha; }
120
121 const char* GetName() const { return mName; }
122
123 void SetSRTElement(u32 idx, f32 value) {
124 NW4HBM_ASSERT(250, idx < ANIMTARGET_PANE_MAX);
125 reinterpret_cast<f32*>(&mTranslate)[idx] = value;
126 }
127
128 bool IsUserAllocated() const { return mbUserAllocated; }
129
130 const ut::Rect GetPaneRect(const DrawInfo& drawInfo) const;
131
132 math::VEC2 GetVtxPos() const;
133
134 void SetName(const char* name);
135 void SetUserData(const char* userData);
136
137 void Init();
138
139 void InsertChild(PaneList::Iterator next, Pane* pChild);
140 void InsertChild(Pane* pNext, Pane* pChild);
141
142 void PrependChild(Pane* pChild);
143 void AppendChild(Pane* pChild);
144
145 void RemoveChild(Pane* pChild);
146
147 void CalculateMtxChild(const DrawInfo& drawInfo);
148
149 void AddAnimationLink(AnimationLink* animationLink);
150
151 protected:
152 /* 0x00 (base) */
153 /* 0x0C */ Pane* mpParent;
156 /* 0x28 */ Material* mpMaterial;
158 /* 0x38 */ math::VEC3 mRotate;
159 /* 0x44 */ math::VEC2 mScale;
160 /* 0x4C */ Size mSize;
161 /* 0x54 */ math::MTX34 mMtx;
163 /* 0xB4 */ char mName[16];
164 /* 0xC4 */ char mUserData[8];
165 /* 0xCC */ u8 mBasePosition;
166 /* 0xCD */ u8 mAlpha;
167 /* 0xCE */ u8 mGlbAlpha;
168 /* 0xCF */ u8 mFlag;
169 /* 0xD0 */ bool mbUserAllocated;
170 }; // size = 0xD4
171
172 } // namespace lyt
173} // namespace nw4hbm
174
175#endif
static Mtx mtx[10]
Definition c_lib.cpp:486
Definition animation.h:127
Definition drawInfo.h:13
Definition material.h:35
Definition pane.h:42
const math::VEC3 & GetRotate() const
Definition pane.h:90
void SetName(const char *name)
Definition lyt_pane.cpp:95
Pane()
Definition lyt_pane.cpp:35
void AppendChild(Pane *pChild)
Definition lyt_pane.cpp:103
const math::VEC3 & GetTranslate()
Definition pane.h:84
bool IsInfluencedAlpha()
Definition pane.h:102
NW4HBM_UT_RUNTIME_TYPEINFO
Definition pane.h:55
virtual ut::Color GetVtxColor(u32 idx) const
Definition lyt_pane.cpp:148
virtual void Draw(const DrawInfo &drawInfo)
Definition lyt_pane.cpp:308
virtual void LoadMtx(const DrawInfo &drawInfo)
Definition lyt_pane.cpp:430
const math::MTX34 & GetMtx() const
Definition pane.h:115
virtual Pane * FindPaneByName(const char *findName, bool bRecursive=true)
Definition lyt_pane.cpp:189
const math::MTX34 & GetGlobalMtx() const
Definition pane.h:112
virtual void SetColorElement(u32 idx, u8 color)
Definition lyt_pane.cpp:170
void SetVisible(bool visible)
Definition pane.h:100
void SetSRTElement(u32 idx, f32 value)
Definition pane.h:123
void InsertChild(Pane *pNext, Pane *pChild)
Material * mpMaterial
Definition pane.h:156
virtual void UnbindAnimation(AnimTransform *animTrans, bool bRecursive=true)
Definition lyt_pane.cpp:360
void SetGlobalMtx(const math::MTX34 &mtx)
Definition pane.h:113
bool IsLocationAdjust()
Definition pane.h:107
math::MTX34 mMtx
Definition pane.h:161
virtual void DrawSelf(const DrawInfo &drawInfo)
Definition lyt_pane.cpp:320
Pane * mpParent
Definition pane.h:153
const Size & GetSize() const
Definition pane.h:96
void SetAlpha(u8 alpha)
Definition pane.h:119
void SetRotate(const math::VEC3 &rotate)
Definition pane.h:91
void CalculateMtxChild(const DrawInfo &drawInfo)
Definition lyt_pane.cpp:300
bool mbUserAllocated
Definition pane.h:169
PaneList mChildList
Definition pane.h:154
virtual ~Pane()
Definition lyt_pane.cpp:75
math::VEC3 mTranslate
Definition pane.h:157
math::MTX34 mGlbMtx
Definition pane.h:162
virtual void CalculateMtx(const DrawInfo &drawInfo)
Definition lyt_pane.cpp:225
void Init()
Definition lyt_pane.cpp:69
AnimationLinkList mAnimList
Definition pane.h:155
virtual void UnbindAllAnimation(bool bRecursive=true)
Definition lyt_pane.cpp:372
u8 mFlag
Definition pane.h:168
char mName[16]
Definition pane.h:163
void SetScale(const math::VEC2 &scale)
Definition pane.h:94
bool IsVisible()
Definition pane.h:99
void SetUserData(const char *userData)
Definition lyt_pane.cpp:99
void RemoveChild(Pane *pChild)
bool IsUserAllocated() const
Definition pane.h:128
PaneList & GetChildList()
Definition pane.h:82
void SetLocationAdjust(bool visible)
Definition pane.h:108
const char * GetName() const
Definition pane.h:121
void SetSize(const Size &size)
Definition pane.h:97
const math::VEC2 & GetScale() const
Definition pane.h:93
math::VEC2 mScale
Definition pane.h:159
virtual void SetVtxColorElement(u32 idx, u8 element)
Definition lyt_pane.cpp:187
virtual u8 GetColorElement(u32 idx) const
Definition lyt_pane.cpp:154
void PrependChild(Pane *pChild)
char mUserData[8]
Definition pane.h:164
const ut::Rect GetPaneRect(const DrawInfo &drawInfo) const
Definition lyt_pane.cpp:129
virtual void SetVtxColor(u32 idx, ut::Color valuw)
Definition lyt_pane.cpp:152
math::VEC3 mRotate
Definition pane.h:158
u8 GetAlpha()
Definition pane.h:118
virtual void SetAnimationEnable(AnimTransform *animTrans, bool bEnable, bool bRecursive=true)
Definition lyt_pane.cpp:412
@ BIT_INFLUENCED_ALPHA
Definition pane.h:46
@ BIT_VISIBLE
Definition pane.h:45
@ BIT_LOCATION_ADJUST
Definition pane.h:47
virtual Material * FindMaterialByName(const char *findName, bool bRecursive=true)
Definition lyt_pane.cpp:207
u8 mAlpha
Definition pane.h:166
u8 mGlbAlpha
Definition pane.h:167
virtual u8 GetVtxColorElement(u32 idx) const
Definition lyt_pane.cpp:183
void InsertChild(PaneList::Iterator next, Pane *pChild)
Definition lyt_pane.cpp:114
virtual void Animate(u32 option=0)
Definition lyt_pane.cpp:327
virtual AnimationLink * FindAnimationLink(AnimTransform *animTrans)
Definition lyt_pane.cpp:398
Size mSize
Definition pane.h:160
math::VEC2 GetVtxPos() const
Definition lyt_pane.cpp:454
void SetInfluencedAlpha(bool visible)
Definition pane.h:103
void AddAnimationLink(AnimationLink *animationLink)
Definition lyt_pane.cpp:393
void SetMtx(const math::MTX34 &mtx)
Definition pane.h:116
u8 mBasePosition
Definition pane.h:165
void SetTranslate(const math::VEC2 &translate)
Definition pane.h:86
Pane * GetParent() const
Definition pane.h:81
virtual void BindAnimation(AnimTransform *animTrans, bool bRecursive=true)
Definition lyt_pane.cpp:355
virtual void AnimateSelf(u32 option=0)
Definition lyt_pane.cpp:339
void SetTranslate(const math::VEC3 &translate)
Definition pane.h:85
virtual void UnbindAnimationSelf(AnimTransform *animTrans)
Definition lyt_pane.cpp:376
virtual Material * GetMaterial() const
Definition lyt_pane.cpp:490
Definition pane.h:26
PaneBase()
Definition pane.h:28
ut::LinkListNode mLink
Definition pane.h:33
virtual ~PaneBase()
Definition pane.h:30
Definition LinkList.h:23
Definition Rect.h:11
s16 name
Definition d_a_e_pz.cpp:1757
static u32 next
Definition CARDUnlock.c:29
unsigned int size
Definition __os.h:106
unsigned long u32
Definition types.h:12
float f32
Definition types.h:25
unsigned char u8
Definition types.h:8
bool TestBit(T bits, int pos)
Definition lyt_types.h:113
void SetBit(T *pBits, int pos, bool val)
Definition lyt_types.h:106
struct nw4hbm::lyt::res::Pane Pane
ut::LinkList< Pane, offsetof(detail::PaneBase, mLink)> PaneList
Definition pane.h:36
@ ANIMTARGET_PANE_MAX
Definition animation.h:33
@ ANIMOPTION_SKIP_INVISIBLE
Definition pane.h:39
Definition HBMAnmController.h:6
Definition lyt_types.h:125
Definition resources.h:174
Definition types.h:189
Definition types.h:103
Definition types.h:125
f32 y
Definition types.h:11
f32 x
Definition types.h:10
Definition Color.h:10