Beispiel #1
0
        /// <summary>
        /// 0x10
        /// </summary>
        /// <param name="input"></param>
        /// <param name="name"></param>
        private SkelPierceTrackSet FragSkelTrackSet(BinaryReader input, string name)
        {
            var flags      = input.ReadUInt32();
            var trackcount = input.ReadUInt32();

            // We weren't using the output.  Not sure why this is here?
            GetFrag(input.ReadInt32());

            if (0 != (flags & 1))
            {
                input.ReadUInt32(3);
            }

            if (0 != (flags & 2))
            {
                input.ReadSingle();
            }

            var trackSet = new SkelPierceTrackSet(trackcount, name);

            var allMeshes = new List <int>();

            for (var i = 0; i < trackcount; i++)
            {
                var track = new SkelPierceTrack
                {
                    Name        = _stringTableHash[-input.ReadInt32()],
                    flags       = input.ReadUInt32(),
                    pierceTrack = GetFrag(input.ReadInt32())
                };

                allMeshes.Add(input.ReadInt32());
                track.NextPieces   = input.ReadInt32(input.ReadUInt32());
                trackSet.Tracks[i] = track;
            }

            var meshes = new List <FragRef>();

            if (0 != (flags & 0x200))
            {
                meshes.AddRange(GetFrag(input.ReadInt32(input.ReadUInt32())));
            }
            else
            {
                for (var i = 0; i < allMeshes.Count(); i++)
                {
                    if (0 != allMeshes[i])
                    {
                        meshes.AddRange(GetFrag(allMeshes[i]));
                    }
                }
            }

            trackSet.Meshes = meshes;
            return(trackSet);
        }
Beispiel #2
0
        private AniTree BuildAniTree(SkelPierceTrackSet skeleton, string prefix, int idx)
        {
            var track       = skeleton.Tracks[idx];
            var piercetrack = (SkelPierceTrack)track.pierceTrack[0].Value;

            if ("" != prefix && this.names.ContainsKey($"{prefix}{piercetrack.Name}"))
            {
                piercetrack = (SkelPierceTrack)names[$"{prefix}{piercetrack.Name}"];
            }

            var children = new List <AniTree>();

            foreach (var x in track.NextPieces)
            {
                children.Add(BuildAniTree(skeleton, prefix, x));
            }

            return(new AniTree(idx, (Frame[])piercetrack.pierceTrack[0].Value, children));
        }