mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-31 15:57:37 -04:00
d_a_Obj_Gryw00 nonmatching start
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
#ifndef J3DDRAWBUFFER_H
|
||||
#define J3DDRAWBUFFER_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
// matches debug
|
||||
inline f32 J3DCalcZValue(register MtxP m, register Vec v) {
|
||||
register f32 temp_f4;
|
||||
register f32 out;
|
||||
register f32 temp_f0;
|
||||
register f32 temp_f2;
|
||||
register f32 temp_f1 = 1.0f;
|
||||
|
||||
// clang-format off
|
||||
asm {
|
||||
psq_l temp_f0, 0(v), 0, 0 /* qr0 */
|
||||
lfs temp_f2, 8(v)
|
||||
psq_l temp_f4, 32(m), 0, 0 /* qr0 */
|
||||
psq_l out, 40(m), 0, 0 /* qr0 */
|
||||
ps_merge00 temp_f2, temp_f2, temp_f1
|
||||
ps_mul temp_f4, temp_f0, temp_f4
|
||||
ps_madd out, temp_f2, out, temp_f4
|
||||
ps_sum0 out, out, out, out
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
class J3DDrawBuffer;
|
||||
class J3DPacket;
|
||||
class J3DDrawPacket;
|
||||
class J3DMatPacket;
|
||||
class J3DShapePacket;
|
||||
|
||||
typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*);
|
||||
typedef void (J3DDrawBuffer::*drawFunc)() const;
|
||||
|
||||
class J3DDrawBuffer {
|
||||
public:
|
||||
enum EDrawType {
|
||||
DRAW_HEAD,
|
||||
DRAW_TAIL,
|
||||
};
|
||||
|
||||
enum ESortType {
|
||||
SORT_MAT,
|
||||
SORT_MAT_ANM,
|
||||
SORT_Z,
|
||||
SORT_MODEL,
|
||||
SORT_INVALID,
|
||||
SORT_NON,
|
||||
};
|
||||
|
||||
J3DDrawBuffer() { initialize(); }
|
||||
~J3DDrawBuffer();
|
||||
void initialize();
|
||||
J3DError allocBuffer(u32);
|
||||
void frameInit();
|
||||
int entryMatSort(J3DMatPacket*);
|
||||
int entryMatAnmSort(J3DMatPacket*);
|
||||
int entryZSort(J3DMatPacket*);
|
||||
int entryModelSort(J3DMatPacket*);
|
||||
int entryInvalidSort(J3DMatPacket*);
|
||||
int entryNonSort(J3DMatPacket*);
|
||||
int entryImm(J3DPacket* pPacket, u16 index);
|
||||
void draw() const;
|
||||
void drawHead() const;
|
||||
void drawTail() const;
|
||||
|
||||
u32 getEntryTableSize() { return mBufSize; }
|
||||
|
||||
inline void calcZRatio();
|
||||
void setNonSort() { mSortType = 5; }
|
||||
void setZSort() { mSortType = 2; }
|
||||
void setZMtx(MtxP mtx) { mpZMtx = mtx; }
|
||||
|
||||
public:
|
||||
/* 0x00 */ J3DPacket** mpBuf;
|
||||
/* 0x04 */ u32 mBufSize;
|
||||
/* 0x08 */ u32 mDrawType;
|
||||
/* 0x0C */ u32 mSortType;
|
||||
/* 0x10 */ f32 mZNear;
|
||||
/* 0x14 */ f32 mZFar;
|
||||
/* 0x18 */ f32 mZRatio;
|
||||
/* 0x1C */ MtxP mpZMtx;
|
||||
/* 0x20 */ J3DPacket* mpCallBackPacket;
|
||||
|
||||
static sortFunc sortFuncTable[6];
|
||||
static drawFunc drawFuncTable[2];
|
||||
static int entryNum;
|
||||
};
|
||||
|
||||
#endif /* J3DDRAWBUFFER_H */
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef J3DGD_H
|
||||
#define J3DGD_H
|
||||
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/gd/GDBase.h"
|
||||
|
||||
inline void J3DGDWrite_u8(u8 param) {
|
||||
__GDWrite(param);
|
||||
}
|
||||
|
||||
inline void J3DGDWrite_u16(u16 param) {
|
||||
__GDWrite((param & 0xffff) >> 8);
|
||||
__GDWrite(param & 0xff);
|
||||
}
|
||||
|
||||
inline void J3DGDWrite_u32(u32 param) {
|
||||
__GDWrite((param >> 24) & 0xff);
|
||||
__GDWrite((param >> 16) & 0xff);
|
||||
__GDWrite((param >> 8) & 0xff);
|
||||
__GDWrite(param & 0xff);
|
||||
}
|
||||
|
||||
inline void J3DGDWriteXFCmd(u16 param_1, u32 param_2) {
|
||||
J3DGDWrite_u8(0x10);
|
||||
J3DGDWrite_u16(0);
|
||||
J3DGDWrite_u16(param_1);
|
||||
J3DGDWrite_u32(param_2);
|
||||
}
|
||||
|
||||
void J3DGDSetGenMode(u8 texGenNum, u8 colorChanNum, u8 tevStageNum, u8 IndTexStageNum, _GXCullMode cullMode);
|
||||
void J3DGDSetGenMode_3Param(u8 texGenNum, u8 tevStageNum, u8 indTexStageNum);
|
||||
|
||||
static inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
|
||||
GFX_FIFO(u8) = cmd;
|
||||
GFX_FIFO(u16) = indx;
|
||||
GFX_FIFO(u16) = addr;
|
||||
}
|
||||
|
||||
inline void J3DGDSetNumChans(u8 numChans) {
|
||||
J3DGDWriteXFCmd(0x1009, numChans);
|
||||
}
|
||||
|
||||
inline void J3DGDSetNumTexGens(u8 numTexGens) {
|
||||
J3DGDWriteXFCmd(0x103f, numTexGens);
|
||||
}
|
||||
|
||||
#endif /* J3DGD_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
#ifndef J3DMATERIAL_H
|
||||
#define J3DMATERIAL_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/J3DGraphBase/J3DPacket.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class J3DJoint;
|
||||
class J3DMaterialAnm;
|
||||
|
||||
class J3DMaterial {
|
||||
public:
|
||||
/* 803157A0 */ static J3DColorBlock* createColorBlock(u32);
|
||||
/* 803159A0 */ static J3DTexGenBlock* createTexGenBlock(u32);
|
||||
/* 80315B04 */ static J3DTevBlock* createTevBlock(int);
|
||||
/* 80315E78 */ static J3DIndBlock* createIndBlock(int);
|
||||
/* 80315F60 */ static J3DPEBlock* createPEBlock(u32, u32);
|
||||
/* 80316100 */ static u32 calcSizeColorBlock(u32);
|
||||
/* 80316150 */ static u32 calcSizeTexGenBlock(u32);
|
||||
/* 8031617C */ static u32 calcSizeTevBlock(int);
|
||||
/* 803161C4 */ static u32 calcSizeIndBlock(int);
|
||||
/* 803161D8 */ static u32 calcSizePEBlock(u32, u32);
|
||||
/* 80316240 */ void initialize();
|
||||
/* 80316290 */ u32 countDLSize();
|
||||
/* 80316344 */ void makeDisplayList_private(J3DDisplayListObj*);
|
||||
/* 80316AB0 */ void setCurrentMtx();
|
||||
/* 80316AC8 */ void calcCurrentMtx();
|
||||
/* 80316D68 */ void copy(J3DMaterial*);
|
||||
/* 80316E90 */ s32 newSharedDisplayList(u32);
|
||||
/* 80316F24 */ s32 newSingleSharedDisplayList(u32);
|
||||
|
||||
/* 803169DC */ virtual void calc(f32 const (*)[4]);
|
||||
/* 80316A54 */ virtual void calcDiffTexMtx(f32 const (*)[4]);
|
||||
/* 80316620 */ virtual void makeDisplayList();
|
||||
/* 80316668 */ virtual void makeSharedDisplayList();
|
||||
/* 8031668C */ virtual void load();
|
||||
/* 803166DC */ virtual void loadSharedDL();
|
||||
/* 80316740 */ virtual void patch();
|
||||
/* 803167D8 */ virtual void diff(u32);
|
||||
/* 80316E14 */ virtual void reset();
|
||||
/* 80316E70 */ virtual void change();
|
||||
|
||||
J3DMaterial* getNext() const { return mNext; }
|
||||
J3DShape* getShape() const { return mShape; }
|
||||
J3DTevBlock* getTevBlock() const { return mTevBlock; }
|
||||
J3DColorBlock* getColorBlock() const { return mColorBlock; }
|
||||
J3DTexGenBlock* getTexGenBlock() const { return mTexGenBlock; }
|
||||
J3DDisplayListObj* getSharedDisplayListObj() const { return mSharedDLObj; }
|
||||
J3DIndBlock* getIndBlock() const { return mIndBlock; }
|
||||
J3DShape* getShape() { return mShape; }
|
||||
J3DJoint* getJoint() { return mJoint; }
|
||||
J3DMaterialAnm* getMaterialAnm() const {
|
||||
if ((u32)mMaterialAnm < 0xC0000000) {
|
||||
return mMaterialAnm;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
J3DNBTScale* getNBTScale() const { return mTexGenBlock->getNBTScale(); }
|
||||
u16 getTexNo(u32 idx) const { return mTevBlock->getTexNo(idx); }
|
||||
GXColor* getTevKColor(u32 param_0) { return mTevBlock->getTevKColor(param_0); }
|
||||
GXColorS10* getTevColor(u32 param_0) { return mTevBlock->getTevColor(param_0); }
|
||||
J3DFog* getFog() { return mPEBlock->getFog(); }
|
||||
J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); }
|
||||
u16 getIndex() { return mIndex; }
|
||||
bool isDrawModeOpaTexEdge() { return (mMaterialMode & 3) == 0; }
|
||||
J3DPEBlock* getPEBlock() { return mPEBlock; }
|
||||
void onInvalid() { mInvalid = 1; }
|
||||
u32 getTexGenNum() const { return mTexGenBlock->getTexGenNum(); }
|
||||
u8 getTevStageNum() const { return mTevBlock->getTevStageNum(); }
|
||||
|
||||
void setTevColor(u32 i, const J3DGXColorS10* i_color) { mTevBlock->setTevColor(i, i_color); }
|
||||
void setTevKColor(u32 i, const J3DGXColor* i_color) { mTevBlock->setTevKColor(i, i_color); }
|
||||
void setMaterialAnm(J3DMaterialAnm* i_anm) { mMaterialAnm = i_anm; }
|
||||
void setCullMode(u8 i_mode) { mColorBlock->setCullMode(i_mode); }
|
||||
|
||||
public:
|
||||
/* 0x04 */ J3DMaterial* mNext;
|
||||
/* 0x08 */ J3DShape* mShape;
|
||||
/* 0x0C */ J3DJoint* mJoint;
|
||||
/* 0x10 */ u32 mMaterialMode;
|
||||
/* 0x14 */ u16 mIndex;
|
||||
/* 0x18 */ u32 mInvalid;
|
||||
/* 0x1C */ u32 field_0x1c;
|
||||
/* 0x20 */ u32 mDiffFlag;
|
||||
/* 0x24 */ J3DColorBlock* mColorBlock;
|
||||
/* 0x28 */ J3DTexGenBlock* mTexGenBlock;
|
||||
/* 0x2C */ J3DTevBlock* mTevBlock;
|
||||
/* 0x30 */ J3DIndBlock* mIndBlock;
|
||||
/* 0x34 */ J3DPEBlock* mPEBlock;
|
||||
/* 0x38 */ J3DMaterial* mpOrigMaterial;
|
||||
/* 0x3C */ J3DMaterialAnm* mMaterialAnm;
|
||||
/* 0x40 */ J3DCurrentMtx mCurrentMtx;
|
||||
/* 0x48 */ J3DDisplayListObj* mSharedDLObj;
|
||||
};
|
||||
|
||||
class J3DPatchedMaterial : public J3DMaterial {
|
||||
public:
|
||||
/* 80316FB8 */ void initialize();
|
||||
|
||||
/* 80316FD8 */ virtual void makeDisplayList();
|
||||
/* 80316FDC */ virtual void makeSharedDisplayList();
|
||||
/* 80316FE0 */ virtual void load();
|
||||
/* 80316FFC */ virtual void loadSharedDL();
|
||||
/* 8031703C */ virtual void reset();
|
||||
/* 80317040 */ virtual void change();
|
||||
};
|
||||
|
||||
class J3DLockedMaterial : public J3DMaterial {
|
||||
public:
|
||||
/* 80317044 */ void initialize();
|
||||
|
||||
/* 803170D0 */ virtual void calc(f32 const (*)[4]);
|
||||
/* 80317064 */ virtual void makeDisplayList();
|
||||
/* 80317068 */ virtual void makeSharedDisplayList();
|
||||
/* 8031706C */ virtual void load();
|
||||
/* 80317088 */ virtual void loadSharedDL();
|
||||
/* 803170C8 */ virtual void patch();
|
||||
/* 803170CC */ virtual void diff(u32);
|
||||
/* 803170D4 */ virtual void reset();
|
||||
/* 803170D8 */ virtual void change();
|
||||
};
|
||||
|
||||
#endif /* J3DMATERIAL_H */
|
||||
@@ -0,0 +1,215 @@
|
||||
#ifndef J3DPACKET_H
|
||||
#define J3DPACKET_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "dolphin/gd/GDBase.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class J3DMatPacket;
|
||||
|
||||
class J3DDrawBuffer;
|
||||
class J3DMaterial;
|
||||
class J3DMaterialAnm;
|
||||
class J3DModel;
|
||||
class J3DMtxBuffer;
|
||||
class J3DShape;
|
||||
class J3DTexMtx;
|
||||
class J3DTexMtxObj;
|
||||
class J3DTexture;
|
||||
|
||||
inline u32 getDiffFlag_LightObjNum(u32 param_1) {
|
||||
return (param_1 & 0xf0) >> 4;
|
||||
}
|
||||
|
||||
inline u32 getDiffFlag_TexGenNum(u32 param_1) {
|
||||
return (param_1 & 0xf00) >> 8;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TexMtxSize(int param_1) {
|
||||
return param_1 * 0x35;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TexGenSize(int param_1) {
|
||||
return param_1 * 0x3d + 10;
|
||||
}
|
||||
|
||||
inline u32 getDiffFlag_TexNoNum(u32 param_1) {
|
||||
return (param_1 & 0xf0000) >> 0x10;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TexNoSize(int param_1) {
|
||||
return param_1 * 0x37;
|
||||
}
|
||||
|
||||
inline u32 calcDifferedBufferSize_TexNoAndTexCoordScaleSize(u32 param_1) {
|
||||
u32 res = param_1 * 0x37;
|
||||
res += ((param_1 + 1) >> 1) * 0x37;
|
||||
return res;
|
||||
}
|
||||
|
||||
inline u32 getDiffFlag_TevStageNum(u32 param_1) {
|
||||
return (param_1 & 0xf00000) >> 0x14;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TevStageSize(int param_1) {
|
||||
return param_1 * 10;
|
||||
}
|
||||
|
||||
inline int calcDifferedBufferSize_TevStageDirectSize(int param_1) {
|
||||
return param_1 * 5;
|
||||
}
|
||||
|
||||
class J3DDisplayListObj {
|
||||
public:
|
||||
J3DDisplayListObj() {
|
||||
mpData[0] = NULL;
|
||||
mpData[1] = NULL;
|
||||
mSize = 0;
|
||||
mCapacity = 0;
|
||||
}
|
||||
|
||||
J3DError newDisplayList(u32);
|
||||
J3DError newSingleDisplayList(u32);
|
||||
J3DError single_To_Double();
|
||||
void setSingleDisplayList(void*, u32);
|
||||
void swapBuffer();
|
||||
void callDL() const;
|
||||
void beginDL();
|
||||
u32 endDL();
|
||||
void beginPatch();
|
||||
u32 endPatch();
|
||||
|
||||
u8* getDisplayList(int idx) const { return (u8*)mpData[idx]; }
|
||||
u32 getDisplayListSize() const { return mSize; }
|
||||
|
||||
static GDLObj sGDLObj;
|
||||
static s32 sInterruptFlag;
|
||||
|
||||
/* 0x0 */ void* mpData[2];
|
||||
/* 0x8 */ u32 mSize;
|
||||
/* 0xC */ u32 mCapacity;
|
||||
}; // Size: 0x10
|
||||
|
||||
class J3DPacket {
|
||||
public:
|
||||
J3DPacket() {
|
||||
mpNextPacket = NULL;
|
||||
mpFirstChild = NULL;
|
||||
mpUserData = NULL;
|
||||
}
|
||||
|
||||
void addChildPacket(J3DPacket*);
|
||||
|
||||
J3DPacket* getNextPacket() const { return mpNextPacket; }
|
||||
void setNextPacket(J3DPacket* i_packet) { mpNextPacket = i_packet; }
|
||||
|
||||
void drawClear() {
|
||||
mpNextPacket = NULL;
|
||||
mpFirstChild = NULL;
|
||||
}
|
||||
|
||||
void setUserArea(u32 area) { mpUserData = (void*)area; }
|
||||
|
||||
virtual int entry(J3DDrawBuffer*);
|
||||
virtual void draw();
|
||||
virtual ~J3DPacket() {}
|
||||
|
||||
public:
|
||||
/* 0x04 */ J3DPacket* mpNextPacket;
|
||||
/* 0x08 */ J3DPacket* mpFirstChild;
|
||||
/* 0x0C */ void* mpUserData;
|
||||
}; // Size: 0x10
|
||||
|
||||
class J3DDrawPacket : public J3DPacket {
|
||||
public:
|
||||
J3DDrawPacket();
|
||||
~J3DDrawPacket();
|
||||
J3DError newDisplayList(u32);
|
||||
J3DError newSingleDisplayList(u32);
|
||||
virtual void draw();
|
||||
|
||||
J3DDisplayListObj* getDisplayListObj() const { return mpDisplayListObj; }
|
||||
void setDisplayListObj(J3DDisplayListObj* pObj) { mpDisplayListObj = pObj; }
|
||||
|
||||
void beginPatch() { mpDisplayListObj->beginPatch(); }
|
||||
void endPatch() { mpDisplayListObj->endPatch(); }
|
||||
|
||||
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); }
|
||||
J3DTexMtxObj* getTexMtxObj() const { return mpTexMtxObj; }
|
||||
bool isLocked() const { return checkFlag(1); }
|
||||
|
||||
public:
|
||||
/* 0x10 */ u32 mFlags;
|
||||
/* 0x14 */ char mPad0[0x0C]; // unk
|
||||
/* 0x20 */ J3DDisplayListObj* mpDisplayListObj;
|
||||
/* 0x24 */ J3DTexMtxObj* mpTexMtxObj;
|
||||
}; // Size: 0x28
|
||||
|
||||
class J3DShapePacket : public J3DDrawPacket {
|
||||
public:
|
||||
J3DShapePacket();
|
||||
u32 calcDifferedBufferSize(u32);
|
||||
J3DError newDifferedDisplayList(u32);
|
||||
void prepareDraw() const;
|
||||
void drawFast();
|
||||
|
||||
virtual ~J3DShapePacket();
|
||||
virtual void draw();
|
||||
|
||||
void setShape(J3DShape* pShape) { mpShape = pShape; }
|
||||
void setModel(J3DModel* pModel) { mpModel = pModel; }
|
||||
void setMtxBuffer(J3DMtxBuffer* pMtxBuffer) { mpMtxBuffer = pMtxBuffer; }
|
||||
void setBaseMtxPtr(Mtx* pMtx) { mpBaseMtxPtr = pMtx; }
|
||||
|
||||
J3DShape* getShape() const { return mpShape; }
|
||||
J3DModel* getModel() const { return mpModel; }
|
||||
Mtx* getBaseMtxPtr() const { return mpBaseMtxPtr; }
|
||||
|
||||
public:
|
||||
/* 0x28 */ J3DShape* mpShape;
|
||||
/* 0x2C */ J3DMtxBuffer* mpMtxBuffer;
|
||||
/* 0x30 */ Mtx* mpBaseMtxPtr;
|
||||
/* 0x34 */ u32 mDiffFlag;
|
||||
/* 0x38 */ J3DModel* mpModel;
|
||||
}; // Size: 0x3C
|
||||
|
||||
class J3DMatPacket : public J3DDrawPacket {
|
||||
public:
|
||||
J3DMatPacket();
|
||||
void addShapePacket(J3DShapePacket*);
|
||||
void beginDiff();
|
||||
void endDiff();
|
||||
bool isSame(J3DMatPacket*) const;
|
||||
|
||||
J3DMaterial* getMaterial() const { return mpMaterial; }
|
||||
J3DShapePacket* getShapePacket() const { return mpShapePacket; }
|
||||
void setShapePacket(J3DShapePacket* packet) { mpShapePacket = packet; }
|
||||
void setInitShapePacket(J3DShapePacket* packet) { mpInitShapePacket = packet; }
|
||||
void setMaterialAnmID(J3DMaterialAnm* materialAnm) { mpMaterialAnm = materialAnm; }
|
||||
bool isChanged() const { return mDiffFlag & 0x80000000; }
|
||||
bool isEnabled_Diff() const { return mpInitShapePacket->getDisplayListObj() != NULL; }
|
||||
|
||||
virtual ~J3DMatPacket();
|
||||
virtual int entry(J3DDrawBuffer*);
|
||||
virtual void draw();
|
||||
|
||||
public:
|
||||
/* 0x28 */ J3DShapePacket* mpInitShapePacket;
|
||||
/* 0x2C */ J3DShapePacket* mpShapePacket;
|
||||
/* 0x30 */ J3DMaterial* mpMaterial;
|
||||
/* 0x34 */ u32 mDiffFlag;
|
||||
/* 0x38 */ J3DTexture* mpTexture;
|
||||
/* 0x3C */ J3DMaterialAnm* mpMaterialAnm;
|
||||
}; // Size: 0x40
|
||||
|
||||
#endif /* J3DPACKET_H */
|
||||
@@ -0,0 +1,152 @@
|
||||
#ifndef J3DSHAPE_H
|
||||
#define J3DSHAPE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class J3DCurrentMtxInfo {
|
||||
public:
|
||||
u32 mMtxIdxRegA;
|
||||
u32 mMtxIdxRegB;
|
||||
};
|
||||
|
||||
static inline void J3DFifoWriteCPCmd(u8 cmd, u32 param) {
|
||||
GFX_FIFO(u8) = GX_CMD_LOAD_CP_REG;
|
||||
GFX_FIFO(u8) = cmd;
|
||||
GFX_FIFO(u32) = param;
|
||||
}
|
||||
|
||||
static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) {
|
||||
GFX_FIFO(u8) = GX_CMD_LOAD_XF_REG;
|
||||
GFX_FIFO(u16) = (len - 1);
|
||||
GFX_FIFO(u16) = cmd;
|
||||
}
|
||||
|
||||
class J3DCurrentMtx : public J3DCurrentMtxInfo {
|
||||
public:
|
||||
J3DCurrentMtx() {
|
||||
mMtxIdxRegA = 0x3cf3cf00;
|
||||
mMtxIdxRegB = 0x00f3cf3c;
|
||||
}
|
||||
|
||||
u32 getMtxIdxRegA() const { return mMtxIdxRegA; }
|
||||
u32 getMtxIdxRegB() const { return mMtxIdxRegB; }
|
||||
|
||||
inline void load() const {
|
||||
J3DFifoWriteCPCmd(0x30, getMtxIdxRegA()); // CP_MATINDEX_A
|
||||
J3DFifoWriteCPCmd(0x40, getMtxIdxRegB()); // CP_MATINDEX_B
|
||||
J3DFifoWriteXFCmd(0x1018, 2);
|
||||
GFX_FIFO(u32) = getMtxIdxRegA();
|
||||
GFX_FIFO(u32) = getMtxIdxRegB();
|
||||
}
|
||||
|
||||
void setCurrentTexMtx(u8 param_1, u8 param_2, u8 param_3, u8 param_4,
|
||||
u8 param_5, u8 param_6, u8 param_7, u8 param_8) {
|
||||
mMtxIdxRegA = ((param_1 & 0xff) << 6) | (param_2 << 0xc)| (param_3 << 0x12) | (param_4 << 0x18);
|
||||
mMtxIdxRegB = (param_5) | param_6 << 6 | param_7 << 0xc | param_8 << 0x12;
|
||||
}
|
||||
};
|
||||
|
||||
class J3DMaterial;
|
||||
class J3DVertexData;
|
||||
class J3DDrawMtxData;
|
||||
|
||||
enum J3DShpFlag {
|
||||
J3DShpFlag_Visible = 0x0001,
|
||||
J3DShpFlag_SkinPosCpu = 0x0004,
|
||||
J3DShpFlag_SkinNrmCpu = 0x0008,
|
||||
J3DShpFlag_Hidden = 0x0010,
|
||||
J3DShpFlag_EnableLod = 0x0100,
|
||||
J3DShpFlag_NoMtx = 0x0200,
|
||||
};
|
||||
|
||||
class J3DShape {
|
||||
public:
|
||||
J3DShape() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
enum {
|
||||
kVcdVatDLSize = 0xC0,
|
||||
};
|
||||
|
||||
/* 80314B48 */ void initialize();
|
||||
/* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32);
|
||||
/* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr);
|
||||
/* 80314DA8 */ void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
/* 80314E28 */ u32 countBumpMtxNum() const;
|
||||
/* 80314EEC */ void loadVtxArray() const;
|
||||
/* 80314F5C */ bool isSameVcdVatCmd(J3DShape*);
|
||||
/* 80314F98 */ void makeVtxArrayCmd();
|
||||
/* 80315260 */ void makeVcdVatCmd();
|
||||
/* 80315300 */ void loadPreDrawSetting() const;
|
||||
/* 80315398 */ void setArrayAndBindPipeline() const;
|
||||
|
||||
/* 803155E0 */ virtual void draw() const;
|
||||
/* 8031544C */ virtual void drawFast() const;
|
||||
/* 80315628 */ virtual void simpleDraw() const;
|
||||
/* 803156AC */ virtual void simpleDrawCache() const;
|
||||
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
bool checkFlag(u32 flag) const { return !!(mFlags & flag); }
|
||||
void setDrawMtxDataPointer(J3DDrawMtxData* pMtxData) { mDrawMtxData = pMtxData; }
|
||||
void setVertexDataPointer(J3DVertexData* pVtxData) { mVertexData = pVtxData; }
|
||||
void* getVcdVatCmd() const { return mVcdVatCmd; }
|
||||
void setVcdVatCmd(void* pVatCmd) { mVcdVatCmd = (u8*)pVatCmd; }
|
||||
void show() { offFlag(J3DShpFlag_Visible); }
|
||||
void hide() { onFlag(J3DShpFlag_Visible); }
|
||||
void setCurrentViewNoPtr(u32* pViewNoPtr) { mCurrentViewNo = pViewNoPtr; }
|
||||
void setCurrentMtx(J3DCurrentMtx& mtx) { mCurrentMtx = mtx; }
|
||||
void setScaleFlagArray(u8* pScaleFlagArray) { mScaleFlagArray = pScaleFlagArray; }
|
||||
void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; }
|
||||
void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; }
|
||||
void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; }
|
||||
bool getNBTFlag() const { return mHasNBT; }
|
||||
u32 getBumpMtxOffset() const { return mBumpMtxOffset; }
|
||||
GXVtxDescList* getVtxDesc() const { return mVtxDesc; }
|
||||
|
||||
J3DMaterial* getMaterial() const { return mMaterial; }
|
||||
u32 getIndex() const { return mIndex; }
|
||||
u32 getPipeline() const { return (mFlags >> 2) & 0x07; }
|
||||
u32 getTexMtxLoadType() const { return mFlags & 0xF000; }
|
||||
u32 getMtxGroupNum() const { return mMtxGroupNum; }
|
||||
J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; }
|
||||
J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; }
|
||||
Vec* getMin() { return &mMin; }
|
||||
Vec* getMax() { return &mMax; }
|
||||
|
||||
static void resetVcdVatCache() { sOldVcdVatCmd = NULL; }
|
||||
|
||||
static void* sOldVcdVatCmd;
|
||||
|
||||
private:
|
||||
friend struct J3DShapeFactory;
|
||||
friend class J3DJointTree;
|
||||
|
||||
/* 0x04 */ J3DMaterial* mMaterial;
|
||||
/* 0x08 */ u16 mIndex;
|
||||
/* 0x0A */ u16 mMtxGroupNum;
|
||||
/* 0x0C */ u32 mFlags;
|
||||
/* 0x10 */ f32 mRadius;
|
||||
/* 0x14 */ Vec mMin;
|
||||
/* 0x20 */ Vec mMax;
|
||||
/* 0x2C */ u8* mVcdVatCmd;
|
||||
/* 0x30 */ GXVtxDescList* mVtxDesc;
|
||||
/* 0x34 */ bool mHasNBT;
|
||||
/* 0x38 */ J3DShapeMtx** mShapeMtx;
|
||||
/* 0x3C */ J3DShapeDraw** mShapeDraw;
|
||||
/* 0x40 */ J3DCurrentMtx mCurrentMtx;
|
||||
/* 0x48 */ bool mHasPNMTXIdx;
|
||||
/* 0x4C */ J3DVertexData* mVertexData;
|
||||
/* 0x50 */ J3DDrawMtxData* mDrawMtxData;
|
||||
/* 0x54 */ u8* mScaleFlagArray;
|
||||
/* 0x58 */ Mtx** mDrawMtx;
|
||||
/* 0x5C */ Mtx33** mNrmMtx;
|
||||
/* 0x60 */ u32* mCurrentViewNo;
|
||||
/* 0x64 */ u32 mBumpMtxOffset;
|
||||
};
|
||||
|
||||
#endif /* J3DSHAPE_H */
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef J3DSHAPEDRAW_H
|
||||
#define J3DSHAPEDRAW_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class J3DShapeDraw {
|
||||
public:
|
||||
/* 80314924 */ u32 countVertex(u32);
|
||||
/* 80314974 */ void addTexMtxIndexInDL(u32, u32, u32);
|
||||
/* 80314ABC */ J3DShapeDraw(u8 const*, u32);
|
||||
/* 80314AD4 */ void draw() const;
|
||||
|
||||
/* 80314B00 */ virtual ~J3DShapeDraw();
|
||||
|
||||
u8* getDisplayList() const { return (u8*)mDisplayList; }
|
||||
u32 getDisplayListSize() const { return mDisplayListSize; }
|
||||
void setDisplayListSize(u32 size) { mDisplayListSize = size; }
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 mDisplayListSize;
|
||||
/* 0x08 */ void* mDisplayList;
|
||||
};
|
||||
|
||||
#endif /* J3DSHAPEDRAW_H */
|
||||
@@ -0,0 +1,156 @@
|
||||
#ifndef J3DSHAPEMTX_H
|
||||
#define J3DSHAPEMTX_H
|
||||
|
||||
#include "dolphin/mtx/mtxvec.h"
|
||||
|
||||
class J3DTexMtx;
|
||||
class J3DTexGenBlock;
|
||||
|
||||
class J3DTexMtxObj {
|
||||
public:
|
||||
Mtx& getMtx(u16 idx) { return mpTexMtx[idx]; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ Mtx *mpTexMtx;
|
||||
};
|
||||
|
||||
class J3DDifferedTexMtx {
|
||||
public:
|
||||
/* 8031322C */ static void loadExecute(f32 const (*)[4]);
|
||||
|
||||
static inline void load(Mtx m) {
|
||||
if (sTexGenBlock != NULL)
|
||||
loadExecute(m);
|
||||
}
|
||||
|
||||
static J3DTexGenBlock* sTexGenBlock;
|
||||
static J3DTexMtxObj* sTexMtxObj;
|
||||
};
|
||||
|
||||
extern u8 struct_804515B0;
|
||||
extern u8 struct_804515B1;
|
||||
extern u8 struct_804515B2;
|
||||
extern u8 struct_804515B3;
|
||||
|
||||
class J3DShapeMtx {
|
||||
public:
|
||||
J3DShapeMtx(u16 useMtxIndex)
|
||||
: mUseMtxIndex(useMtxIndex)
|
||||
{}
|
||||
|
||||
/* 803130A8 */ void resetMtxLoadCache();
|
||||
/* 803130E4 */ void loadMtxIndx_PNGP(int, u16) const;
|
||||
/* 80313128 */ void loadMtxIndx_PCPU(int, u16) const;
|
||||
/* 80313188 */ void loadMtxIndx_NCPU(int, u16) const;
|
||||
/* 803131D4 */ void loadMtxIndx_PNCPU(int, u16) const;
|
||||
|
||||
/* 80314798 */ virtual ~J3DShapeMtx();
|
||||
/* 803147E0 */ virtual u32 getType() const;
|
||||
/* 80273E08 */ virtual u32 getUseMtxNum() const;
|
||||
/* 8031459C */ virtual u32 getUseMtxIndex(u16) const;
|
||||
/* 80313B94 */ virtual void load() const;
|
||||
/* 80313BF0 */ virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
|
||||
static u8 sMtxLoadPipeline[48];
|
||||
static u16 sMtxLoadCache[10 + 2 /* padding */];
|
||||
static u32 sCurrentPipeline;
|
||||
// static J3DScaleFlag sCurrentScaleFlag;
|
||||
static u8* sCurrentScaleFlag;
|
||||
static u32 sTexMtxLoadType;
|
||||
|
||||
static void setCurrentPipeline(u32 pipeline) { sCurrentPipeline = pipeline; }
|
||||
static void setLODFlag(u8 flag) { struct_804515B1 = flag; }
|
||||
static u8 getLODFlag() { return struct_804515B1; }
|
||||
static void resetMtxLoadCache();
|
||||
|
||||
private:
|
||||
/* 0x04 */ u16 mUseMtxIndex;
|
||||
};
|
||||
|
||||
class J3DShapeMtxConcatView : public J3DShapeMtx {
|
||||
public:
|
||||
J3DShapeMtxConcatView(u16 useMtxIndex)
|
||||
: J3DShapeMtx(useMtxIndex)
|
||||
{}
|
||||
|
||||
/* 80314730 */ virtual ~J3DShapeMtxConcatView();
|
||||
/* 803147E0 */ virtual u32 getType() const;
|
||||
/* 80313C54 */ virtual void load() const;
|
||||
/* 80314598 */ virtual void loadNrmMtx(int, u16) const;
|
||||
/* 80313D28 */ virtual void loadNrmMtx(int, u16, f32 (*)[4]) const;
|
||||
|
||||
/* 80313828 */ void loadMtxConcatView_PNGP(int, u16) const;
|
||||
/* 803138C8 */ void loadMtxConcatView_PCPU(int, u16) const;
|
||||
/* 8031396C */ void loadMtxConcatView_NCPU(int, u16) const;
|
||||
/* 80313A14 */ void loadMtxConcatView_PNCPU(int, u16) const;
|
||||
/* 80313AC8 */ void loadMtxConcatView_PNGP_LOD(int, u16) const;
|
||||
|
||||
static u8 sMtxLoadPipeline[48];
|
||||
static u8 sMtxLoadLODPipeline[48];
|
||||
static u8 sMtxPtrTbl[8];
|
||||
};
|
||||
|
||||
class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxConcatView {
|
||||
public:
|
||||
J3DShapeMtxYBBoardConcatView(u16 useMtxIndex)
|
||||
: J3DShapeMtxConcatView(useMtxIndex)
|
||||
{}
|
||||
|
||||
/* 80314520 */ virtual ~J3DShapeMtxYBBoardConcatView();
|
||||
/* 803147E0 */ virtual u32 getType() const;
|
||||
/* 803143E4 */ virtual void load() const;
|
||||
};
|
||||
|
||||
class J3DShapeMtxBBoardConcatView : public J3DShapeMtxConcatView {
|
||||
public:
|
||||
J3DShapeMtxBBoardConcatView(u16 useMtxIndex)
|
||||
: J3DShapeMtxConcatView(useMtxIndex)
|
||||
{}
|
||||
|
||||
/* 803145A4 */ virtual ~J3DShapeMtxBBoardConcatView();
|
||||
/* 803147E0 */ virtual u32 getType() const;
|
||||
/* 803142D4 */ virtual void load() const;
|
||||
};
|
||||
|
||||
class J3DShapeMtxMulti : public J3DShapeMtx {
|
||||
public:
|
||||
J3DShapeMtxMulti(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable)
|
||||
: J3DShapeMtx(useMtxIndex)
|
||||
, mUseMtxNum(useMtxNum)
|
||||
, mUseMtxIndexTable(useMtxIndexTable)
|
||||
{}
|
||||
|
||||
/* 803146B0 */ virtual ~J3DShapeMtxMulti();
|
||||
/* 803147E0 */ virtual u32 getType() const;
|
||||
/* 80273E08 */ virtual u32 getUseMtxNum() const;
|
||||
/* 8031459C */ virtual u32 getUseMtxIndex(u16) const;
|
||||
/* 80313E4C */ virtual void load() const;
|
||||
/* 80313EEC */ virtual void calcNBTScale(Vec const&, f32 (*)[3][3], f32 (*)[3][3]);
|
||||
|
||||
private:
|
||||
/* 0x6 */ u16 mUseMtxNum;
|
||||
/* 0x8 */ u16* mUseMtxIndexTable;
|
||||
};
|
||||
|
||||
class J3DShapeMtxMultiConcatView : public J3DShapeMtxConcatView {
|
||||
public:
|
||||
J3DShapeMtxMultiConcatView(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable)
|
||||
: J3DShapeMtxConcatView(useMtxIndex)
|
||||
, mUseMtxNum(useMtxNum)
|
||||
, mUseMtxIndexTable(useMtxIndexTable)
|
||||
{}
|
||||
|
||||
/* 8031461C */ virtual ~J3DShapeMtxMultiConcatView();
|
||||
/* 803147E0 */ virtual u32 getType() const;
|
||||
/* 80273E08 */ virtual u32 getUseMtxNum() const;
|
||||
/* 8031459C */ virtual u32 getUseMtxIndex(u16) const;
|
||||
/* 80313FA4 */ virtual void load() const;
|
||||
/* 803146AC */ virtual void loadNrmMtx(int, u16) const;
|
||||
/* 8031419C */ virtual void loadNrmMtx(int, u16, f32 (*)[4]) const;
|
||||
|
||||
private:
|
||||
/* 0x6 */ u16 mUseMtxNum;
|
||||
/* 0x8 */ u16* mUseMtxIndexTable;
|
||||
};
|
||||
|
||||
#endif /* J3DSHAPEMTX_H */
|
||||
@@ -0,0 +1,87 @@
|
||||
#ifndef J3DSTRUCT_H
|
||||
#define J3DSTRUCT_H
|
||||
|
||||
#include "dolphin/gx/GXStruct.h"
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
#include "dolphin/mtx/mtx44.h"
|
||||
#include "dolphin/mtx/vec.h"
|
||||
|
||||
class J3DLightInfo {
|
||||
public:
|
||||
/* 803256C4 */ void operator=(J3DLightInfo const&);
|
||||
|
||||
/* 0x00 */ Vec mLightPosition;
|
||||
/* 0x0C */ Vec mLightDirection;
|
||||
/* 0x18 */ GXColor mColor;
|
||||
/* 0x1C */ Vec mCosAtten;
|
||||
/* 0x28 */ Vec mDistAtten;
|
||||
}; // Size = 0x34
|
||||
|
||||
extern "C" extern J3DLightInfo const j3dDefaultLightInfo;
|
||||
|
||||
class J3DLightObj {
|
||||
public:
|
||||
/* 80018C0C */ J3DLightObj() { mInfo = j3dDefaultLightInfo; }
|
||||
/* 80323590 */ void load(u32) const;
|
||||
|
||||
J3DLightInfo& getLightInfo() { return mInfo; }
|
||||
J3DLightObj& operator=(J3DLightObj const& other) {
|
||||
mInfo = other.mInfo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* 0x00 */ J3DLightInfo mInfo;
|
||||
/* 0x34 */ u8 field_0x34[64];
|
||||
}; // Size = 0x74
|
||||
|
||||
struct J3DTextureSRTInfo {
|
||||
/* 0x00 */ f32 mScaleX;
|
||||
/* 0x04 */ f32 mScaleY;
|
||||
/* 0x08 */ s16 mRotation;
|
||||
/* 0x0C */ f32 mTranslationX;
|
||||
/* 0x10 */ f32 mTranslationY;
|
||||
}; // Size: 0x14
|
||||
|
||||
struct J3DTexMtxInfo {
|
||||
/* 80325718 */ void operator=(J3DTexMtxInfo const&);
|
||||
/* 80325794 */ void setEffectMtx(Mtx);
|
||||
|
||||
/* 0x00 */ u8 mProjection;
|
||||
/* 0x01 */ s8 mInfo;
|
||||
/* 0x04 */ Vec mCenter;
|
||||
/* 0x10 */ J3DTextureSRTInfo mSRT;
|
||||
/* 0x24 */ Mtx44 mEffectMtx;
|
||||
}; // Size: 0x64
|
||||
|
||||
struct J3DIndTexMtxInfo {
|
||||
/* 803257DC */ void operator=(J3DIndTexMtxInfo const&);
|
||||
|
||||
/* 0x00 */ Mtx23 field_0x0;
|
||||
/* 0x18 */ u8 field_0x18;
|
||||
}; // Size: 0x1C
|
||||
|
||||
struct J3DFogInfo {
|
||||
/* 80325800 */ void operator=(J3DFogInfo const&);
|
||||
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x01 */ u8 field_0x1;
|
||||
/* 0x02 */ u16 field_0x2;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ f32 field_0xc;
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
/* 0x14 */ u8 field_0x14;
|
||||
/* 0x15 */ u8 field_0x15;
|
||||
/* 0x16 */ u8 field_0x16;
|
||||
/* 0x17 */ u8 field_0x17;
|
||||
/* 0x18 */ u16 field_0x18[10];
|
||||
}; // Size: 0x2C
|
||||
|
||||
struct J3DNBTScaleInfo {
|
||||
/* 8032587C */ void operator=(J3DNBTScaleInfo const&);
|
||||
|
||||
/* 0x0 */ u8 mbHasScale;
|
||||
/* 0x4 */ Vec mScale;
|
||||
}; // Size: 0x10
|
||||
|
||||
#endif /* J3DSTRUCT_H */
|
||||
@@ -0,0 +1,140 @@
|
||||
#ifndef J3DSYS_H
|
||||
#define J3DSYS_H
|
||||
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
// Perhaps move to a new J3DEnum.h?
|
||||
enum J3DError {
|
||||
kJ3DError_Success = 0,
|
||||
kJ3DError_Alloc = 4,
|
||||
};
|
||||
|
||||
enum J3DSysDrawBuffer {
|
||||
/* 0x0 */ OPA_BUFFER,
|
||||
/* 0x1 */ XLU_BUFFER
|
||||
};
|
||||
|
||||
class J3DMtxCalc;
|
||||
class J3DModel;
|
||||
class J3DMatPacket;
|
||||
class J3DShapePacket;
|
||||
class J3DShape;
|
||||
class J3DDrawBuffer;
|
||||
class J3DTexture;
|
||||
|
||||
enum J3DSysFlag {
|
||||
J3DSysFlag_SkinPosCpu = 0x00000004,
|
||||
J3DSysFlag_SkinNrmCpu = 0x00000008,
|
||||
J3DSysFlag_PostTexMtx = 0x40000000,
|
||||
};
|
||||
|
||||
struct J3DSys {
|
||||
/* 0x000 */ Mtx mViewMtx;
|
||||
/* 0x030 */ J3DMtxCalc* mCurrentMtxCalc;
|
||||
/* 0x034 */ u32 mFlags;
|
||||
/* 0x038 */ J3DModel* mModel;
|
||||
/* 0x03C */ J3DMatPacket* mMatPacket;
|
||||
/* 0x040 */ J3DShapePacket* mShapePacket;
|
||||
/* 0x044 */ J3DShape* mShape;
|
||||
/* 0x048 */ J3DDrawBuffer* mDrawBuffer[2];
|
||||
/* 0x050 */ u32 mDrawMode;
|
||||
/* 0x054 */ u32 mMaterialMode;
|
||||
/* 0x058 */ J3DTexture* mTexture;
|
||||
/* 0x05C */ u8 field_0x5c[0x04];
|
||||
/* 0x060 */ u32 mTexCacheRegionNum;
|
||||
/* 0x064 */ GXTexRegion mTexCacheRegion[8];
|
||||
/* 0x0E4 */ u8 field_0xe4[0x20];
|
||||
/* 0x104 */ Mtx* mModelDrawMtx;
|
||||
/* 0x108 */ Mtx33* mModelNrmMtx;
|
||||
/* 0x10C */ void* mVtxPos;
|
||||
/* 0x110 */ void* mVtxNrm;
|
||||
/* 0x114 */ _GXColor* mVtxCol;
|
||||
/* 0x118 */ Vec* mNBTScale;
|
||||
|
||||
/* 8030FDE8 */ J3DSys();
|
||||
/* 8030FEC0 */ void loadPosMtxIndx(int, u16) const;
|
||||
/* 8030FEE4 */ void loadNrmMtxIndx(int, u16) const;
|
||||
/* 8030FF0C */ void setTexCacheRegion(_GXTexCacheSize);
|
||||
/* 803100BC */ void drawInit();
|
||||
/* 8031073C */ void reinitGX();
|
||||
/* 8031079C */ void reinitGenMode();
|
||||
/* 803107E8 */ void reinitLighting();
|
||||
/* 80310894 */ void reinitTransform();
|
||||
/* 80310998 */ void reinitTexture();
|
||||
/* 80310A3C */ void reinitTevStages();
|
||||
/* 80310D44 */ void reinitIndStages();
|
||||
/* 80310E3C */ void reinitPixelProc();
|
||||
|
||||
enum DrawMode {
|
||||
/* 0x3 */ OPA_TEX_EDGE = 3,
|
||||
/* 0x4 */ XLU,
|
||||
};
|
||||
|
||||
MtxP getViewMtx() { return mViewMtx; }
|
||||
|
||||
void setDrawModeOpaTexEdge() { mDrawMode = OPA_TEX_EDGE; }
|
||||
|
||||
void setDrawModeXlu() { mDrawMode = XLU; }
|
||||
|
||||
void* getVtxPos() const { return mVtxPos; }
|
||||
void setVtxPos(void* pVtxPos) { mVtxPos = pVtxPos; }
|
||||
|
||||
void* getVtxNrm() const { return mVtxNrm; }
|
||||
void setVtxNrm(void* pVtxNrm) { mVtxNrm = pVtxNrm; }
|
||||
|
||||
void* getVtxCol() const { return mVtxCol; }
|
||||
void setVtxCol(_GXColor* pVtxCol) { mVtxCol = pVtxCol; }
|
||||
|
||||
void setModel(J3DModel* pModel) { mModel = pModel; }
|
||||
void setShapePacket(J3DShapePacket* pPacket) { mShapePacket = pPacket; }
|
||||
void setMatPacket(J3DMatPacket* pPacket) { mMatPacket = pPacket; }
|
||||
J3DMatPacket* getMatPacket() { return mMatPacket; }
|
||||
void setMaterialMode(u32 mode) { mMaterialMode = mode; }
|
||||
|
||||
void setTexture(J3DTexture* pTex) { mTexture = pTex; }
|
||||
J3DTexture* getTexture() { return mTexture; }
|
||||
|
||||
void setNBTScale(Vec* scale) { mNBTScale = scale; }
|
||||
|
||||
void onFlag(u32 flag) { mFlags |= flag; }
|
||||
|
||||
void offFlag(u32 flag) { mFlags &= ~flag; }
|
||||
|
||||
bool checkFlag(u32 flag) { return mFlags & flag; }
|
||||
|
||||
void setModelDrawMtx(Mtx* pMtxArr) {
|
||||
mModelDrawMtx = pMtxArr;
|
||||
GXSetArray(GX_POS_MTX_ARRAY, mModelDrawMtx, sizeof(*mModelDrawMtx));
|
||||
}
|
||||
|
||||
void setModelNrmMtx(Mtx33* pMtxArr) {
|
||||
mModelNrmMtx = pMtxArr;
|
||||
GXSetArray(GX_NRM_MTX_ARRAY, mModelNrmMtx, sizeof(*mModelNrmMtx));
|
||||
}
|
||||
|
||||
// Type 0: Opa Buffer
|
||||
// Type 1: Xlu Buffer
|
||||
void setDrawBuffer(J3DDrawBuffer* buffer, int type) { mDrawBuffer[type] = buffer; }
|
||||
|
||||
// Type 0: Opa Buffer
|
||||
// Type 1: Xlu Buffer
|
||||
J3DDrawBuffer* getDrawBuffer(int type) { return mDrawBuffer[type]; }
|
||||
|
||||
Mtx& getModelDrawMtx(u16 no) const { return mModelDrawMtx[no]; }
|
||||
J3DShapePacket* getShapePacket() const { return mShapePacket; }
|
||||
|
||||
void setViewMtx(Mtx m) { MTXCopy(m, mViewMtx); }
|
||||
|
||||
J3DModel* getModel() { return mModel; }
|
||||
|
||||
static Mtx mCurrentMtx;
|
||||
static Vec mCurrentS;
|
||||
static Vec mParentS;
|
||||
static u16 sTexCoordScaleTable[32];
|
||||
};
|
||||
|
||||
extern u32 j3dDefaultViewNo;
|
||||
extern J3DSys j3dSys;
|
||||
|
||||
#endif /* J3DSYS_H */
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef J3DTEVS_H
|
||||
#define J3DTEVS_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
struct J3DTevStageInfo {
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
/* 0x1 */ u8 mTevColorOp;
|
||||
/* 0x2 */ u8 mTevColorAB;
|
||||
/* 0x3 */ u8 mTevColorCD;
|
||||
/* 0x4 */ u8 field_0x4;
|
||||
/* 0x5 */ u8 mTevAlphaOp;
|
||||
/* 0x6 */ u8 mTevAlphaAB;
|
||||
/* 0x7 */ u8 mTevSwapModeInfo;
|
||||
};
|
||||
|
||||
struct J3DTevStage : public J3DTevStageInfo {
|
||||
/* 8000E230 */ J3DTevStage();
|
||||
/* 8000E298 */ void setTevStageInfo(J3DTevStageInfo const&);
|
||||
/* 8003AACC */ J3DTevStage(J3DTevStageInfo const&);
|
||||
};
|
||||
|
||||
struct J3DIndTevStageInfo {
|
||||
/* 0x0 */ u8 mIndStage;
|
||||
/* 0x1 */ u8 mIndFormat;
|
||||
/* 0x2 */ u8 mBiasSel;
|
||||
/* 0x3 */ u8 mMtxSel;
|
||||
/* 0x4 */ u8 mWrapS;
|
||||
/* 0x5 */ u8 mWrapT;
|
||||
/* 0x6 */ u8 mPrev;
|
||||
/* 0x7 */ u8 mLod;
|
||||
/* 0x8 */ u8 mAlphaSel;
|
||||
};
|
||||
|
||||
struct J3DIndTevStage {
|
||||
/* 8000E14C */ J3DIndTevStage();
|
||||
|
||||
/* 0x0 */ u32 mInfo;
|
||||
};
|
||||
|
||||
struct J3DTevOrderInfo {
|
||||
void operator=(const J3DTevOrderInfo& other) {
|
||||
*(u32*) this = *(u32*)&other;
|
||||
}
|
||||
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
/* 0x1 */ u8 mTexMap;
|
||||
/* 0x2 */ u8 field_0x2;
|
||||
/* 0x3 */ u8 field_0x3; // Maybe padding
|
||||
};
|
||||
|
||||
struct J3DTevOrder : public J3DTevOrderInfo {
|
||||
/* 8000E140 */ J3DTevOrder();
|
||||
J3DTevOrder(const J3DTevOrderInfo& info) {
|
||||
*(J3DTevOrderInfo*)this = info;
|
||||
}
|
||||
|
||||
u8 getTexMap() { return mTexMap; }
|
||||
};
|
||||
|
||||
struct J3DTevSwapModeTable {
|
||||
/* 8000E134 */ J3DTevSwapModeTable();
|
||||
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
}; // Size: 0x1
|
||||
|
||||
struct J3DTevSwapModeInfo {};
|
||||
|
||||
struct J3DNBTScale;
|
||||
void loadNBTScale(J3DNBTScale& param_0);
|
||||
|
||||
#endif /* J3DTEVS_H */
|
||||
@@ -0,0 +1,82 @@
|
||||
#ifndef J3DTEXTURE_H
|
||||
#define J3DTEXTURE_H
|
||||
|
||||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class J3DTexture {
|
||||
private:
|
||||
/* 0x0 */ u16 mNum;
|
||||
/* 0x4 */ ResTIMG* mpRes;
|
||||
|
||||
public:
|
||||
/* 8031204C */ void loadGX(u16, _GXTexMapID) const;
|
||||
/* 803121A4 */ void entryNum(u16);
|
||||
/* 8031221C */ void addResTIMG(u16, ResTIMG const*);
|
||||
/* 803366A4 */ virtual ~J3DTexture();
|
||||
|
||||
u16 getNum() const { return mNum; }
|
||||
ResTIMG* getResTIMG(u16 entry) const { return &mpRes[entry]; }
|
||||
void setResTIMG(u16 entry, const ResTIMG& timg) {
|
||||
mpRes[entry] = timg;
|
||||
mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry)));
|
||||
mpRes[entry].paletteOffset = ((mpRes[entry].paletteOffset + (u32)&timg - (u32)(mpRes + entry)));
|
||||
}
|
||||
};
|
||||
|
||||
class J3DTexMtx {
|
||||
public:
|
||||
J3DTexMtx(const J3DTexMtxInfo& info) {
|
||||
mTexMtxInfo = info;
|
||||
}
|
||||
/* 803238C4 */ void load(u32) const;
|
||||
/* 80323900 */ void calc(f32 const (*)[4]);
|
||||
/* 80323920 */ void calcTexMtx(f32 const (*)[4]);
|
||||
/* 80323C0C */ void calcPostTexMtx(f32 const (*)[4]);
|
||||
/* 80324358 */ void loadTexMtx(u32) const;
|
||||
/* 803243BC */ void loadPostTexMtx(u32) const;
|
||||
|
||||
J3DTexMtxInfo& getTexMtxInfo() { return mTexMtxInfo; }
|
||||
Mtx& getMtx() { return mMtx; }
|
||||
void setEffectMtx(Mtx effectMtx) { mTexMtxInfo.setEffectMtx(effectMtx); }
|
||||
|
||||
private:
|
||||
/* 0x00 */ J3DTexMtxInfo mTexMtxInfo;
|
||||
/* 0x64 */ Mtx mMtx;
|
||||
}; // Size: 0x94
|
||||
|
||||
struct J3DTexCoordInfo {
|
||||
/* 0x0 */ u8 mTexGenType;
|
||||
/* 0x1 */ u8 mTexGenSrc;
|
||||
/* 0x2 */ u8 mTexGenMtx;
|
||||
void operator=(J3DTexCoordInfo const& other) {
|
||||
*(u32*) this = *(u32*)&other;
|
||||
}
|
||||
};
|
||||
|
||||
struct J3DTexCoord : public J3DTexCoordInfo {
|
||||
/* 8000E464 */ J3DTexCoord();
|
||||
void setTexCoordInfo(J3DTexCoordInfo *param_1) {
|
||||
*(J3DTexCoordInfo*)this = *param_1;
|
||||
}
|
||||
|
||||
u8 getTexGenMtx() { return mTexGenMtx & 0xff; }
|
||||
u16 getTexMtxReg() { return mTexMtxReg & 0xff; }
|
||||
|
||||
void resetTexMtxReg() {
|
||||
mTexMtxReg = mTexGenMtx;
|
||||
}
|
||||
|
||||
/* 0x4 */ u16 mTexMtxReg;
|
||||
}; // Size: 0x6
|
||||
|
||||
struct J3DDefaultTexCoordInfo {
|
||||
/* 0x0 */ u8 mTexGenType;
|
||||
/* 0x1 */ u8 mTexGenSrc;
|
||||
/* 0x2 */ u8 mTexGenMtx;
|
||||
/* 0x3 */ u8 pad;
|
||||
};
|
||||
|
||||
#endif /* J3DTEXTURE_H */
|
||||
@@ -0,0 +1,213 @@
|
||||
#ifndef J3DTRANSFORM_H
|
||||
#define J3DTRANSFORM_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "dolphin/mtx/mtxvec.h"
|
||||
|
||||
struct J3DTransformInfo {
|
||||
/* 0x00 */ JGeometry::TVec3<f32> mScale;
|
||||
/* 0x0C */ JGeometry::TVec3<s16> mRotation;
|
||||
/* 0x14 */ JGeometry::TVec3<f32> mTranslate;
|
||||
}; // Size: 0x20
|
||||
|
||||
extern J3DTransformInfo const j3dDefaultTransformInfo;
|
||||
extern Vec const j3dDefaultScale;
|
||||
extern Mtx const j3dDefaultMtx;
|
||||
extern f32 PSMulUnit01[2];
|
||||
|
||||
void J3DGetTranslateRotateMtx(J3DTransformInfo const&, Mtx);
|
||||
void J3DGetTranslateRotateMtx(s16, s16, s16, f32, f32, f32, Mtx);
|
||||
void J3DPSCalcInverseTranspose(f32 (*param_0)[4], f32 (*param_1)[3]);
|
||||
void J3DGQRSetup7(u32 param_0, u32 param_1, u32 param_2, u32 param_3);
|
||||
|
||||
inline void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst) {
|
||||
register f32 x_y1;
|
||||
register f32 z1;
|
||||
register f32 x_y2;
|
||||
register f32 z2;
|
||||
register f32 x_y3;
|
||||
register f32 z3;
|
||||
asm {
|
||||
psq_l x_y1, 0(src), 0, 0
|
||||
lfs z1, 8(src)
|
||||
psq_l x_y2, 16(src), 0, 0
|
||||
lfs z2, 0x18(src)
|
||||
psq_l x_y3, 32(src), 0, 0
|
||||
lfs z3, 0x28(src)
|
||||
psq_st x_y1, 0(dst), 0, 0
|
||||
stfs z1, 8(dst)
|
||||
psq_st x_y2, 12(dst), 0, 0
|
||||
stfs z2, 0x14(dst)
|
||||
psq_st x_y3, 24(dst), 0, 0
|
||||
stfs z3, 0x20(dst)
|
||||
}
|
||||
}
|
||||
|
||||
// regalloc issues
|
||||
inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* dst) {
|
||||
register f32 fr12;
|
||||
register f32 fr11;
|
||||
register f32 fr10;
|
||||
register f32 fr9;
|
||||
register f32 fr8;
|
||||
register f32 fr6;
|
||||
register f32 fra6;
|
||||
register f32 fr5;
|
||||
register f32 fra5;
|
||||
register f32 fra4;
|
||||
register f32 fr4;
|
||||
register f32 fr3;
|
||||
register f32 fr2;
|
||||
register f32 fra2;
|
||||
register f32 fr01;
|
||||
register f32 fr00;
|
||||
asm {
|
||||
psq_l fr00, 0(vec), 0, 0
|
||||
psq_l fr2, 0(mtx), 0, 0
|
||||
psq_l fr01, 8(vec), 1, 0
|
||||
ps_mul fr4, fr2, fr00
|
||||
psq_l fr3, 8(mtx), 0, 0
|
||||
ps_madd fr5, fr3, fr01, fr4
|
||||
psq_l fr8, 16(mtx), 0, 0
|
||||
ps_sum0 fr6, fr5, fr6, fr5
|
||||
psq_l fr9, 24(mtx), 0, 0
|
||||
ps_mul fr10, fr8, fr00
|
||||
psq_st fr6, 0(dst), 1, 0
|
||||
ps_madd fr11, fr9, fr01, fr10
|
||||
psq_l fra2, 32(mtx), 0, 0
|
||||
ps_sum0 fr12, fr11, fr12, fr11
|
||||
psq_l fr3, 40(mtx), 0, 0
|
||||
ps_mul fra4, fra2, fr00
|
||||
psq_st fr12, 4(dst), 1, 0
|
||||
ps_madd fra5, fr3, fr01, fra4
|
||||
ps_sum0 fra6, fra5, fra6, fra5
|
||||
psq_st fra6, 8(dst), 1, 0
|
||||
}
|
||||
}
|
||||
|
||||
// regalloc issues
|
||||
inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec* dst) {
|
||||
register f32 fr12;
|
||||
register f32 fr11;
|
||||
register f32 fr10;
|
||||
register f32 fr9;
|
||||
register f32 fr8;
|
||||
register f32 fr6;
|
||||
register f32 fra6;
|
||||
register f32 fr5;
|
||||
register f32 fra5;
|
||||
register f32 fra4;
|
||||
register f32 fr4;
|
||||
register f32 fr3;
|
||||
register f32 fr2;
|
||||
register f32 fra2;
|
||||
register f32 fr01;
|
||||
register f32 fr00;
|
||||
asm {
|
||||
psq_l fr00, 0(vec), 0, 7
|
||||
psq_l fr2, 0(mtx), 0, 0
|
||||
psq_l fr01, 4(vec), 1, 7
|
||||
ps_mul fr4, fr2, fr00
|
||||
psq_l fr3, 8(mtx), 0, 0
|
||||
ps_madd fr5, fr3, fr01, fr4
|
||||
psq_l fr8, 16(mtx), 0, 0
|
||||
ps_sum0 fr6, fr5, fr6, fr5
|
||||
psq_l fr9, 24(mtx), 0, 0
|
||||
ps_mul fr10, fr8, fr00
|
||||
psq_st fr6, 0(dst), 1, 7
|
||||
ps_madd fr11, fr9, fr01, fr10
|
||||
psq_l fra2, 32(mtx), 0, 0
|
||||
ps_sum0 fr12, fr11, fr12, fr11
|
||||
psq_l fr3, 40(mtx), 0, 0
|
||||
ps_mul fra4, fra2, fr00
|
||||
psq_st fr12, 2(dst), 1, 7
|
||||
ps_madd fra5, fr3, fr01, fra4
|
||||
ps_sum0 fra6, fra5, fra6, fra5
|
||||
psq_st fra6, 4(dst), 1, 7
|
||||
}
|
||||
}
|
||||
|
||||
// regalloc issues
|
||||
inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec* dst) {
|
||||
register f32* punit;
|
||||
register f32 unit;
|
||||
register f32 fr12;
|
||||
register f32 fr11;
|
||||
register f32 fr10;
|
||||
register f32 fr9;
|
||||
register f32 fr8;
|
||||
register f32 fr6;
|
||||
register f32 fr5;
|
||||
register f32 fr4;
|
||||
register f32 fr3;
|
||||
register f32 fr2;
|
||||
register f32 fr01;
|
||||
register f32 fr00;
|
||||
asm {
|
||||
lis punit, PSMulUnit01@ha
|
||||
psq_l fr00, 0(vec), 0, 0
|
||||
addi punit, punit, PSMulUnit01@l
|
||||
psq_l fr2, 0(mtx), 0, 0
|
||||
psq_l unit, 0(punit), 0, 0
|
||||
psq_l fr01, 8(vec), 1, 0
|
||||
ps_add fr01, unit, fr01
|
||||
psq_l fr3, 8(mtx), 1, 0
|
||||
ps_mul fr4, fr2, fr00
|
||||
psq_l fr8, 12(mtx), 0, 0
|
||||
ps_madd fr5, fr3, fr01, fr4
|
||||
ps_sum0 fr6, fr5, fr6, fr5
|
||||
psq_l fr9, 20(mtx), 1, 0
|
||||
ps_mul fr10, fr8, fr00
|
||||
psq_st fr6, 0(dst), 1, 0
|
||||
ps_madd fr11, fr9, fr01, fr10
|
||||
psq_l fr2, 24(mtx), 0, 0
|
||||
ps_sum0 fr12, fr11, fr12, fr11
|
||||
psq_l fr3, 32(mtx), 1, 0
|
||||
ps_mul fr4, fr2, fr00
|
||||
psq_st fr12, 4(dst), 1, 0
|
||||
ps_madd fr5, fr3, fr01, fr4
|
||||
ps_sum0 fr6, fr5, fr6, fr5
|
||||
psq_st fr6, 8(dst), 1, 0
|
||||
}
|
||||
}
|
||||
|
||||
// regalloc issues
|
||||
inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec* dst) {
|
||||
register f32* punit;
|
||||
register f32 unit;
|
||||
register f32 fr6;
|
||||
register f32 fr5;
|
||||
register f32 fr4;
|
||||
register f32 fr3;
|
||||
register f32 fr2;
|
||||
register f32 fr01;
|
||||
register f32 fr00;
|
||||
asm {
|
||||
lis punit, PSMulUnit01@ha
|
||||
psq_l fr00, 0(vec), 0, 7
|
||||
addi punit, punit, PSMulUnit01@l
|
||||
psq_l fr2, 0(mtx), 0, 0
|
||||
psq_l unit, 0(punit), 0, 0
|
||||
psq_l fr01, 4(vec), 1, 7
|
||||
ps_add fr01, unit, fr01
|
||||
psq_l fr3, 8(mtx), 1, 0
|
||||
ps_mul fr4, fr2, fr00
|
||||
psq_l fr2, 12(mtx), 0, 0
|
||||
ps_madd fr5, fr3, fr01, fr4
|
||||
ps_sum0 fr6, fr5, fr6, fr5
|
||||
psq_l fr3, 20(mtx), 1, 0
|
||||
ps_mul fr4, fr2, fr00
|
||||
psq_st fr6, 0(dst), 1, 7
|
||||
ps_madd fr5, fr3, fr01, fr4
|
||||
psq_l fr2, 24(mtx), 0, 0
|
||||
ps_sum0 fr6, fr5, fr6, fr5
|
||||
psq_l fr3, 32(mtx), 1, 0
|
||||
ps_mul fr4, fr2, fr00
|
||||
psq_st fr6, 2(dst), 1, 7
|
||||
ps_madd fr5, fr3, fr01, fr4
|
||||
ps_sum0 fr6, fr5, fr6, fr5
|
||||
psq_st fr6, 4(dst), 1, 7
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* J3DTRANSFORM_H */
|
||||
@@ -0,0 +1,122 @@
|
||||
#ifndef J3DVERTEX_H
|
||||
#define J3DVERTEX_H
|
||||
|
||||
#include "dolphin/gx/GXAttr.h"
|
||||
#include "dolphin/mtx/vec.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
typedef struct _GXColor GXColor;
|
||||
class J3DModel;
|
||||
class J3DAnmVtxColor;
|
||||
class J3DVertexBuffer;
|
||||
|
||||
struct J3DVtxColorCalc {
|
||||
/* 8032E180 */ void calc(J3DModel*);
|
||||
virtual void calc(J3DVertexBuffer*);
|
||||
|
||||
/* 0x0 */ void* vtable; // inlined vtable?
|
||||
/* 0x4 */ u32 mFlags;
|
||||
/* 0x8 */ J3DAnmVtxColor* mpVtxColor;
|
||||
};
|
||||
|
||||
class J3DVertexData {
|
||||
public:
|
||||
J3DVertexData();
|
||||
|
||||
void* getVtxPosArray() const { return mVtxPosArray; }
|
||||
void* getVtxNrmArray() const { return mVtxNrmArray; }
|
||||
GXColor* getVtxColorArray(u8 idx) const { return mVtxColorArray[idx]; }
|
||||
void* getVtxTexCoordArray(u8 idx) const { return mVtxTexCoordArray[idx]; }
|
||||
void* getVtxNBTArray() const { return mVtxNBTArray; }
|
||||
u32 getNrmNum() const { return mNrmNum; }
|
||||
u32 getVtxNum() const { return mVtxNum; }
|
||||
GXVtxAttrFmtList* getVtxAttrFmtList() { return mVtxAttrFmtList; }
|
||||
u8 getVtxPosFrac() { return mVtxPosFrac; }
|
||||
u8 getVtxNrmFrac() { return mVtxNrmFrac; }
|
||||
int getVtxPosType() { return mVtxPosType; }
|
||||
int getVtxNrmType() { return mVtxNrmType; }
|
||||
|
||||
void setVtxPosFrac(u8 frac) { mVtxPosFrac = frac; }
|
||||
void setVtxPosType(GXCompType type) { mVtxPosType = type; }
|
||||
void setVtxNrmFrac(u8 frac) { mVtxNrmFrac = frac; }
|
||||
void setVtxNrmType(GXCompType type) { mVtxNrmType = type; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ u32 mVtxNum;
|
||||
/* 0x04 */ u32 mNrmNum;
|
||||
/* 0x08 */ u32 mColNum;
|
||||
/* 0x0C */ u32 mTexCoordNum;
|
||||
/* 0x10 */ u32 mPacketNum;
|
||||
/* 0x14 */ GXVtxAttrFmtList* mVtxAttrFmtList;
|
||||
/* 0x18 */ void* mVtxPosArray;
|
||||
/* 0x1C */ void* mVtxNrmArray;
|
||||
/* 0x20 */ void* mVtxNBTArray;
|
||||
/* 0x24 */ GXColor* mVtxColorArray[2];
|
||||
/* 0x2C */ void* mVtxTexCoordArray[8];
|
||||
/* 0x4C */ u8 mVtxPosFrac;
|
||||
/* 0x50 */ GXCompType mVtxPosType;
|
||||
/* 0x54 */ u8 mVtxNrmFrac;
|
||||
/* 0x58 */ GXCompType mVtxNrmType;
|
||||
};
|
||||
|
||||
class J3DVertexBuffer {
|
||||
public:
|
||||
J3DVertexBuffer() { init(); }
|
||||
|
||||
/* 80310F78 */ void setVertexData(J3DVertexData*);
|
||||
/* 80310FD8 */ void init();
|
||||
/* 80311030 */ ~J3DVertexBuffer();
|
||||
/* 8031106C */ void setArray() const;
|
||||
/* 80311090 */ s32 copyLocalVtxPosArray(u32);
|
||||
/* 803111B0 */ s32 copyLocalVtxNrmArray(u32);
|
||||
/* 803112D0 */ s32 copyLocalVtxArray(u32);
|
||||
/* 80311478 */ s32 allocTransformedVtxPosArray();
|
||||
/* 8031152C */ s32 allocTransformedVtxNrmArray();
|
||||
|
||||
void setCurrentVtxPos(void* pVtxPos) { mCurrentVtxPos = pVtxPos; }
|
||||
void* getCurrentVtxPos() { return mCurrentVtxPos; }
|
||||
|
||||
void setCurrentVtxNrm(void* pVtxNrm) { mCurrentVtxNrm = pVtxNrm; }
|
||||
void* getCurrentVtxNrm() { return mCurrentVtxNrm; }
|
||||
|
||||
void setCurrentVtxCol(GXColor* pVtxCol) { mCurrentVtxCol = pVtxCol; }
|
||||
|
||||
void frameInit() {
|
||||
setCurrentVtxPos(mVtxPosArray[0]);
|
||||
setCurrentVtxNrm(mVtxNrmArray[0]);
|
||||
setCurrentVtxCol(mVtxColArray[0]);
|
||||
}
|
||||
|
||||
void* getTransformedVtxPos(int idx) { return mTransformedVtxPosArray[idx]; }
|
||||
void* getTransformedVtxNrm(int idx) { return mTransformedVtxNrmArray[idx]; }
|
||||
J3DVertexData* getVertexData() { return mVtxData; }
|
||||
|
||||
void swapTransformedVtxPos() {
|
||||
void* tmp = mTransformedVtxPosArray[0];
|
||||
mTransformedVtxPosArray[0] = mTransformedVtxPosArray[1];
|
||||
mTransformedVtxPosArray[1] = tmp;
|
||||
}
|
||||
|
||||
void swapTransformedVtxNrm() {
|
||||
void* tmp = mTransformedVtxNrmArray[0];
|
||||
mTransformedVtxNrmArray[0] = mTransformedVtxNrmArray[1];
|
||||
mTransformedVtxNrmArray[1] = tmp;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x00 */ J3DVertexData* mVtxData;
|
||||
/* 0x04 */ void* mVtxPosArray[2];
|
||||
/* 0x0C */ void* mVtxNrmArray[2];
|
||||
/* 0x14 */ GXColor* mVtxColArray[2];
|
||||
/* 0x1C */ void* mTransformedVtxPosArray[2];
|
||||
/* 0x24 */ void* mTransformedVtxNrmArray[2];
|
||||
/* 0x2C */ void* mCurrentVtxPos;
|
||||
/* 0x30 */ void* mCurrentVtxNrm;
|
||||
/* 0x34 */ GXColor* mCurrentVtxCol;
|
||||
}; // Size: 0x38
|
||||
|
||||
struct VertexNormal {
|
||||
Vec data;
|
||||
};
|
||||
|
||||
#endif /* J3DVERTEX_H */
|
||||
Reference in New Issue
Block a user