summaryrefslogtreecommitdiff
path: root/include/JSystem/J3DGraphBase
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2023-09-30 14:31:44 -0700
committerJasper St. Pierre <jstpierre@mecheye.net>2023-09-30 14:31:44 -0700
commit57e735af3911621ce9482d033697bd95cbfdf290 (patch)
tree48db9c89abe785cca7dcbe32e6ad985aaf655f05 /include/JSystem/J3DGraphBase
parenta85fb7c63ba10f6374eac3df3e42ff687cbb86ef (diff)
J3DMatBlock closer
Diffstat (limited to 'include/JSystem/J3DGraphBase')
-rw-r--r--include/JSystem/J3DGraphBase/J3DMatBlock.h25
1 files changed, 9 insertions, 16 deletions
diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h
index fb0b960f..42cd2084 100644
--- a/include/JSystem/J3DGraphBase/J3DMatBlock.h
+++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h
@@ -866,28 +866,21 @@ inline u32 setChanCtrlMacro(u8 enable, GXColorSrc ambSrc, GXColorSrc matSrc, u32
struct J3DColorChan {
J3DColorChan();
- GXAttnFn getAttnFn() {
- // Need a way to put this in sdata2 without affecting every single TU ever...
-
- // static const u8 attnFnTbl[] = { GX_AF_NONE, GX_AF_SPEC, GX_AF_NONE, GX_AF_SPOT, };
- // return GXAttnFn(attnFnTbl[mColorChanID >> 9 & 0x03]);
- return GXAttnFn(mColorChanID >> 9 & 0x03);
- }
- GXDiffuseFn getDiffuseFn() { return GXDiffuseFn(mColorChanID >> 7 & 3); }
- u8 getLightMask() { return ((mColorChanID >> 2 & 0x0f) | (mColorChanID >> 11 & 0x0f) << 4); }
+ GXAttnFn getAttnFn();
+ GXDiffuseFn getDiffuseFn() { return GXDiffuseFn(mChanCtrl >> 7 & 3); }
+ u8 getLightMask() { return ((mChanCtrl >> 2 & 0x0f) | (mChanCtrl >> 11 & 0x0f) << 4); }
void setLightMask(u8 param_1) {
- mColorChanID = (mColorChanID & ~0x3c) | ((param_1 & 0x0f) << 2);
- mColorChanID = (mColorChanID & ~0x7800) | ((param_1 & 0xf0) << 7);
+ mChanCtrl = (mChanCtrl & ~0x3c) | ((param_1 & 0x0f) << 2);
+ mChanCtrl = (mChanCtrl & ~0x7800) | ((param_1 & 0xf0) << 7);
}
- // bug? both enable and getMatSrc seem to use bit 0? enable should use bit 1
- GXColorSrc getMatSrc() { return GXColorSrc(mColorChanID >> 0 & 0x01); }
- GXColorSrc getAmbSrc() { return GXColorSrc(mColorChanID >> 6 & 0x01); }
- u8 getEnable() { return mColorChanID >> 0 & 0x01; }
+ GXColorSrc getMatSrc() { return GXColorSrc(mChanCtrl >> 0 & 0x01); }
+ GXColorSrc getAmbSrc() { return GXColorSrc(mChanCtrl >> 6 & 0x01); }
+ u8 getEnable() { return !!(mChanCtrl & 0x02); }
void load() {
J3DGDWrite_u32(setChanCtrlMacro(getEnable(), getAmbSrc(), getMatSrc(), getLightMask(), getDiffuseFn(), getAttnFn()));
}
- /* 0x0 */ u16 mColorChanID;
+ /* 0x0 */ u16 mChanCtrl;
};
class J3DColorBlock {