41 void GXSetNumTexGens(u8 num);
42 void GXSetNumChans(u8 num);
43 void GXSetNumTevStages(u8 num);
44 void GXSetNumIndStages(u8 num);
45 void GXSetCullMode(GXCullMode mode);
47 u8 GXGetNumTexGens()
const {
48 return IsValid() ? ptr()->nTexGens : 0;
51 u8 GXGetNumChans()
const {
52 return IsValid() ? ptr()->nChans : 0;
55 u8 GXGetNumTevStages()
const {
56 return IsValid() ? ptr()->nTevs : 0;
59 u8 GXGetNumIndStages()
const {
60 return IsValid() ? ptr()->nInds : 0;
63 GXCullMode GXGetCullMode()
const {
64 return IsValid() ? ptr()->cullMode : GX_CULL_ALL;
137 void DCStore(
bool sync);
140 void CallDisplayList(u8 numGens,
bool sync)
const;
142 bool GXGetTexCoordGen2(GXTexCoordID
id, GXTexGenType* pFunc,
143 GXTexGenSrc* pParam, GXBool* pNormalize,
144 ulong* pPostMtx)
const;
145 void GXSetTexCoordGen2(GXTexCoordID
id, GXTexGenType func,
146 GXTexGenSrc param, GXBool normalize, ulong postMtx);
239 bool GetEffectMtx(ulong
id,
math::MTX34* pMtx)
const;
240 bool SetEffectMtx(ulong
id,
const math::MTX34* pMtx);
242 bool GetMapMode(ulong
id, ulong* pMode,
int* pCamRef,
int* pLightRef)
const;
243 bool SetMapMode(ulong
id, ulong mode,
int camRef,
int lightRef);
245 TexSrt::Flag GetTexSrtFlag(ulong
id)
const {
246 return static_cast<TexSrt::Flag
>(
247 (ref().flag >>
id * TexSrt::NUM_OF_FLAGS) &
248 (TexSrt::FLAG_ANM_EXISTS | TexSrt::FLAG_SCALE_ONE |
249 TexSrt::FLAG_ROT_ZERO | TexSrt::FLAG_TRANS_ZERO));
252 bool IsExist(ulong
id)
const {
254 return ptr()->flag & (1 <<
id * TexSrt::NUM_OF_FLAGS);
260 bool IsIdentity(ulong
id)
const {
261 return (((ref().flag >>
id * TexSrt::NUM_OF_FLAGS) &
262 TexSrt::FLAGSET_IDENTITY) == TexSrt::FLAGSET_IDENTITY) &&
263 (ref().effect[id].misc_flag & TexMtxEffect::FLAG_IDENT);
266 TexSrtTypedef::TexMatrixMode GetTexMtxMode()
const {
267 return ref().texMtxMode;
280 FLAG_MAT_COLOR_ENABLE = (1 << 0),
281 FLAG_MAT_ALPHA_ENABLE = (1 << 1),
283 FLAG_AMB_COLOR_ENABLE = (1 << 2),
284 FLAG_AMB_ALPHA_ENABLE = (1 << 3),
286 FLAG_CTRL_COLOR_ENABLE = (1 << 4),
287 FLAG_CTRL_ALPHA_ENABLE = (1 << 5),
293 ulong paramChanCtrlC;
294 ulong paramChanCtrlA;
307 bool GXGetChanMatColor(GXChannelID
id, GXColor* pColor)
const;
308 void GXSetChanMatColor(GXChannelID
id, GXColor color);
310 bool GXGetChanAmbColor(GXChannelID
id, GXColor* pColor)
const;
311 void GXSetChanAmbColor(GXChannelID
id, GXColor color);
313 bool GXGetChanCtrl(GXChannelID
id, GXBool* pEnable, GXColorSrc* pAmbSrc,
314 GXColorSrc* pMatSrc, GXLightID* pLightMask,
315 GXDiffuseFn* pDiffuseFn, GXAttnFn* pAttnFn)
const;
316 void GXSetChanCtrl(GXChannelID
id, GXBool enable, GXColorSrc ambSrc,
317 GXColorSrc matSrc, GXLightID lightMask,
318 GXDiffuseFn diffuseFn, GXAttnFn attnFn);
346 void DCStore(
bool sync);
349 void CallDisplayList(
bool sync)
const;
351 bool GXGetAlphaCompare(GXCompare* pComp0, u8* pRef0, GXAlphaOp* pLogic,
352 GXCompare* pComp1, u8* pRef1)
const;
353 void GXSetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp logic,
354 GXCompare comp1, u8 ref1);
356 bool GXGetZMode(GXBool* pTest, GXCompare* pCompare, GXBool* pUpdate)
const;
357 void GXSetZMode(GXBool test, GXCompare compare, GXBool update);
359 bool GXGetBlendMode(GXBlendMode* pMode, GXBlendFactor* pSrcFactor,
360 GXBlendFactor* pDstFactor, GXLogicOp* pLogic)
const;
361 void GXSetBlendMode(GXBlendMode mode, GXBlendFactor srcFactor,
362 GXBlendFactor dstFactor, GXLogicOp logic);
364 bool GXGetDstAlpha(GXBool* pEnable, u8* pAlpha)
const;
365 void GXSetDstAlpha(GXBool enable, u8 alpha);
394 void DCStore(
bool sync);
397 void CallDisplayList(
bool sync)
const;
399 bool GXGetTevColor(GXTevRegID
id, GXColor* pColor)
const;
400 void GXSetTevColor(GXTevRegID
id, GXColor color);
402 bool GXGetTevColorS10(GXTevRegID
id, GXColorS10* pColor)
const;
403 void GXSetTevColorS10(GXTevRegID
id, GXColorS10 color);
405 bool GXGetTevKColor(GXTevKColorID
id, GXColor* pColor)
const;
406 void GXSetTevKColor(GXTevKColorID
id, GXColor color);
421 u8 indTexCoordScale[2][GX_BP_CMD_SZ];
422 u8 indTexMtx0[GX_BP_CMD_SZ * 3];
423 u8 PADDING_0x19[32 - 0x19];
424 u8 indTexMtx1[GX_BP_CMD_SZ * 3];
425 u8 indTexMtx2[GX_BP_CMD_SZ * 3];
426 u8 PADDING_0x3E[64 - 0x3E];
542class ResMat :
public ResCommon<ResMatData> {
544 NW4R_G3D_RESOURCE_FUNC_DEF(
ResMat);
553 ulong GetID()
const {
568 ulong GetNumResTexPlttInfo()
const {
569 return ref().numResTexPlttInfo;
574 ofs_to_ptr<ResTexPlttInfoData>(ref().toResTexPlttInfo);
580 return ofs_to_ptr<ResMatDLData>(ref().toResMatDLData);
584 return ResMatPix(&GetResMatDLData()->dlPix);