Files
ss/include/nw4r/g3d/g3d_anmvis.h
T
Elijah Thomas 9c3c480b24 g3d source (#123)
* g3d_calcvtx

GetData seems to have changed -> dwarf says r is a local and using ofs_to_ptr didnt work

* g3d_light and g3d_fog

sdata2 splits and func ordering

* g3d_scnproc

* g3d_init

* g3d_scnmdl

* g3d_scnmdlsmpl

* g3d_scnroot

* g3d_scnobj

* g3d_res* progress

* g3d_resmdl OK

* g3d_restev OK

* g3d_resmat OK

* g3d_resvtx and g3d_restex OK

* g3d_resnode OK

* g3d_resanm OK

* g3d_resanmchr Progress

* the rest of g3d_res* OK

* g3d_anmvis OK

* g3d_anmclr OK

* Some Splitting

* more OK, Inline Issue in g3d_anmtexsrt

* g3d_obj, g3d_anmobj, g3d_gpu, g3d_tmem, g3d_cpu OK

* g3d_state OK

* g3d/dcc OK

* Include fixup

* More Fixups

* g3d_camera OK

* g3d_draw OK

* g3d_calcworld OK

* g3d_calcworld actually OK

* g3d_workmem, g3d_dcc OK

* g3d_calcview OK

* g3d_anmtexsrt OK with DONT_INLINE

* g3d_transform OK (Feels Cheaty)

* g3d_resanmchr OK

* g3d_draw1mat1shp Close

* g3d_draw1mat1shp OK (Thanks Lago!). Ran symbol applying script
2025-03-16 11:26:15 -04:00

156 lines
4.6 KiB
C++

#ifndef NW4R_G3D_ANM_VIS_H
#define NW4R_G3D_ANM_VIS_H
#include <nw4r/types_nw4r.h>
#include "nw4r/g3d/g3d_anmobj.h"
#include "nw4r/g3d/res/g3d_resanmvis.h"
namespace nw4r {
namespace g3d {
void ApplyVisAnmResult(ResMdl mdl, AnmObjVis *pObj);
void ApplyVisAnmResult(u8 *pByteVec, ResMdl mdl, AnmObjVis *pObj);
/******************************************************************************
*
* AnmObjVis
*
******************************************************************************/
// Forward declarations
class AnmObjVisRes;
class AnmObjVis : public AnmObj {
public:
AnmObjVis(MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding);
virtual void G3dProc(u32 task, u32 param, void *pInfo); // at 0xC
virtual ~AnmObjVis() {} // at 0x10
virtual void SetFrame(f32 frame) = 0; // at 0x1C
virtual f32 GetFrame() const = 0; // at 0x20
virtual void UpdateFrame() = 0; // at 0x24
virtual void SetUpdateRate(f32 rate) = 0; // at 0x28
virtual f32 GetUpdateRate() const = 0; // at 0x2C
virtual bool Bind(const ResMdl mdl) = 0; // at 0x30
virtual void Release(); // at 0x34
virtual bool GetResult(u32 idx) = 0; // at 0x38
virtual AnmObjVisRes *Attach(int idx, AnmObjVisRes *pRes); // at 0x3C
virtual AnmObjVisRes *Detach(int idx); // at 0x40
void DetachAll();
bool TestExistence(u32 idx) const;
bool TestDefined(u32 idx) const;
protected:
enum BindingFlag {
BINDING_ID_MASK = (1 << 14) - 1,
BINDING_INVALID = (1 << 14),
BINDING_UNDEFINED = (1 << 15),
};
protected:
static const int MAX_CHILD = 4;
protected:
int mNumBinding; // at 0x10
u16 *const mpBinding; // at 0x14
NW4R_G3D_RTTI_DECL_DERIVED(AnmObjVis, AnmObj);
};
/******************************************************************************
*
* AnmObjVisNode
*
******************************************************************************/
class AnmObjVisNode : public AnmObjVis {
public:
AnmObjVisNode(MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding);
virtual void G3dProc(u32 task, u32 param, void *pInfo); // at 0xC
virtual ~AnmObjVisNode(); // at 0x10
virtual void SetFrame(f32 frame); // at 0x1C
virtual f32 GetFrame() const; // at 0x20
virtual void UpdateFrame(); // at 0x24
virtual void SetUpdateRate(f32 rate); // at 0x28
virtual f32 GetUpdateRate() const; // at 0x2C
virtual bool Bind(const ResMdl mdl); // at 0x30
virtual void Release(); // at 0x34
virtual bool GetResult(u32 idx) = 0; // at 0x38
virtual AnmObjVisRes *Attach(int idx, AnmObjVisRes *pRes); // at 0x3C
virtual AnmObjVisRes *Detach(int idx); // at 0x40
protected:
AnmObjVisRes *mpChildren[MAX_CHILD]; // at 0x18
NW4R_G3D_RTTI_DECL_DERIVED(AnmObjVisNode, AnmObjVis);
};
/******************************************************************************
*
* AnmObjVisOR
*
******************************************************************************/
class AnmObjVisOR : public AnmObjVisNode {
public:
static AnmObjVisOR *Construct(MEMAllocator *pAllocator, u32 *pSize, ResMdl mdl);
AnmObjVisOR(MEMAllocator *pAllocator, u16 *pBindingBuf, int numBinding)
: AnmObjVisNode(pAllocator, pBindingBuf, numBinding) {}
virtual ~AnmObjVisOR() {} // at 0x10
virtual bool GetResult(u32 idx); // at 0x38
NW4R_G3D_RTTI_DECL_DERIVED(AnmObjVisOR, AnmObjVisNode);
};
/******************************************************************************
*
* AnmObjVisRes
*
******************************************************************************/
class AnmObjVisRes : public AnmObjVis, protected FrameCtrl {
public:
static AnmObjVisRes *Construct(MEMAllocator *pAllocator, u32 *pSize, ResAnmVis vis, ResMdl mdl);
AnmObjVisRes(MEMAllocator *pAllocator, ResAnmVis vis, u16 *pBindingBuf, int numBinding);
virtual ~AnmObjVisRes() {} // at 0x10
virtual void SetFrame(f32 frame); // at 0x1C
virtual f32 GetFrame() const; // at 0x20
virtual void UpdateFrame(); // at 0x24
virtual void SetUpdateRate(f32 rate); // at 0x28
virtual f32 GetUpdateRate() const; // at 0x2C
virtual bool Bind(const ResMdl mdl); // at 0x30
virtual bool GetResult(u32 idx); // at 0x38
ResAnmVis GetResAnm() {
return mRes;
}
void SetPlayPolicy(PlayPolicyFunc pFunc) {
FrameCtrl::SetPlayPolicy(pFunc);
}
private:
ResAnmVis mRes; // at 0x2C
NW4R_G3D_RTTI_DECL_DERIVED(AnmObjVisRes, AnmObjVis);
};
} // namespace g3d
} // namespace nw4r
#endif