private void getRawValue() { _rawValue = KSel.Shift(0, 0, kcsel0, kasel0, kcsel1, kasel1); SignalPropertyChange(); }
protected internal override void OnRebuild(VoidPtr address, int length, bool force) { MDL0Shader *header = (MDL0Shader *)address; if (Model._isImport) { ref1 = ref2 = ref3 = ref4 = ref5 = ref6 = ref7 = -1; if (Model._importOptions._mdlType == 0) { stages = 3; } else { stages = 1; } } header->_dataLength = length; header->_index = Index; header->_stages = Model._isImport ? stages : (byte)Children.Count; header->_res0 = res0; header->_res1 = res1; header->_res2 = res2; 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 = pad0; header->_pad1 = pad1; *header->SwapBlock = _swapBlock; //int offset = 0x80; //foreach (MDL0ShaderStructNode s in Children) //{ // s.Rebuild(address + offset, 0x30, force); // offset += 0x30; //} StageGroup *grp = (StageGroup *)(address + 0x80); for (int i = 0; i < Children.Count; i++) { TEVStage c = (TEVStage)Children[i]; //Current Stage if (i % 2 == 0) //Even Stage { *grp = StageGroup.Default; grp->SetGroup(i / 2); grp->SetStage(i); grp->eClrEnv.Data.Value = c.rawColEnv; grp->eAlpEnv.Data.Value = c.rawAlphaEnv; grp->eCMD.Data.Value = c.rawCMD; if (i == Children.Count - 1) //Last stage is even, odd stage isn't used { grp->ksel.Data.Value = KSel.Shift(0, 0, c.kcsel, c.kasel, 0, 0); grp->tref.Data.Value = RAS1_TRef.Shift(c.ti, c.tc, c.te ? 1 : 0, c.cc, 7, 7, 0, 7); } } else //Odd Stage { TEVStage p = (TEVStage)Children[i - 1]; //Previous Stage grp->SetStage(i); grp->oClrEnv.Data.Value = c.rawColEnv; grp->oAlpEnv.Data.Value = c.rawAlphaEnv; grp->oCMD.Data.Value = c.rawCMD; grp->ksel.Data.Value = KSel.Shift(0, 0, p.kcsel, p.kasel, c.kcsel, c.kasel); grp->tref.Data.Value = RAS1_TRef.Shift(p.ti, p.tc, p.te ? 1 : 0, p.cc, c.ti, c.tc, c.te ? 1 : 0, c.cc); grp = grp->Next; } } if (Model._isImport) { StageGroup *struct0 = header->First; * struct0 = StageGroup.Default; struct0->SetGroup(0); switch (Model._importOptions._mdlType) { case 0: //Character struct0->SetStage(0); struct0->SetStage(1); struct0->mask.Data.Value = 0xFFFFF0; struct0->ksel.Data.Value = 0xE378C0; struct0->tref.Data.Value = 0x03F040; struct0->eClrEnv.Data.Value = 0x28F8AF; struct0->oClrEnv.Data.Value = 0x08FEB0; struct0->eAlpEnv.Data.Value = 0x08F2F0; struct0->oAlpEnv.Data.Value = 0x081FF0; //new MDL0ShaderStructNode().Initialize(this, header->First, StageGroup.Size); StageGroup *struct1 = struct0->Next; * struct1 = StageGroup.Default; struct1->SetGroup(1); struct1->SetStage(2); struct1->mask.Data.Value = 0xFFFFF0; struct1->ksel.Data.Value = 0x0038C0; struct1->tref.Data.Value = 0x3BF3BF; struct1->eClrEnv.Data.Value = 0x0806EF; struct1->eAlpEnv.Data.Value = 0x081FF0; //new MDL0ShaderStructNode().Initialize(this, struct0->Next, StageGroup.Size); break; case 1: //Stage/Item struct0->SetStage(0); struct0->mask.Data.Value = 0xFFFFF0; struct0->ksel.Data.Value = 0x0038C0; struct0->tref.Data.Value = 0x3BF040; struct0->eClrEnv.Data.Value = 0x28F8AF; struct0->eAlpEnv.Data.Value = 0x08F2F0; //new MDL0ShaderStructNode().Initialize(this, header->First, StageGroup.Size); break; } } }