mirror of
https://github.com/zeldaret/ss
synced 2026-07-09 14:15:23 -04:00
m2d (#22)
* m2d --------- Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com>
This commit is contained in:
@@ -10,13 +10,41 @@ namespace EGG {
|
||||
class Frustum {
|
||||
public:
|
||||
enum CanvasMode {};
|
||||
enum ProjectionType {};
|
||||
enum ProjectionType { PROJ_ORTHO, PROJ_PERSP };
|
||||
|
||||
u8 TODO_0x00[0x38];
|
||||
private:
|
||||
/* 0x00 */ ProjectionType mProjType;
|
||||
/* 0x04 */ CanvasMode mCanvasMode;
|
||||
/* 0x08 */ nw4r::math::VEC2 mSize;
|
||||
/* 0x10 */ f32 mFovY;
|
||||
/* 0x14 */ f32 mTanFovY;
|
||||
/* 0x18 */ f32 mNearZ;
|
||||
/* 0x1C */ f32 mFarZ;
|
||||
/* 0x20 */ nw4r::math::VEC2 mOffset;
|
||||
/* 0x28 */ nw4r::math::VEC3 mScale;
|
||||
/* 0x34 */ mutable u16 mFlags;
|
||||
|
||||
public:
|
||||
// vt at 0x38
|
||||
virtual ~Frustum();
|
||||
virtual ~Frustum() {}
|
||||
virtual void SetProjectionGX() const;
|
||||
virtual void CopyToG3D(nw4r::g3d::Camera) const;
|
||||
|
||||
ProjectionType GetProjectionType() const {
|
||||
return mProjType;
|
||||
}
|
||||
void SetProjectionType(ProjectionType type) {
|
||||
mProjType = type;
|
||||
}
|
||||
|
||||
void ResetOrthographic(f32, f32, f32, f32, f32, f32);
|
||||
|
||||
void SetScale(const nw4r::math::VEC3 &scale) {
|
||||
mScale = scale;
|
||||
}
|
||||
void SetOffset(const nw4r::math::VEC2 &offset) {
|
||||
mOffset = offset;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
Screen();
|
||||
Screen(f32, f32, f32, f32, Screen *, CanvasMode);
|
||||
|
||||
virtual ~Screen();
|
||||
virtual ~Screen() {}
|
||||
virtual void SetProjectionGX() const override;
|
||||
virtual void CopyToG3D(nw4r::g3d::Camera) const override;
|
||||
|
||||
@@ -20,6 +20,64 @@ public:
|
||||
static void SetTVModeDefault();
|
||||
|
||||
u8 TODO_0x3C[0x88 - 0x3C];
|
||||
|
||||
enum TVMode { TV_MODE_1, TV_MODE_2, TV_MODE_3, TV_MODE_4, TV_MODE_MAX };
|
||||
|
||||
struct TVModeInfo {
|
||||
TVModeInfo() {}
|
||||
u16 width;
|
||||
u16 height;
|
||||
f32 w_ratio;
|
||||
f32 h_ratio;
|
||||
};
|
||||
|
||||
struct DataEfb {
|
||||
// Required for struct copy
|
||||
struct Viewport {
|
||||
f32 x1; // at 0x0
|
||||
f32 y1; // at 0x4
|
||||
f32 x2; // at 0x8
|
||||
f32 y2; // at 0xC
|
||||
f32 z1; // at 0x10
|
||||
f32 z2; // at 0x14
|
||||
} vp;
|
||||
|
||||
s32 sc_ox; // at 0x18
|
||||
s32 sc_oy; // at 0x1C
|
||||
};
|
||||
|
||||
static u16 GetSizeXMax(TVMode mode) {
|
||||
return sTVModeInfo[mode].width;
|
||||
}
|
||||
static u16 GetSizeYMax(TVMode mode) {
|
||||
return sTVModeInfo[mode].height;
|
||||
}
|
||||
static u16 GetSizeXMax() {
|
||||
return sTVModeInfo[sTVMode].width;
|
||||
}
|
||||
static u16 GetSizeYMax() {
|
||||
return sTVModeInfo[sTVMode].height;
|
||||
}
|
||||
|
||||
static inline f32 GetAdjustScale() {
|
||||
return (f32)sTVModeInfo[0].width / sTVModeInfo[Screen::sTVMode].width;
|
||||
}
|
||||
|
||||
static TVMode GetTVMode() {
|
||||
return sTVMode;
|
||||
}
|
||||
|
||||
static TVMode sTVMode;
|
||||
|
||||
static Screen *spRoot;
|
||||
|
||||
typedef void (*ChangeTVModeFunc)(void *);
|
||||
static ChangeTVModeFunc sChangeTVModeFunc;
|
||||
static void *spChangeTVModeFuncInfo;
|
||||
static TVModeInfo sTVModeInfo[Screen::TV_MODE_MAX];
|
||||
|
||||
static nw4r::math::VEC2 sCanvasScale;
|
||||
static nw4r::math::VEC2 sCanvasOffset;
|
||||
};
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
#ifndef M_M2D_H
|
||||
#define M_M2D_H
|
||||
|
||||
#include <m/m_allocator.h>
|
||||
#include <m/m_mtx.h>
|
||||
#include <m/m_vec.h>
|
||||
#include <nw4r/lyt/lyt_arcResourceAccessor.h>
|
||||
#include <nw4r/lyt/lyt_drawInfo.h>
|
||||
#include <nw4r/lyt/lyt_init.h>
|
||||
#include <nw4r/lyt/lyt_layout.h>
|
||||
#include <nw4r/ut/ut_LinkList.h>
|
||||
#include <nw4r/ut/ut_list.h>
|
||||
|
||||
namespace m2d {
|
||||
|
||||
extern nw4r::ut::List l_list;
|
||||
extern mAllocator_c *l_allocator;
|
||||
|
||||
class Layout_c : public nw4r::lyt::Layout {
|
||||
public:
|
||||
virtual ~Layout_c() {}
|
||||
virtual nw4r::lyt::AnimTransform *CreateAnimTransform(const void *animResBuf,
|
||||
nw4r::lyt::ResourceAccessor *pResAcsr) override;
|
||||
};
|
||||
|
||||
class ResAccIfBase_c {
|
||||
public:
|
||||
~ResAccIfBase_c();
|
||||
};
|
||||
|
||||
class ResAccIf_c : ResAccIfBase_c {
|
||||
public:
|
||||
virtual ~ResAccIf_c();
|
||||
virtual void noop();
|
||||
virtual nw4r::lyt::ArcResourceAccessor *getAccessor();
|
||||
|
||||
void attach(void *data, const char *name);
|
||||
void detach();
|
||||
|
||||
private:
|
||||
nw4r::lyt::ArcResourceAccessor mAccessor;
|
||||
};
|
||||
|
||||
#define FLAG_NO_LOOP 1
|
||||
#define FLAG_BACKWARDS 2
|
||||
|
||||
class FrameCtrl_c {
|
||||
public:
|
||||
virtual ~FrameCtrl_c();
|
||||
|
||||
void play();
|
||||
void set(f32 endFrame, u8 flags, f32 rate, f32 currFrame);
|
||||
void setFrame(f32 frame);
|
||||
void setRate(f32 rate);
|
||||
|
||||
bool isStop() const;
|
||||
bool isStop2() const;
|
||||
f32 getEndFrame() const;
|
||||
f32 getEndFrame2() const;
|
||||
|
||||
inline f32 getFrame() {
|
||||
return mCurrFrame;
|
||||
}
|
||||
|
||||
private:
|
||||
inline bool notLooping() const {
|
||||
return (mFlags & FLAG_NO_LOOP) != 0;
|
||||
}
|
||||
|
||||
inline bool isBackwards() const {
|
||||
return (mFlags & FLAG_BACKWARDS) != 0;
|
||||
}
|
||||
|
||||
f32 mEndFrame;
|
||||
f32 mCurrFrame;
|
||||
f32 mPrevFrame;
|
||||
f32 mRate;
|
||||
u8 mFlags;
|
||||
};
|
||||
|
||||
class Anm_c {
|
||||
public:
|
||||
virtual ~Anm_c();
|
||||
|
||||
bool doSomething(const char *path, ResAccIf_c *acc);
|
||||
void setTransform(nw4r::lyt::AnimTransform *transform);
|
||||
void destroySomething();
|
||||
void set(f32 endFrame, u8 flags, f32 rate, f32 currFrame);
|
||||
void setFrame(f32 frame);
|
||||
void play();
|
||||
|
||||
inline nw4r::lyt::AnimTransform *getTransform() {
|
||||
return mpTransform;
|
||||
}
|
||||
|
||||
inline void setBound() {
|
||||
mFlags |= 1;
|
||||
}
|
||||
|
||||
inline void setUnbound() {
|
||||
mFlags &= ~1;
|
||||
}
|
||||
|
||||
private:
|
||||
void updateFrame();
|
||||
nw4r::lyt::AnimTransform *mpTransform;
|
||||
FrameCtrl_c mFrameCtrl;
|
||||
|
||||
public:
|
||||
u8 mFlags;
|
||||
};
|
||||
|
||||
class Base_c {
|
||||
public:
|
||||
Base_c(u8 priority) : mPriority(priority) {}
|
||||
/* 0x00 */ nw4r::ut::Node mLink;
|
||||
/* vt 0x04 */
|
||||
virtual ~Base_c();
|
||||
virtual void draw();
|
||||
/* 0x0C */ u8 mPriority;
|
||||
|
||||
void addToDrawList();
|
||||
};
|
||||
|
||||
class Simple_c : public Base_c {
|
||||
public:
|
||||
Simple_c();
|
||||
virtual ~Simple_c();
|
||||
virtual void draw() override;
|
||||
virtual void calc();
|
||||
virtual bool build(const char *name, ResAccIf_c *acc);
|
||||
|
||||
void calcBefore();
|
||||
void calcAfter();
|
||||
|
||||
void bind(Anm_c *anm);
|
||||
void unbind(Anm_c *anm);
|
||||
|
||||
bool flagSet() {
|
||||
return (field_0x94 & 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
Layout_c mLayout;
|
||||
nw4r::lyt::DrawInfo mDrawInfo;
|
||||
ResAccIf_c *mpResAcc;
|
||||
mVec3_c mVec;
|
||||
u32 field_0x94;
|
||||
};
|
||||
|
||||
} // namespace m2d
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef NW4R_G3D_ANMFOG_H
|
||||
#define NW4R_G3D_ANMFOG_H
|
||||
#include "common.h"
|
||||
#include "ut_Color.h"
|
||||
#include <nw4r/ut/ut_Color.h>
|
||||
#include <rvl/GX.h>
|
||||
|
||||
namespace nw4r {
|
||||
|
||||
@@ -43,6 +43,14 @@ public:
|
||||
virtual void Animate(u32 option); // at 0x38
|
||||
virtual void SetTagProcessor(ut::TagProcessorBase<wchar_t> *pTagProcessor); // at 0x3C
|
||||
|
||||
ut::LinkList<AnimTransform, 4> &GetAnimTransformList() {
|
||||
return mAnimTransList;
|
||||
}
|
||||
|
||||
Pane *GetRootPane() const {
|
||||
return mpRootPane;
|
||||
}
|
||||
|
||||
private:
|
||||
ut::LinkList<AnimTransform, 4> mAnimTransList; // at 0x04
|
||||
Pane *mpRootPane; // at 0x10
|
||||
|
||||
Reference in New Issue
Block a user