Beispiel #1
0
        /// <summary>
        /// Writes the spline info into the current stream,
        /// advancing the current position by spline info's size.
        /// </summary>
        public static void WriteSplineInfo(this StreamHandler Writer, SplineInfo Info)
        {
            Writer.WriteUInt32((uint)Info.Flags);

            if ((Info.Flags & SplineFlags.FinalPoint) != SplineFlags.None)
            {
                Writer.WriteStruct <Vector3>(Info.FinalPoint);
            }

            if ((Info.Flags & SplineFlags.FinalTarget) != SplineFlags.None)
            {
                Writer.WriteGuid(Info.FinalGuid);
            }

            if ((Info.Flags & SplineFlags.FinalOrient) != SplineFlags.None)
            {
                Writer.WriteSingle(Info.FinalRotation);
            }

            Writer.WriteUInt32(Info.CurrentTime);
            Writer.WriteUInt32(Info.FullTime);
            Writer.WriteUInt32(Info.Unknown1);
            Writer.WriteSingle(Info.DurationMultiplier);
            Writer.WriteSingle(Info.UnknownFloat2);
            Writer.WriteSingle(Info.UnknownFloat3);
            Writer.WriteUInt32(Info.Unknown2);
            Writer.WriteInt32(Info.Points.Count);

            for (int i = 0; i < Info.Points.Count; ++i)
            {
                Writer.WriteStruct <Vector3>(Info.Points[i]);
            }

            Writer.WriteByte((byte)Info.SplineMode);
            Writer.WriteStruct <Vector3>(Info.EndPoint);
        }
Beispiel #2
0
        /// <summary>
        /// Writes the spline info into the current stream,
        /// advancing the current position by spline info's size.
        /// </summary>
        public static void WriteSplineInfo(this StreamHandler Writer, SplineInfo Info)
        {
            Writer.WriteUInt32((uint)Info.Flags);

            if ((Info.Flags & SplineFlags.FinalPoint) != SplineFlags.None)
                Writer.WriteStruct<Vector3>(Info.FinalPoint);

            if ((Info.Flags & SplineFlags.FinalTarget) != SplineFlags.None)
                Writer.WriteGuid(Info.FinalGuid);

            if ((Info.Flags & SplineFlags.FinalOrient) != SplineFlags.None)
                Writer.WriteSingle(Info.FinalRotation);

            Writer.WriteUInt32(Info.CurrentTime);
            Writer.WriteUInt32(Info.FullTime);
            Writer.WriteUInt32(Info.Unknown1);
            Writer.WriteSingle(Info.DurationMultiplier);
            Writer.WriteSingle(Info.UnknownFloat2);
            Writer.WriteSingle(Info.UnknownFloat3);
            Writer.WriteUInt32(Info.Unknown2);
            Writer.WriteInt32(Info.Points.Count);

            for (int i = 0; i < Info.Points.Count; ++i)
                Writer.WriteStruct<Vector3>(Info.Points[i]);

            Writer.WriteByte((byte)Info.SplineMode);
            Writer.WriteStruct<Vector3>(Info.EndPoint);
        }
Beispiel #3
0
        /// <summary>
        /// Reads the spline info from the current stream,
        /// advancing the current position by spline info's size.
        /// </summary>
        public static SplineInfo ReadSplineInfo(this StreamHandler Reader)
        {
            var info = new SplineInfo();

            var flags = info.Flags = (SplineFlags)Reader.ReadUInt32();

            if ((flags & SplineFlags.FinalPoint) != SplineFlags.None)
                info.FinalPoint = Reader.ReadVector3();

            if ((flags & SplineFlags.FinalTarget) != SplineFlags.None)
                info.FinalGuid = Reader.ReadGuid();

            if ((flags & SplineFlags.FinalOrient) != SplineFlags.None)
                info.FinalRotation = Reader.ReadSingle();

            info.CurrentTime = Reader.ReadUInt32();
            info.FullTime = Reader.ReadUInt32();
            info.Unknown1 = Reader.ReadUInt32();
            info.DurationMultiplier = Reader.ReadSingle();
            info.UnknownFloat2 = Reader.ReadSingle();
            info.UnknownFloat3 = Reader.ReadSingle();
            info.Unknown2 = Reader.ReadUInt32();
            int count = Reader.ReadInt32();

            var points = info.Points;
            points.Capacity = count;
            for (int i = 0; i < count; ++i)
                points.Add(Reader.ReadVector3());

            if ((flags & (SplineFlags.Flying | SplineFlags.CatMullRom)) != 0)
            {
                if ((flags & SplineFlags.Cyclic) != 0)
                {
                    points.RemoveAt(0);

                    if ((flags & SplineFlags.EnterCycle) != 0)
                        points.RemoveAt(0);

                    points.RemoveAt(points.Count - 1);
                    points.RemoveAt(points.Count - 1);
                }
                else
                {
                    points.RemoveAt(0);
                    points.RemoveAt(points.Count - 1);
                }
            }

            info.SplineMode = (SplineMode)Reader.ReadByte();
            info.EndPoint = Reader.ReadVector3();

            return info;
        }
Beispiel #4
0
        /// <summary>
        /// Reads the spline info from the current stream,
        /// advancing the current position by spline info's size.
        /// </summary>
        public static SplineInfo ReadSplineInfo(this StreamHandler Reader)
        {
            var info = new SplineInfo();

            var flags = info.Flags = (SplineFlags)Reader.ReadUInt32();

            if ((flags & SplineFlags.FinalPoint) != SplineFlags.None)
            {
                info.FinalPoint = Reader.ReadVector3();
            }

            if ((flags & SplineFlags.FinalTarget) != SplineFlags.None)
            {
                info.FinalGuid = Reader.ReadGuid();
            }

            if ((flags & SplineFlags.FinalOrient) != SplineFlags.None)
            {
                info.FinalRotation = Reader.ReadSingle();
            }

            info.CurrentTime        = Reader.ReadUInt32();
            info.FullTime           = Reader.ReadUInt32();
            info.Unknown1           = Reader.ReadUInt32();
            info.DurationMultiplier = Reader.ReadSingle();
            info.UnknownFloat2      = Reader.ReadSingle();
            info.UnknownFloat3      = Reader.ReadSingle();
            info.Unknown2           = Reader.ReadUInt32();
            int count = Reader.ReadInt32();

            var points = info.Points;

            points.Capacity = count;
            for (int i = 0; i < count; ++i)
            {
                points.Add(Reader.ReadVector3());
            }

            if ((flags & (SplineFlags.Flying | SplineFlags.CatMullRom)) != 0)
            {
                if ((flags & SplineFlags.Cyclic) != 0)
                {
                    points.RemoveAt(0);

                    if ((flags & SplineFlags.EnterCycle) != 0)
                    {
                        points.RemoveAt(0);
                    }

                    points.RemoveAt(points.Count - 1);
                    points.RemoveAt(points.Count - 1);
                }
                else
                {
                    points.RemoveAt(0);
                    points.RemoveAt(points.Count - 1);
                }
            }

            info.SplineMode = (SplineMode)Reader.ReadByte();
            info.EndPoint   = Reader.ReadVector3();

            return(info);
        }