Exemplo n.º 1
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            m_Name                = reader.ReadNameA4();
            m_AnimationType       = reader.ReadInt32();
            m_Compressed          = reader.ReadBoolean();
            m_UseHighQualityCurve = reader.ReadBoolean();
            reader.ReadBytes(2);

            int numRCurves = reader.ReadInt32();

            m_RotationCurves = new List <QuaternionCurve>(numRCurves);
            for (int i = 0; i < numRCurves; i++)
            {
                m_RotationCurves.Add(new QuaternionCurve(stream));
            }

            int numCRCurves = reader.ReadInt32();

            m_CompressedRotationCurves = new List <CompressedAnimationCurve>(numCRCurves);
            for (int i = 0; i < numCRCurves; i++)
            {
                m_CompressedRotationCurves.Add(new CompressedAnimationCurve(stream));
            }

            int numPCurves = reader.ReadInt32();

            m_PositionCurves = new List <Vector3Curve>(numPCurves);
            for (int i = 0; i < numPCurves; i++)
            {
                m_PositionCurves.Add(new Vector3Curve(stream));
            }

            int numSCurves = reader.ReadInt32();

            m_ScaleCurves = new List <Vector3Curve>(numSCurves);
            for (int i = 0; i < numSCurves; i++)
            {
                m_ScaleCurves.Add(new Vector3Curve(stream));
            }

            int numFCurves = reader.ReadInt32();

            m_FloatCurves = new List <FloatCurve>(numFCurves);
            for (int i = 0; i < numFCurves; i++)
            {
                m_FloatCurves.Add(new FloatCurve(file, stream));
            }

            int numPtrCurves = reader.ReadInt32();

            m_PPtrCurves = new List <PPtrCurve>(numPtrCurves);
            for (int i = 0; i < numPtrCurves; i++)
            {
                m_PPtrCurves.Add(new PPtrCurve(file, stream));
            }

            m_SampleRate          = reader.ReadSingle();
            m_WrapMode            = reader.ReadInt32();
            m_Bounds              = new AABB(stream);
            m_MuscleClipSize      = reader.ReadUInt32();
            m_MuscleClip          = new ClipMuscleConstant(stream);
            m_ClipBindingConstant = new AnimationClipBindingConstant(file, stream);

            int numEvents = reader.ReadInt32();

            m_Events = new List <AnimationEvent>(numEvents);
            for (int i = 0; i < numEvents; i++)
            {
                m_Events.Add(new AnimationEvent(file, stream));
            }
        }
Exemplo n.º 2
0
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            m_Name = reader.ReadNameA4U8();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                m_Legacy = reader.ReadBoolean();
            }
            else
            {
                m_AnimationType = reader.ReadInt32();
            }
            m_Compressed          = reader.ReadBoolean();
            m_UseHighQualityCurve = reader.ReadBoolean();
            stream.Position      += file.VersionNumber >= AssetCabinet.VERSION_5_0_0 ? 1 : 2;
            if (m_Compressed)
            {
                Report.ReportLog("AnimationClip \"" + m_Name + "\" is compressed");
            }

            int numRCurves = reader.ReadInt32();

            m_RotationCurves = new List <QuaternionCurve>(numRCurves);
            for (int i = 0; i < numRCurves; i++)
            {
                m_RotationCurves.Add(new QuaternionCurve(stream, file.VersionNumber));
            }

            int numCRCurves = reader.ReadInt32();

            m_CompressedRotationCurves = new List <CompressedAnimationCurve>(numCRCurves);
            for (int i = 0; i < numCRCurves; i++)
            {
                m_CompressedRotationCurves.Add(new CompressedAnimationCurve(stream));
            }

            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                int numEulerCurves = reader.ReadInt32();
                m_EulerCurves = new List <Vector3Curve>(numEulerCurves);
                for (int i = 0; i < numEulerCurves; i++)
                {
                    m_EulerCurves.Add(new Vector3Curve(stream, file.VersionNumber));
                }
            }

            int numPCurves = reader.ReadInt32();

            m_PositionCurves = new List <Vector3Curve>(numPCurves);
            for (int i = 0; i < numPCurves; i++)
            {
                m_PositionCurves.Add(new Vector3Curve(stream, file.VersionNumber));
            }

            int numSCurves = reader.ReadInt32();

            m_ScaleCurves = new List <Vector3Curve>(numSCurves);
            for (int i = 0; i < numSCurves; i++)
            {
                m_ScaleCurves.Add(new Vector3Curve(stream, file.VersionNumber));
            }

            int numFCurves = reader.ReadInt32();

            m_FloatCurves = new List <FloatCurve>(numFCurves);
            for (int i = 0; i < numFCurves; i++)
            {
                m_FloatCurves.Add(new FloatCurve(file, stream));
            }

            int numPtrCurves = reader.ReadInt32();

            m_PPtrCurves = new List <PPtrCurve>(numPtrCurves);
            for (int i = 0; i < numPtrCurves; i++)
            {
                m_PPtrCurves.Add(new PPtrCurve(file, stream));
            }

            m_SampleRate          = reader.ReadSingle();
            m_WrapMode            = reader.ReadInt32();
            m_Bounds              = new AABB(stream);
            m_MuscleClipSize      = reader.ReadUInt32();
            m_MuscleClip          = new ClipMuscleConstant(stream, file.VersionNumber);
            m_ClipBindingConstant = new AnimationClipBindingConstant(stream, file.VersionNumber);

            int numEvents = reader.ReadInt32();

            m_Events = new List <AnimationEvent>(numEvents);
            for (int i = 0; i < numEvents; i++)
            {
                m_Events.Add(new AnimationEvent(stream, file.VersionNumber));
            }
        }