Esempio n. 1
0
                public FSKANode(ResNSW.BoneAnim b)
                {
                    Text = b.Name;

                    if (b.BaseData.Scale != Syroot.Maths.Vector3F.Zero)
                    {
                        sca = new Vector3(b.BaseData.Scale.X, b.BaseData.Scale.Y, b.BaseData.Scale.Z);
                    }
                    if (b.BaseData.Rotate != Syroot.Maths.Vector4F.Zero)
                    {
                        rot = new Vector4(b.BaseData.Rotate.X, b.BaseData.Rotate.Y, b.BaseData.Rotate.Z, b.BaseData.Rotate.W);
                    }
                    if (b.BaseData.Translate != Syroot.Maths.Vector3F.Zero)
                    {
                        pos = new Vector3(b.BaseData.Translate.X, b.BaseData.Translate.Y, b.BaseData.Translate.Z);
                    }

                    foreach (ResNSW.AnimCurve tr in b.Curves)
                    {
                        FSKATrack t = new FSKATrack();
                        t.flag = (int)tr.AnimDataOffset;
                        tracks.Add(t);

                        float tanscale = tr.Delta;
                        if (tanscale == 0)
                        {
                            tanscale = 1;
                        }

                        for (int i = 0; i < (ushort)tr.Frames.Length; i++)
                        {
                            if (tr.CurveType == ResNSW.AnimCurveType.Cubic)
                            {
                                int   framedata = (int)tr.Frames[i];
                                float keydata   = tr.Offset + ((tr.Keys[i, 0] * tr.Scale));
                                float keydata2  = tr.Offset + ((tr.Keys[i, 1] * tr.Scale));
                                float keydata3  = tr.Offset + ((tr.Keys[i, 2] * tr.Scale));
                                float keydata4  = tr.Offset + ((tr.Keys[i, 3] * tr.Scale));
                            }
                            if (tr.KeyType == ResNSW.AnimCurveKeyType.Int16)
                            {
                            }
                            else if (tr.KeyType == ResNSW.AnimCurveKeyType.Single)
                            {
                            }
                            else if (tr.KeyType == ResNSW.AnimCurveKeyType.SByte)
                            {
                            }
                            t.keys.Add(new FSKAKey()
                            {
                                frame = (int)tr.Frames[i],
                                unk1  = tr.Offset + ((tr.Keys[i, 0] * tr.Scale)),
                                unk2  = tr.Offset + ((tr.Keys[i, 1] * tr.Scale)),
                                unk3  = tr.Offset + ((tr.Keys[i, 2] * tr.Scale)),
                                unk4  = tr.Offset + ((tr.Keys[i, 3] * tr.Scale)),
                            });
                        }
                    }
                }
Esempio n. 2
0
            public FSKANodeWiiU(BoneAnim b)
            {
                Text = b.Name;

                // offset 1 is base positions
                //Console.WriteLine(off1.ToString("x"));
                if (b.BaseData.Scale != null && b.BaseData.Translate != null && b.BaseData.Rotate != null)
                {
                    sca = new Vector3(b.BaseData.Scale.X, b.BaseData.Scale.Y, b.BaseData.Scale.Z);
                    rot = new Vector3(b.BaseData.Rotate.X, b.BaseData.Rotate.Y, b.BaseData.Rotate.Z);
                    pos = new Vector3(b.BaseData.Translate.X, b.BaseData.Translate.Y, b.BaseData.Translate.Z);
                }
                else
                {
                    sca = new Vector3(1, 1, 1);
                    rot = new Vector3(0, 0, 0);
                    pos = new Vector3(0, 0, 0);
                }

                //       Console.WriteLine("Name = " + b.Name);

                foreach (AnimCurve tr in b.Curves)
                {
                    //  Console.WriteLine(tr.AnimDataOffset);

                    FSKATrack t = new FSKATrack();
                    t.flag = (int)tr.AnimDataOffset;
                    tracks.Add(t);



                    //     Console.WriteLine("Flag = " + (int)tr.AnimDataOffset + " Offset = " + tr.Offset + "  Scale = " + tr.Scale);


                    //   Console.WriteLine();

                    float tanscale = tr.Delta;
                    if (tanscale == 0)
                    {
                        tanscale = 1;
                    }

                    for (int i = 0; i < (ushort)tr.Frames.Length; i++)
                    {
                        if (tr.CurveType == AnimCurveType.Cubic)
                        {
                            int   framedata = (int)tr.Frames[i];
                            float keydata   = tr.Offset + ((tr.Keys[i, 0] * tr.Scale));
                            float keydata2  = tr.Offset + ((tr.Keys[i, 1] * tr.Scale));
                            float keydata3  = tr.Offset + ((tr.Keys[i, 2] * tr.Scale));
                            float keydata4  = tr.Offset + ((tr.Keys[i, 3] * tr.Scale));
                            //    Console.WriteLine($"{framedata} {keydata} {keydata2} {keydata3} {keydata4} ");
                            //     Console.WriteLine($"Raw Data = " + tr.Keys[i, 0]);
                        }

                        t.keys.Add(new FSKAKey()
                        {
                            frame = (int)tr.Frames[i],
                            unk1  = tr.Offset + ((tr.Keys[i, 0] * tr.Scale)),
                        });
                    }
                }
            }