Exemplo n.º 1
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            RenderMode = IsModeShort(reader.Version) ? (ParticleSystemRenderMode)reader.ReadUInt16() : (ParticleSystemRenderMode)reader.ReadInt32();
            if (IsSortModeFirst(reader.Version))
            {
                SortMode = (ParticleSystemSortMode)reader.ReadUInt16();
            }

            if (IsReadMinParticleSize(reader.Version))
            {
                MinParticleSize = reader.ReadSingle();
            }
            MaxParticleSize     = reader.ReadSingle();
            CameraVelocityScale = reader.ReadSingle();
            VelocityScale       = reader.ReadSingle();
            LengthScale         = reader.ReadSingle();
            SortingFudge        = reader.ReadSingle();

            if (IsReadNormalDirection(reader.Version))
            {
                NormalDirection = reader.ReadSingle();
            }
            if (IsReadShadowBias(reader.Version))
            {
                ShadowBias = reader.ReadSingle();
            }
            if (!IsSortModeFirst(reader.Version))
            {
                SortMode = (ParticleSystemSortMode)reader.ReadInt32();
            }

            if (IsReadRenderAlignment(reader.Version))
            {
                RenderAlignment = (ParticleSystemRenderSpace)reader.ReadInt32();
                Pivot.Read(reader);
            }
            else
            {
                RenderAlignment = RenderMode == ParticleSystemRenderMode.Mesh ? ParticleSystemRenderSpace.Local : ParticleSystemRenderSpace.View;
            }
            if (IsReadFlip(reader.Version))
            {
                Flip.Read(reader);
            }

            if (IsReadUseCustomVertexStreams(reader.Version))
            {
                UseCustomVertexStreams = reader.ReadBoolean();
                if (IsReadEnableGPUInstancing(reader.Version))
                {
                    EnableGPUInstancing = reader.ReadBoolean();
                }
                if (IsReadApplyActiveColorSpace(reader.Version))
                {
                    ApplyActiveColorSpace = reader.ReadBoolean();
                }
                if (IsReadAllowRoll(reader.Version))
                {
                    AllowRoll = reader.ReadBoolean();
                }
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadVertexStreamMask(reader.Version))
            {
                int         vertexStreamMask = reader.ReadInt32();
                List <byte> vertexStreams    = new List <byte>(8);
                for (byte i = 0; i < 8; i++)
                {
                    if ((vertexStreamMask & (1 << i)) != 0)
                    {
                        vertexStreams.Add(i);
                    }
                }
                m_vertexStreams = vertexStreams.ToArray();
            }
            if (IsReadVertexStreams(reader.Version))
            {
                m_vertexStreams = reader.ReadByteArray();
                reader.AlignStream(AlignType.Align4);
            }

            Mesh.Read(reader);
            if (IsReadMeshes(reader.Version))
            {
                Mesh1.Read(reader);
                Mesh2.Read(reader);
                Mesh3.Read(reader);
            }
            if (IsReadMaskInteraction(reader.Version))
            {
                MaskInteraction = (SpriteMaskInteraction)reader.ReadInt32();
            }
        }