Esempio 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();
            }
        }
		public override void Read(AssetStream stream)
		{
			base.Read(stream);

			if (IsModeShort(stream.Version))
			{
				RenderMode = stream.ReadUInt16();
			}
			else
			{
				RenderMode = stream.ReadInt32();
			}
			if (IsSortModeFirst(stream.Version))
			{
				SortMode = stream.ReadUInt16();
			}

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

			if (IsReadNormalDirection(stream.Version))
			{
				NormalDirection = stream.ReadSingle();
			}
			if (!IsSortModeFirst(stream.Version))
			{
				SortMode = stream.ReadInt32();
			}

			if (IsReadRenderAlignment(stream.Version))
			{
				RenderAlignment = stream.ReadInt32();
				Pivot.Read(stream);
			}
			if (IsReadUseCustomVertexStreams(stream.Version))
			{
				UseCustomVertexStreams = stream.ReadBoolean();
				stream.AlignStream(AlignType.Align4);
			}
			if (IsReadVertexStreamMask(stream.Version))
			{
				VertexStreamMask = stream.ReadInt32();
			}
			if (IsReadVertexStreams(stream.Version))
			{
				m_vertexStreams = stream.ReadByteArray();
				stream.AlignStream(AlignType.Align4);
			}

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