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

            Type = (ParticleSystemShapeType)reader.ReadInt32();
            if (HasRadiusSingle(reader.Version))
            {
                float radius = reader.ReadSingle();
                Radius = new MultiModeParameter(radius);
            }
            Angle = reader.ReadSingle();
            if (HasLength(reader.Version))
            {
                Length = reader.ReadSingle();
            }
            if (HasBoxAxes(reader.Version))
            {
                float boxX = reader.ReadSingle();
                float boxY = reader.ReadSingle();
                float boxZ = reader.ReadSingle();
                Scale = Type.IsBoxAny() ? new Vector3f(boxX, boxY, boxZ) : Vector3f.One;
            }
            if (HasArcSingle(reader.Version))
            {
                float arc = reader.ReadSingle();
                Arc = new MultiModeParameter(arc);
            }
            if (HasRadius(reader.Version))
            {
                if (HasRadiusFirst(reader.Version))
                {
                    Radius.Read(reader);
                    Arc.Read(reader);
                }
            }
            if (HasBoxThickness(reader.Version))
            {
                BoxThickness.Read(reader);
                RadiusThickness = reader.ReadSingle();
                DonutRadius     = reader.ReadSingle();
                Position.Read(reader);
                Rotation.Read(reader);
                Scale.Read(reader);
            }
            PlacementMode = (PlacementMode)reader.ReadInt32();
            if (HasMeshMaterialIndex(reader.Version))
            {
                if (HasMeshMaterialIndexFirst(reader.Version))
                {
                    MeshMaterialIndex = reader.ReadInt32();
                    MeshNormalOffset  = reader.ReadSingle();
                }
            }
            if (HasMeshSpawn(reader.Version))
            {
                MeshSpawn.Read(reader, false);
            }
            Mesh.Read(reader);
            if (HasMeshRenderer(reader.Version))
            {
                MeshRenderer.Read(reader);
                SkinnedMeshRenderer.Read(reader);
            }
            if (HasSprite(reader.Version))
            {
                Sprite.Read(reader);
                SpriteRenderer.Read(reader);
            }
            if (HasMeshMaterialIndex(reader.Version))
            {
                if (!HasMeshMaterialIndexFirst(reader.Version))
                {
                    MeshMaterialIndex = reader.ReadInt32();
                    MeshNormalOffset  = reader.ReadSingle();
                }
            }
            if (HasMeshScale(reader.Version))
            {
                float meshScale = reader.ReadSingle();
                Scale = new Vector3f(meshScale, meshScale, meshScale);
            }
            if (HasUseMeshMaterialIndex(reader.Version))
            {
                UseMeshMaterialIndex = reader.ReadBoolean();
                UseMeshColors        = reader.ReadBoolean();
            }
            if (HasAlignToDirection(reader.Version))
            {
                AlignToDirection = reader.ReadBoolean();
            }
            if (HasRandomDirection(reader.Version))
            {
                bool randomDirection = reader.ReadBoolean();
                RandomDirectionAmount = randomDirection ? 1.0f : 0.0f;
            }
            reader.AlignStream();

            if (HasTexture(reader.Version))
            {
                Texture.Read(reader);
                TextureClipChannel           = reader.ReadInt32();
                TextureClipThreshold         = reader.ReadSingle();
                TextureUVChannel             = reader.ReadInt32();
                TextureColorAffectsParticles = reader.ReadBoolean();
                TextureAlphaAffectsParticles = reader.ReadBoolean();
                TextureBilinearFiltering     = reader.ReadBoolean();
                reader.AlignStream();
            }

            if (HasRandomDirectionAmount(reader.Version))
            {
                RandomDirectionAmount    = reader.ReadSingle();
                SphericalDirectionAmount = reader.ReadSingle();
            }
            if (HasRandomPositionAmount(reader.Version))
            {
                RandomPositionAmount = reader.ReadSingle();
            }
            if (HasRadius(reader.Version))
            {
                if (!HasRadiusFirst(reader.Version))
                {
                    Radius.Read(reader);
                    Arc.Read(reader);
                }
            }
        }
Esempio n. 2
0
        public override void Read(AssetStream stream)
        {
            base.Read(stream);

            Type = (ParticleSystemShapeType)stream.ReadInt32();
            if (IsReadRadiusSingle(stream.Version))
            {
                RadiusSingle = stream.ReadSingle();
            }
            Angle = stream.ReadSingle();
            if (IsReadLength(stream.Version))
            {
                Length = stream.ReadSingle();
            }
            if (IsReadBoxAxes(stream.Version))
            {
                BoxX = stream.ReadSingle();
                BoxY = stream.ReadSingle();
                BoxZ = stream.ReadSingle();
            }
            if (IsReadArcSingle(stream.Version))
            {
                ArcSingle = stream.ReadSingle();
            }
            if (IsReadRadius(stream.Version))
            {
                if (IsReadRadiusFirst(stream.Version))
                {
                    Radius.Read(stream);
                    Arc.Read(stream);
                }
            }
            if (IsReadBoxThickness(stream.Version))
            {
                BoxThickness.Read(stream);
                RadiusThickness = stream.ReadSingle();
                DonutRadius     = stream.ReadSingle();
                Position.Read(stream);
                Rotation.Read(stream);
                Scale.Read(stream);
            }
            PlacementMode = stream.ReadInt32();
            if (IsReadMeshMaterialIndex(stream.Version))
            {
                if (IsReadMeshMaterialIndexFirst(stream.Version))
                {
                    MeshMaterialIndex = stream.ReadInt32();
                    MeshNormalOffset  = stream.ReadSingle();
                }
            }
            Mesh.Read(stream);
            if (IsReadMeshRenderer(stream.Version))
            {
                MeshRenderer.Read(stream);
                SkinnedMeshRenderer.Read(stream);
            }
            if (IsReadSprite(stream.Version))
            {
                Sprite.Read(stream);
                SpriteRenderer.Read(stream);
            }
            if (IsReadMeshMaterialIndex(stream.Version))
            {
                if (!IsReadMeshMaterialIndexFirst(stream.Version))
                {
                    MeshMaterialIndex = stream.ReadInt32();
                    MeshNormalOffset  = stream.ReadSingle();
                }
            }
            if (IsReadMeshScale(stream.Version))
            {
                MeshScale = stream.ReadSingle();
            }
            if (IsReadUseMeshMaterialIndex(stream.Version))
            {
                UseMeshMaterialIndex = stream.ReadBoolean();
                UseMeshColors        = stream.ReadBoolean();
            }
            if (IsReadAlignToDirection(stream.Version))
            {
                AlignToDirection = stream.ReadBoolean();
            }
            if (IsReadRandomDirection(stream.Version))
            {
                RandomDirection = stream.ReadBoolean();
            }
            stream.AlignStream(AlignType.Align4);

            if (IsReadTexture(stream.Version))
            {
                Texture.Read(stream);
                TextureClipChannel           = stream.ReadInt32();
                TextureClipThreshold         = stream.ReadSingle();
                TextureUVChannel             = stream.ReadInt32();
                TextureColorAffectsParticles = stream.ReadBoolean();
                TextureAlphaAffectsParticles = stream.ReadBoolean();
                TextureBilinearFiltering     = stream.ReadBoolean();
                stream.AlignStream(AlignType.Align4);
            }

            if (IsReadRandomDirectionAmount(stream.Version))
            {
                RandomDirectionAmount    = stream.ReadSingle();
                SphericalDirectionAmount = stream.ReadSingle();
            }
            if (IsReadRandomPositionAmount(stream.Version))
            {
                RandomPositionAmount = stream.ReadSingle();
            }
            if (IsReadRadius(stream.Version))
            {
                if (!IsReadRadiusFirst(stream.Version))
                {
                    Radius.Read(stream);
                    Arc.Read(stream);
                }
            }
        }
Esempio n. 3
0
        public override void Read(AssetStream stream)
        {
            base.Read(stream);

            Type = stream.ReadInt32();
            if (IsReadRadiusSingle(stream.Version))
            {
                RadiusSingle = stream.ReadSingle();
            }
            if (IsReadAngle(stream.Version))
            {
                Angle  = stream.ReadSingle();
                Length = stream.ReadSingle();
            }
            if (IsReadBoxAxes(stream.Version))
            {
                BoxX = stream.ReadSingle();
                BoxY = stream.ReadSingle();
                BoxZ = stream.ReadSingle();
            }
            if (IsReadArcSingle(stream.Version))
            {
                ArcSingle = stream.ReadSingle();
            }
            if (IsReadRadius(stream.Version))
            {
                if (IsReadRadiusFirst(stream.Version))
                {
                    Radius.Read(stream);
                    Arc.Read(stream);
                }
            }
            if (IsReadBoxThickness(stream.Version))
            {
                BoxThickness.Read(stream);
                RadiusThickness = stream.ReadSingle();
                DonutRadius     = stream.ReadSingle();
                Position.Read(stream);
                Rotation.Read(stream);
                Scale.Read(stream);
            }
            if (IsReadPlacementMode(stream.Version))
            {
                PlacementMode = stream.ReadInt32();
            }
            if (IsReadMeshMaterialIndex(stream.Version))
            {
                if (IsReadMeshMaterialIndexFirst(stream.Version))
                {
                    MeshMaterialIndex = stream.ReadInt32();
                    MeshNormalOffset  = stream.ReadSingle();
                }
            }
            if (IsReadMesh(stream.Version))
            {
                Mesh.Read(stream);
            }
            if (IsReadMeshRenderer(stream.Version))
            {
                MeshRenderer.Read(stream);
                SkinnedMeshRenderer.Read(stream);
            }
            if (IsReadMeshMaterialIndex(stream.Version))
            {
                if (!IsReadMeshMaterialIndexFirst(stream.Version))
                {
                    MeshMaterialIndex = stream.ReadInt32();
                    MeshNormalOffset  = stream.ReadSingle();
                }
            }
            if (IsReadMeshScale(stream.Version))
            {
                MeshScale = stream.ReadSingle();
            }
            if (IsReadUseMeshMaterialIndex(stream.Version))
            {
                UseMeshMaterialIndex = stream.ReadBoolean();
                UseMeshColors        = stream.ReadBoolean();
            }
            if (IsReadAlignToDirection(stream.Version))
            {
                AlignToDirection = stream.ReadBoolean();
            }
            if (IsReadRandomDirection(stream.Version))
            {
                RandomDirection = stream.ReadBoolean();
            }
            stream.AlignStream(AlignType.Align4);

            if (IsReadRandomDirectionAmount(stream.Version))
            {
                RandomDirectionAmount    = stream.ReadSingle();
                SphericalDirectionAmount = stream.ReadSingle();
            }
            if (IsReadRandomPositionAmount(stream.Version))
            {
                RandomPositionAmount = stream.ReadSingle();
            }
            if (IsReadRadius(stream.Version))
            {
                if (!IsReadRadiusFirst(stream.Version))
                {
                    Radius.Read(stream);
                    Arc.Read(stream);
                }
            }
        }