* m2d

---------

Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com>
This commit is contained in:
robojumper
2024-09-13 04:01:40 +02:00
committed by GitHub
parent 3d0adbc874
commit 5aa30927ff
9 changed files with 669 additions and 64 deletions
+31 -3
View File
@@ -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
+59 -1
View File
@@ -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