Пример #1
0
            public void ReadVIS(BFRES.MTA mta, Syroot.NintenTools.NSW.Bfres.VisibilityAnim vis)
            {
                mta.Text       = vis.Name;
                mta.FrameCount = (uint)vis.FrameCount;

                int boneindx = 0;

                if (vis.Names != null)
                {
                    foreach (string nm in vis.Names) //Loop through every bone. Not all have base and curve data
                    {
                        MatAnimEntry bone = new MatAnimEntry();
                        bone.Text = vis.Names[boneindx];

                        if (vis.BaseDataList == null)
                        {
                            vis.BaseDataList = new bool[0];
                        }

                        if (boneindx < vis.BaseDataList.Length)
                        {
                            MatAnimData md = new MatAnimData();

                            bool bas = vis.BaseDataList[boneindx];
                            md.VIS_State = bas;
                            md.Frame     = 0;

                            bone.matCurves.Add(md);
                        }


                        if (vis.Curves.Count != 0)
                        {
                            if (boneindx < vis.Curves.Count)
                            {
                                Syroot.NintenTools.NSW.Bfres.AnimCurve cr = vis.Curves[boneindx];


                                int frm = 0;
                                foreach (bool bn in cr.KeyStepBoolData)
                                {
                                    BFRES.MatAnimData md = new BFRES.MatAnimData();
                                    md.Frame     = (int)cr.Frames[frm];
                                    md.VIS_State = bn;

                                    bone.matCurves.Add(md);
                                    frm++;
                                }
                            }
                        }
                        mta.matEntries.Add(bone);

                        boneindx++;
                    }
                }
            }
Пример #2
0
        public BFRES_MTA(MaterialAnim vis)
        {
            ImageKey         = "image";
            SelectedImageKey = "image";


            Text = vis.Name;

            FrameCount = (uint)vis.FrameCount;

            foreach (MaterialAnimData matanim in vis.MaterialAnimDataList)
            {
                MatAnimEntry mat = new MatAnimEntry();

                FMAANode matnode = new FMAANode(matanim);

                mat.Text = matanim.Name;

                for (int Frame = 0; Frame < vis.FrameCount; Frame++)
                {
                    int CurTrack = 0;
                    foreach (FMAATrack track in matnode.tracks)
                    {
                        MatAnimData md = new MatAnimData();

                        float value;

                        if (matanim.Curves[CurTrack].CurveType == AnimCurveType.Cubic)
                        {
                            FMAAKey left  = track.GetLeft(Frame);
                            FMAAKey right = track.GetRight(Frame);

                            value = Animation.Hermite(Frame, left.frame, right.frame, 0, 0, left.unk1, right.unk1);

                            md.keys.Add(value);
                        }


                        mat.matCurves.Add(md);
                        CurTrack++;
                    }
                }

                matEntries.Add(mat);
            }
        }
Пример #3
0
            public BFRES_FSHU(MTA mta, ShaderParamAnim fshu, ResFile b)
            {
                mta.Text = fshu.Name;

                mta.FrameCount = (uint)fshu.FrameCount;

                foreach (ShaderParamMatAnim matanim in fshu.ShaderParamMatAnims)
                {
                    MatAnimEntry mat = new MatAnimEntry();

                    mat.Text = matanim.Name;
                    Console.WriteLine($"MatAnim = {mat.Text}");
                    Console.WriteLine($"Curve Count = {matanim.Curves.Count}");

                    if (matanim.Curves.Count == 0)
                    {
                    }

                    //First set the data then iterpolate
                    foreach (AnimCurve cr in matanim.Curves)
                    {
                        mat.InterpolateWU(cr);
                    }
                    mta.matEntries.Add(mat);



                    for (int Frame = 0; Frame < fshu.FrameCount; Frame++)
                    {
                        foreach (MatAnimData track in mat.matCurves)
                        {
                            AnimKey left  = track.GetLeft(Frame);
                            AnimKey right = track.GetRight(Frame);

                            track.Value = Animation.Hermite(Frame, left.frame, right.frame, 0, 0, left.unk1, right.unk1);
                        }
                    }

                    int CurCurve = 0;
                    for (int Frame = 0; Frame < fshu.FrameCount; Frame++)
                    {
                        foreach (MatAnimData track in mat.matCurves)
                        {
                            //This works like this
                            //Each param has their own info. While this loop through each curve determine which data is which
                            //Set the param name. Then detemine the data in between begin curve and total count
                            //Example. Begin curve starts at 0. Count may be 3 for RGB values
                            //Then for next curve would start at 3 and so on
                            //For color I simply use the values starting from RGBA
                            //Then for the next param i subtract the start value to reset the index back to 0
                            foreach (ParamAnimInfo inf in matanim.ParamAnimInfos)
                            {
                                track.shaderParamName = inf.Name;

                                if (inf.BeginCurve >= CurCurve)
                                {
                                    if (inf.FloatCurveCount >= CurCurve)
                                    {
                                        int ColorIndex = CurCurve - inf.BeginCurve;

                                        track.AnimColorType = (MatAnimData.ColorType)ColorIndex;
                                    }
                                }
                            }
                        }
                        CurCurve++;
                    }

                    mta.matEntries.Add(mat);
                }
            }