diff options
| author | robojumper <robojumper@gmail.com> | 2024-09-12 22:36:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-12 16:36:34 -0400 |
| commit | 1180e1f4860d62bccd64bfa2a29eaeebd2c4b019 (patch) | |
| tree | ce6e231ef46aacbdad52ad7f6cbcd9d02dba555e /include/egg | |
| parent | e2c4bb7be7fa731a335bce4bc22283d899133e39 (diff) | |
m3d (#13)
* Initial M3d Pass
* `m_bmdl` and `m_bline` left
---------
Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com>
Co-authored-by: Elijah Thomas <42302100+elijah-thomas774@users.noreply.github.com>
Diffstat (limited to 'include/egg')
| -rw-r--r-- | include/egg/core/eggFrmHeap.h | 2 | ||||
| -rw-r--r-- | include/egg/core/eggHeap.h | 4 | ||||
| -rw-r--r-- | include/egg/core/eggSystem.h | 3 | ||||
| -rw-r--r-- | include/egg/gfx/eggDrawGX.h | 37 | ||||
| -rw-r--r-- | include/egg/gfx/eggFog.h | 28 | ||||
| -rw-r--r-- | include/egg/gfx/eggFrustum.h | 24 | ||||
| -rw-r--r-- | include/egg/gfx/eggGfxEngine.h | 30 | ||||
| -rw-r--r-- | include/egg/gfx/eggLight.h | 53 | ||||
| -rw-r--r-- | include/egg/gfx/eggScreen.h | 27 | ||||
| -rw-r--r-- | include/egg/gfx/eggStateGX.h | 45 | ||||
| -rw-r--r-- | include/egg/gfx/eggTexture.h | 11 | ||||
| -rw-r--r-- | include/egg/math/eggVector.h | 1 | ||||
| -rw-r--r-- | include/egg/prim/eggBinary.h | 23 |
13 files changed, 285 insertions, 3 deletions
diff --git a/include/egg/core/eggFrmHeap.h b/include/egg/core/eggFrmHeap.h index f68e8e4f..10757d7c 100644 --- a/include/egg/core/eggFrmHeap.h +++ b/include/egg/core/eggFrmHeap.h @@ -22,7 +22,7 @@ public: public: /* 80495fa0 */ FrmHeap(MEMiHeapHead *heapHead); /* 80496060 */ static FrmHeap *create(void *block, size_t size, u16 attr); - /* 804962a0 */ void free(u32 flags); + /* 804962a0 */ void free(s32 flags); /* 80496370 */ void recordState(u32 id); // non official for now /* 80496380 */ void freeState(u32 id); // non official for now }; diff --git a/include/egg/core/eggHeap.h b/include/egg/core/eggHeap.h index 548db726..e0730703 100644 --- a/include/egg/core/eggHeap.h +++ b/include/egg/core/eggHeap.h @@ -162,9 +162,9 @@ public: } // namespace EGG /* 80495a60 */ void *operator new(size_t, void *p); -/* 80495a70 */ void *operator new(size_t size, EGG::Heap *heap, int align); +/* 80495a70 */ void *operator new(size_t size, EGG::Heap *heap, int align = 4); /* 80495a80 */ void *operator new(size_t size, EGG::Allocator *alloc); /* 80495a90 */ void *operator new[](size_t size, int align); -/* 80495aa0 */ void *operator new[](size_t size, EGG::Heap *heap, int align); +/* 80495aa0 */ void *operator new[](size_t size, EGG::Heap *heap, int align = 4); #endif diff --git a/include/egg/core/eggSystem.h b/include/egg/core/eggSystem.h index e124b306..9fe8e9db 100644 --- a/include/egg/core/eggSystem.h +++ b/include/egg/core/eggSystem.h @@ -57,6 +57,9 @@ public: } }; +template <class TVideo, class TDisplay, class TXfbManager, class TAudioManager, class TSceneManager, class TPerfView> +class TSystem : ConfigurationData {}; + } // namespace EGG #endif diff --git a/include/egg/gfx/eggDrawGX.h b/include/egg/gfx/eggDrawGX.h new file mode 100644 index 00000000..91ce5fc8 --- /dev/null +++ b/include/egg/gfx/eggDrawGX.h @@ -0,0 +1,37 @@ +#ifndef EGG_DRAWGX_H +#define EGG_DRAWGX_H + +#include <common.h> +#include <egg/core/eggHeap.h> +#include <egg/gfx/eggTexture.h> +#include <egg/math/eggMatrix.h> +#include <rvl/GX.h> + + +namespace EGG { + +class DrawGX { +public: + static void Initialize(Heap *); + + static GXTexMapID GetTexMapDefault(); + static void LoadTexture(const EGG::ResTIMG *, GXTexMapID); + + // TODO MORE + + /* static ?? s_DL */ + + static Matrix34f s_cameraMtx; + + /* static ?? s_flag */ + + static GXColor BLACK; + static GXColor WHITE; + static GXColor GREEN; + static GXColor RED; + static GXColor BLUE; +}; + +} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggFog.h b/include/egg/gfx/eggFog.h new file mode 100644 index 00000000..d9318066 --- /dev/null +++ b/include/egg/gfx/eggFog.h @@ -0,0 +1,28 @@ +#ifndef EGG_FOG_H +#define EGG_FOG_H + +#include <egg/prim/eggBinary.h> +#include <nw4r/types_nw4r.h> + +namespace EGG { + +// TODO: Add members +class FogManager : IBinary<FogManager> { +public: + FogManager(u16); + virtual ~FogManager(); + virtual void SetBinaryInner(Bin &) override; + virtual void GetBinaryInner(Bin *) const override; + virtual size_t GetBinarySize() override; + virtual void SetBinaryInner(const Bin &, const Bin &, f32) override; + + void Calc(); + void CopyToG3D(nw4r::g3d::ScnRoot *) const; + + /* 0x04 */ u8 mFlag; + /* 0x05 */ u8 TODO[0x10 - 0x05]; +}; + +} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggFrustum.h b/include/egg/gfx/eggFrustum.h new file mode 100644 index 00000000..770dd328 --- /dev/null +++ b/include/egg/gfx/eggFrustum.h @@ -0,0 +1,24 @@ +#ifndef EGG_FRUSTUM_H +#define EGG_FRUSTUM_H + +#include <common.h> +#include <nw4r/g3d/g3d_camera.h> + +namespace EGG { + +// TODO: Fill out more +class Frustum { +public: + enum CanvasMode {}; + enum ProjectionType {}; + + u8 TODO_0x00[0x38]; + // vt at 0x38 + virtual ~Frustum(); + virtual void SetProjectionGX() const; + virtual void CopyToG3D(nw4r::g3d::Camera) const; +}; + +} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggGfxEngine.h b/include/egg/gfx/eggGfxEngine.h new file mode 100644 index 00000000..8844587a --- /dev/null +++ b/include/egg/gfx/eggGfxEngine.h @@ -0,0 +1,30 @@ +#ifndef EGG_GFXENGINE_H +#define EGG_GFXENGINE_H + +#include <common.h> +#include <rvl/GX.h> + +namespace EGG { + +namespace GfxEngine { + +struct Configuration { + /* 0x00 */ u16 efbWidth; + /* 0x02 */ u16 efbHeight; + /* 0x04 */ GXColor clearColor; + /* 0x08 */ u32 field_0x08; + /* 0x0C */ u16 field_0x0C; + /* 0x0E */ u16 field_0x0E; + /* 0x10 */ u32 bufferSize; + /* 0x14 */ u16 field_0x14; + /* 0x16 */ u16 field_0x16; + /* 0x18 */ u8 UNK_0x18[4]; + Configuration(); + virtual ~Configuration() {} +}; + +} // namespace GfxEngine + +} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggLight.h b/include/egg/gfx/eggLight.h new file mode 100644 index 00000000..073705a7 --- /dev/null +++ b/include/egg/gfx/eggLight.h @@ -0,0 +1,53 @@ +#ifndef EGG_LIGHT_H +#define EGG_LIGHT_H + +#include <egg/prim/eggBinary.h> +#include <nw4r/types_nw4r.h> + +namespace EGG { + +// TODO: Fill out more +class LightTexture { +public: + static void initialize(u16 textureSize, Heap *pHeap); +}; + +// TODO: Fill out more +class LightTextureManager : public IBinary<LightTextureManager> { +public: + virtual ~LightTextureManager(); + virtual void SetBinaryInner(Bin &) override; + virtual void GetBinaryInner(Bin *) const override; + virtual size_t GetBinarySize() override; + virtual void SetBinaryInner(const Bin &, const Bin &, f32) override; + + void drawAndCaptureTexture(f32, f32, f32, f32); +}; + +// TODO: Fill out more +class LightManager : public IBinary<LightManager> { +public: + // vt at 0x00 + LightManager(u32, u32, u8); + virtual ~LightManager(); + virtual void SetBinaryInner(Bin &) override; + virtual void GetBinaryInner(Bin *) const override; + virtual size_t GetBinarySize() override; + virtual void SetBinaryInner(const Bin &, const Bin &, f32) override; + virtual void Reset(); + virtual void Calc(nw4r::g3d::ScnRoot *); + virtual void CalcView(const nw4r::math::MTX34 &, u8, nw4r::g3d::ScnRoot *); + virtual void DoneDraw(); + + LightTextureManager *GetTextureMgr() const { + return mTextureMgr; + } + + u8 TODO_0x04[0x14 - 0x04]; + LightTextureManager *mTextureMgr; + u8 TODO_0x18[0x28 - 0x18]; +}; + +} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggScreen.h b/include/egg/gfx/eggScreen.h new file mode 100644 index 00000000..b1b1c422 --- /dev/null +++ b/include/egg/gfx/eggScreen.h @@ -0,0 +1,27 @@ +#ifndef EGG_SCREEN_H +#define EGG_SCREEN_H + +#include <common.h> +#include <egg/gfx/eggFrustum.h> + +namespace EGG { + +// TODO: Fill out more +class Screen : public Frustum { +public: + Screen(); + Screen(f32, f32, f32, f32, Screen *, CanvasMode); + + virtual ~Screen(); + virtual void SetProjectionGX() const override; + virtual void CopyToG3D(nw4r::g3d::Camera) const override; + + static void Initialize(const u16 *, const u16 *, Screen *); + static void SetTVModeDefault(); + + u8 TODO_0x3C[0x88 - 0x3C]; +}; + +} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggStateGX.h b/include/egg/gfx/eggStateGX.h new file mode 100644 index 00000000..5d2badb6 --- /dev/null +++ b/include/egg/gfx/eggStateGX.h @@ -0,0 +1,45 @@ +#ifndef EGG_STATE_GX_H +#define EGG_STATE_GX_H + +#include <common.h> +#include <rvl/GX.h> + +namespace EGG { + +class StateGX { +public: + static void initialize(u16, u16, GXColor, GXPixelFmt); + static void frameInit(); + static void textureInit(); // Guess for 804b4810 + + static void resetGX(); + static void resetVtx(); + static void resetColorChannel(); + static void resetIndirect(); + static void resetTexture(); + static void resetTexGen(); + static void resetTev(); + static void resetPE(); + + static void resetGXCache(); + + static void GXSetPixelFmt(GXPixelFmt pixelFmt, GXZFmt16 zFmt); + + static void invalidateTexAllGX(); + + static bool GXSetColorUpdate(bool); + static bool GXSetAlphaUpdate(bool); + static bool GXSetDither(); + static void GXCopyTex(); + static bool GXSetDstAlpha(); + // Unk func here + static void GXSetProjection(Mtx44, int); + static void GXSetProjectionv(const f32 *); + static void GXSetViewport(f32, f32, f32, f32, f32, f32); + static void GZSetScissor(u32, u32, u32, u32); + static void GZSetScissorBoxOffset(s32, s32); +}; + +} // namespace EGG + +#endif diff --git a/include/egg/gfx/eggTexture.h b/include/egg/gfx/eggTexture.h new file mode 100644 index 00000000..dcf0e926 --- /dev/null +++ b/include/egg/gfx/eggTexture.h @@ -0,0 +1,11 @@ +#ifndef EGG_TEXTURE_H +#define EGG_TEXTURE_H + +namespace EGG { + +// TODO: Implement Members +struct ResTIMG {}; + +} // namespace EGG + +#endif diff --git a/include/egg/math/eggVector.h b/include/egg/math/eggVector.h index 9aa50ae8..43d340dd 100644 --- a/include/egg/math/eggVector.h +++ b/include/egg/math/eggVector.h @@ -127,6 +127,7 @@ struct Vector3s { s16 x, y, z; public: + Vector3s() {} Vector3s(s16 sx, s16 sy, s16 sz) { x = sx; y = sy; diff --git a/include/egg/prim/eggBinary.h b/include/egg/prim/eggBinary.h new file mode 100644 index 00000000..6f127955 --- /dev/null +++ b/include/egg/prim/eggBinary.h @@ -0,0 +1,23 @@ +#ifndef EGG_BINARY_H +#define EGG_BINARY_H + +template <class T> +class IBinary { +public: + class Bin {}; + virtual void SetBinaryInner(Bin &) = 0; + virtual void GetBinaryInner(Bin *) const = 0; + virtual size_t GetBinarySize() = 0; + virtual void SetBinaryInner(const Bin &, const Bin &, f32) = 0; + + static const char *GetBinaryType(); + int GetVersion(); + + void GetBinary(void *) const; + + void SetBinary(const void *); + + void SetBinaryBlend(const void *, const void *, f32); +}; + +#endif |
