public override void OnPopulate() { StageGroup *grp = Header->First; for (int r = 0; r < 8; r++, grp = grp->Next) { if (grp->mask.Reg == 0x61) { MDL0TEVStageNode s0 = new MDL0TEVStageNode(); KSel ksel = new KSel(grp->ksel.Data.Value); RAS1_TRef tref = new RAS1_TRef(grp->tref.Data.Value); s0._colorEnv = grp->eClrEnv.Data; s0._alphaEnv = grp->eAlpEnv.Data; s0._cmd = grp->eCMD.Data; s0._kcSel = ksel.KCSel0; s0._kaSel = ksel.KASel0; s0._texMapID = tref.TexMapID0; s0._texCoord = tref.TexCoord0; s0._colorChan = tref.ColorChannel0; s0._texEnabled = tref.TexEnabled0; s0._parent = this; _children.Add(s0); if (grp->oClrEnv.Reg == 0x61 && grp->oAlpEnv.Reg == 0x61 && grp->oCMD.Reg == 0x61) { MDL0TEVStageNode s1 = new MDL0TEVStageNode(); s1._colorEnv = grp->oClrEnv.Data; s1._alphaEnv = grp->oAlpEnv.Data; s1._cmd = grp->oCMD.Data; s1._kcSel = ksel.KCSel1; s1._kaSel = ksel.KASel1; s1._texMapID = tref.TexMapID1; s1._texCoord = tref.TexCoord1; s1._colorChan = tref.ColorChannel1; s1._texEnabled = tref.TexEnabled1; s1._parent = this; _children.Add(s1); } } } }
public void Default(bool change) { _ref0 = _ref1 = _ref2 = _ref3 = _ref4 = _ref5 = _ref6 = _ref7 = -1; MDL0TEVStageNode stage = new MDL0TEVStageNode(); AddChild(stage, change); }
public void DefaultAsMetal(int texcount) { _autoMetal = true; _ref0 = _ref1 = _ref2 = _ref3 = _ref4 = _ref5 = _ref6 = _ref7 = -1; switch ((_texCount = texcount) - 1) { case 0: _ref0 = 0; break; case 1: _ref1 = 1; break; case 2: _ref2 = 2; break; case 3: _ref3 = 3; break; case 4: _ref4 = 4; break; case 5: _ref5 = 5; break; case 6: _ref6 = 6; break; case 7: _ref7 = 7; break; } Children.Clear(); int i = 0; MDL0TEVStageNode s; while (i++ < 4) { AddChild(s = new MDL0TEVStageNode()); s.DefaultAsMetal(texcount - 1); } }
public override void OnRebuild(VoidPtr address, int length, bool force) { MDL0Shader *header = (MDL0Shader *)address; header->_dataLength = length; header->_index = Index; header->_stages = Stages; header->_ref0 = _ref0; header->_ref1 = _ref1; header->_ref2 = _ref2; header->_ref3 = _ref3; header->_ref4 = _ref4; header->_ref5 = _ref5; header->_ref6 = _ref6; header->_ref7 = _ref7; header->_pad0 = 0; header->_pad1 = 0; header->_pad2 = 0; header->_pad3 = 0; header->_pad4 = 0; *header->SwapBlock = _swapBlock; StageGroup *grp = (StageGroup *)(address + 0x80); for (int i = 0; i < Children.Count; i++) { MDL0TEVStageNode c = (MDL0TEVStageNode)Children[i]; //Current Stage if (i % 2 == 0) //Even Stage { *grp = StageGroup.Default; grp->SetGroup(i / 2); grp->SetStage(i); grp->eClrEnv.Data = c._colorEnv; grp->eAlpEnv.Data = c._alphaEnv; grp->eCMD.Data = c._cmd; if (i == Children.Count - 1) //Last stage is even, odd stage isn't used { grp->ksel.Data = new KSel(0, 0, c._kcSel, c._kaSel, 0, 0); grp->tref.Data = new RAS1_TRef(c._texMapID, c._texCoord, c._texEnabled, c._colorChan, TexMapID.TexMap7, TexCoordID.TexCoord7, false, ColorSelChan.Zero); } } else //Odd Stage { MDL0TEVStageNode p = (MDL0TEVStageNode)Children[i - 1]; //Previous Stage grp->SetStage(i); grp->oClrEnv.Data = c._colorEnv; grp->oAlpEnv.Data = c._alphaEnv; grp->oCMD.Data = c._cmd; grp->ksel.Data = new KSel(0, 0, p._kcSel, p._kaSel, c._kcSel, c._kaSel); grp->tref.Data = new RAS1_TRef(p._texMapID, p._texCoord, p._texEnabled, p._colorChan, c._texMapID, c._texCoord, c._texEnabled, c._colorChan); grp = grp->Next; } } }