Files
tp/include/JSystem/J3DGraphBase/J3DPacket.h
T

168 lines
4.4 KiB
C++
Raw Normal View History

2021-03-28 22:49:05 +02:00
#ifndef J3DPACKET_H
#define J3DPACKET_H
2021-05-10 08:54:07 -07:00
#include "JSystem/J3DGraphBase/J3DSys.h"
2021-10-11 09:38:53 -07:00
#include "dolphin/gd/GDBase.h"
2021-05-10 08:54:07 -07:00
#include "dolphin/mtx/mtx.h"
2021-03-28 22:49:05 +02:00
#include "dolphin/types.h"
2021-05-10 08:54:07 -07:00
class J3DMatPacket;
class J3DDrawBuffer;
class J3DMaterial;
class J3DMaterialAnm;
class J3DModel;
class J3DMtxBuffer;
class J3DShape;
class J3DTexMtx;
class J3DTexture;
class J3DDisplayListObj {
public:
2021-10-11 09:38:53 -07:00
J3DDisplayListObj() {
mpData[0] = NULL;
mpData[1] = NULL;
mSize = 0;
mCapacity = 0;
}
2021-05-10 08:54:07 -07:00
J3DError newDisplayList(u32);
J3DError newSingleDisplayList(u32);
J3DError single_To_Double();
void setSingleDisplayList(void*, u32);
void swapBuffer();
void callDL() const;
void beginDL();
2021-10-11 09:38:53 -07:00
u32 endDL();
2021-05-10 08:54:07 -07:00
void beginPatch();
2021-10-11 09:38:53 -07:00
u32 endPatch();
2021-05-10 08:54:07 -07:00
2021-10-11 09:38:53 -07:00
u8* getDisplayList(int idx) const { return (u8*)mpData[idx]; }
u32 getDisplayListSize() const { return mSize; }
2021-05-10 08:54:07 -07:00
2021-10-11 09:38:53 -07:00
static GDLObj sGDLObj;
static s32 sInterruptFlag;
/* 0x0 */ void* mpData[2];
/* 0x8 */ u32 mSize;
/* 0xC */ u32 mCapacity;
}; // Size: 0x10
2021-05-10 08:54:07 -07:00
class J3DPacket {
public:
J3DPacket() {
2022-10-04 21:17:53 -07:00
mpNextPacket = NULL;
mpFirstChild = NULL;
mpUserData = NULL;
}
2021-10-11 09:38:53 -07:00
void addChildPacket(J3DPacket*);
2022-10-04 17:29:53 -07:00
2022-10-04 21:17:53 -07:00
J3DPacket* getNextPacket() const { return mpNextPacket; }
void setNextPacket(J3DPacket* i_packet) { mpNextPacket = i_packet; }
2021-05-10 08:54:07 -07:00
2022-10-04 17:29:53 -07:00
void drawClear() {
2022-10-04 21:17:53 -07:00
mpNextPacket = NULL;
2021-05-10 08:54:07 -07:00
mpFirstChild = NULL;
}
2022-06-01 03:49:32 -07:00
void setUserArea(u32 area) { mpUserData = (void*)area; }
2022-10-04 21:17:53 -07:00
virtual int entry(J3DDrawBuffer*);
2021-05-10 08:54:07 -07:00
virtual void draw();
2022-01-25 12:24:14 -08:00
virtual ~J3DPacket() {}
2021-05-10 08:54:07 -07:00
public:
2022-10-04 21:17:53 -07:00
/* 0x04 */ J3DPacket* mpNextPacket;
/* 0x08 */ J3DPacket* mpFirstChild;
/* 0x0C */ void* mpUserData;
2021-10-11 09:38:53 -07:00
}; // Size: 0x10
2021-05-10 08:54:07 -07:00
class J3DDrawPacket : public J3DPacket {
public:
J3DDrawPacket();
~J3DDrawPacket();
J3DError newDisplayList(u32);
J3DError newSingleDisplayList(u32);
virtual void draw();
2021-12-06 06:51:53 -05:00
J3DDisplayListObj* getDisplayListObj() const { return mpDisplayListObj; }
2021-10-11 09:38:53 -07:00
void setDisplayListObj(J3DDisplayListObj* pObj) { mpDisplayListObj = pObj; }
2021-12-06 06:51:53 -05:00
void callDL() const { getDisplayListObj()->callDL(); }
enum {
LOCKED = 0x01,
};
bool checkFlag(u32 flag) const { return (mFlags & flag) != 0; }
void onFlag(u32 flag) { mFlags |= flag; }
void offFlag(u32 flag) { mFlags &= ~flag; }
void lock() { onFlag(LOCKED); }
void unlock() { offFlag(LOCKED); }
J3DTexMtx* getTexMtxObj() const { return mpTexMtx; }
2021-05-10 08:54:07 -07:00
public:
2021-10-11 09:38:53 -07:00
/* 0x10 */ u32 mFlags;
/* 0x14 */ char mPad0[0x0C]; // unk
/* 0x20 */ J3DDisplayListObj* mpDisplayListObj;
/* 0x24 */ J3DTexMtx* mpTexMtx;
}; // Size: 0x28
2021-05-10 08:54:07 -07:00
class J3DShapePacket : public J3DDrawPacket {
public:
J3DShapePacket();
2021-10-11 09:38:53 -07:00
u32 calcDifferedBufferSize(u32);
J3DError newDifferedDisplayList(u32);
2021-05-10 08:54:07 -07:00
void prepareDraw() const;
void drawFast();
virtual ~J3DShapePacket();
virtual void draw();
2021-10-11 09:38:53 -07:00
void setShape(J3DShape* pShape) { mpShape = pShape; }
void setModel(J3DModel* pModel) { mpModel = pModel; }
2021-12-06 06:51:53 -05:00
void setMtxBuffer(J3DMtxBuffer* pMtxBuffer) { mpMtxBuffer = pMtxBuffer; }
void setBaseMtxPtr(Mtx* pMtx) { mpBaseMtxPtr = pMtx; }
J3DShape* getShape() const { return mpShape; }
J3DModel* getModel() const { return mpModel; }
2022-04-23 20:06:43 -07:00
Mtx* getBaseMtxPtr() const { return mpBaseMtxPtr; }
2021-10-11 09:38:53 -07:00
2021-05-10 08:54:07 -07:00
public:
2021-10-11 09:38:53 -07:00
/* 0x28 */ J3DShape* mpShape;
/* 0x2C */ J3DMtxBuffer* mpMtxBuffer;
2021-12-06 06:51:53 -05:00
/* 0x30 */ Mtx* mpBaseMtxPtr;
2021-10-11 09:38:53 -07:00
/* 0x34 */ u32 mDiffFlag;
/* 0x38 */ J3DModel* mpModel;
}; // Size: 0x3C
2021-05-10 08:54:07 -07:00
class J3DMatPacket : public J3DDrawPacket {
public:
J3DMatPacket();
void addShapePacket(J3DShapePacket*);
void beginDiff();
void endDiff();
2021-10-11 09:38:53 -07:00
bool isSame(J3DMatPacket*) const;
2021-05-10 08:54:07 -07:00
2022-10-04 21:17:53 -07:00
J3DMaterial* getMaterial() const { return mpMaterial; }
2021-12-06 06:51:53 -05:00
J3DShapePacket* getShapePacket() const { return mpShapePacket; }
void setShapePacket(J3DShapePacket* packet) { mpShapePacket = packet; }
void setInitShapePacket(J3DShapePacket* packet) { mpInitShapePacket = packet; }
2022-10-04 21:17:53 -07:00
bool isChanged() const { return mDiffFlag < 0; }
2021-12-06 06:51:53 -05:00
2021-05-10 08:54:07 -07:00
virtual ~J3DMatPacket();
2022-10-04 21:17:53 -07:00
virtual int entry(J3DDrawBuffer*);
2021-05-10 08:54:07 -07:00
virtual void draw();
public:
2021-12-06 06:51:53 -05:00
/* 0x28 */ J3DShapePacket* mpInitShapePacket;
/* 0x2C */ J3DShapePacket* mpShapePacket;
2021-10-11 09:38:53 -07:00
/* 0x30 */ J3DMaterial* mpMaterial;
2022-10-04 21:17:53 -07:00
/* 0x34 */ u32 mDiffFlag;
2021-10-11 09:38:53 -07:00
/* 0x38 */ J3DTexture* mpTexture;
/* 0x3C */ J3DMaterialAnm* mpMaterialAnm;
}; // Size: 0x40
2021-05-10 08:54:07 -07:00
2021-03-28 22:49:05 +02:00
#endif /* J3DPACKET_H */