Ejemplo n.º 1
0
        public override void getValues()
        {
            KSel data = new KSel(_rawValue);

            xrb    = 0; //data.XRB;
            xga    = 0; //data.XGA;
            kcsel0 = data.KCSEL0;
            kasel0 = data.KASEL0;
            kcsel1 = data.KCSEL1;
            kasel1 = data.KASEL1;
        }
Ejemplo n.º 2
0
        protected override void OnPopulate()
        {
            StageGroup *grp    = Header->First;
            int         offset = 0x80; //There are 8 groups max

            for (int r = 0; r < 8; r++, grp = grp->Next, offset += 0x30)
            {
                if (((byte *)Header)[offset] == 0x61)
                {
                    TEVStage s0 = new TEVStage(r * 2);

                    KSel      KSEL = new KSel(grp->ksel.Data.Value);
                    RAS1_TRef TREF = new RAS1_TRef(grp->tref.Data.Value);

                    s0.rawColEnv   = grp->eClrEnv.Data.Value;
                    s0.rawAlphaEnv = grp->eAlpEnv.Data.Value;
                    s0.rawCMD      = grp->eCMD.Data.Value;

                    s0.kcsel = KSEL.KCSEL0;
                    s0.kasel = KSEL.KASEL0;

                    s0.ti = TREF.TI0;
                    s0.tc = TREF.TC0;
                    s0.cc = TREF.CC0;
                    s0.te = TREF.TE0;

                    s0.getValues();
                    AddChild(s0, false);

                    if (grp->oClrEnv.Reg == 0x61 && grp->oAlpEnv.Reg == 0x61 && grp->oCMD.Reg == 0x61)
                    {
                        TEVStage s1 = new TEVStage(r * 2 + 1);

                        s1.rawColEnv   = grp->oClrEnv.Data.Value;
                        s1.rawAlphaEnv = grp->oAlpEnv.Data.Value;
                        s1.rawCMD      = grp->oCMD.Data.Value;

                        s1.kcsel = KSEL.KCSEL1;
                        s1.kasel = KSEL.KASEL1;

                        s1.ti = TREF.TI1;
                        s1.tc = TREF.TC1;
                        s1.cc = TREF.CC1;
                        s1.te = TREF.TE1;

                        s1.getValues();
                        AddChild(s1, false);
                    }

                    //new MDL0ShaderStructNode().Initialize(this, grp, StageGroup.Size);
                }
            }
        }
Ejemplo n.º 3
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void getRawValue()
 {
     _rawValue = KSel.Shift(0, 0, kcsel0, kasel0, kcsel1, kasel1);
     SignalPropertyChange();
 }
Ejemplo n.º 5
0
        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;
                }
            }
        }
        public override void OnPopulate()
        {
            StageGroup* grp = Header->First;
            for (int r = 0; r < 8; r++, grp = grp->Next)
                if (grp->mask.Reg == 0x61)
                {
                    TEVStage s0 = new TEVStage();

                    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;

                    AddChild(s0, false);

                    if (grp->oClrEnv.Reg == 0x61 && grp->oAlpEnv.Reg == 0x61 && grp->oCMD.Reg == 0x61)
                    {
                        TEVStage s1 = new TEVStage();

                        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;

                        AddChild(s1, false);
                    }
                }
        }