protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = base.ExportYAMLRoot(container);
            node.InsertSerializedVersion(GetSerializedVersion(container.Version));
            node.Add("m_RenderMode", (short)RenderMode);
            node.Add("m_SortMode", (short)SortMode);
            node.Add("m_MinParticleSize", MinParticleSize);
            node.Add("m_MaxParticleSize", MaxParticleSize);
            node.Add("m_CameraVelocityScale", CameraVelocityScale);
            node.Add("m_VelocityScale", VelocityScale);
            node.Add("m_LengthScale", LengthScale);
            node.Add("m_SortingFudge", SortingFudge);
            node.Add("m_NormalDirection", GetNormalDirection(container.Version));
            node.Add("m_RenderAlignment", (int)RenderAlignment);
            node.Add("m_Pivot", Pivot.ExportYAML(container));
            node.Add("m_UseCustomVertexStreams", UseCustomVertexStreams);
            node.Add("m_VertexStreams", GetVertexStreams(container.Version).ExportYAML());
            node.Add("m_Mesh", Mesh.ExportYAML(container));
            node.Add("m_Mesh1", Mesh1.ExportYAML(container));
            node.Add("m_Mesh2", Mesh2.ExportYAML(container));
            node.Add("m_Mesh3", Mesh3.ExportYAML(container));
            node.Add("m_MaskInteraction", (int)MaskInteraction);
            return(node);
        }
Exemple #2
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            node.InsertSerializedVersion(GetSerializedVersion(container.ExportVersion));
            node.Add(RenderModeName, (short)RenderMode);
            node.Add(SortModeName, (short)SortMode);
            node.Add(MinParticleSizeName, MinParticleSize);
            node.Add(MaxParticleSizeName, MaxParticleSize);
            node.Add(CameraVelocityScaleName, CameraVelocityScale);
            node.Add(VelocityScaleName, VelocityScale);
            node.Add(LengthScaleName, LengthScale);
            node.Add(SortingFudgeName, SortingFudge);
            node.Add(NormalDirectionName, GetNormalDirection(container.Version));
            node.Add(RenderAlignmentName, (int)RenderAlignment);
            node.Add(PivotName, Pivot.ExportYAML(container));
            node.Add(UseCustomVertexStreamsName, UseCustomVertexStreams);
            node.Add(VertexStreamsName, GetVertexStreams(container.Version).ExportYAML());
            node.Add(MeshName, Mesh.ExportYAML(container));
            node.Add(Mesh1Name, Mesh1.ExportYAML(container));
            node.Add(Mesh2Name, Mesh2.ExportYAML(container));
            node.Add(Mesh3Name, Mesh3.ExportYAML(container));
            node.Add(MaskInteractionName, (int)MaskInteraction);
            return(node);
        }
Exemple #3
0
        protected override YAMLMappingNode ExportYAMLRoot(IAssetsExporter exporter)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = base.ExportYAMLRoot(exporter);
            node.InsertSerializedVersion(GetSerializedVersion(exporter.Version));
            node.Add("m_RenderMode", RenderMode);
            node.Add("m_SortMode", SortMode);
            node.Add("m_MinParticleSize", MinParticleSize);
            node.Add("m_MaxParticleSize", MaxParticleSize);
            node.Add("m_CameraVelocityScale", CameraVelocityScale);
            node.Add("m_VelocityScale", VelocityScale);
            node.Add("m_LengthScale", LengthScale);
            node.Add("m_SortingFudge", SortingFudge);
            node.Add("m_NormalDirection", NormalDirection);
            node.Add("m_RenderAlignment", RenderAlignment);
            node.Add("m_Pivot", Pivot.ExportYAML(exporter));
            node.Add("m_UseCustomVertexStreams", UseCustomVertexStreams);
            node.Add("m_VertexStreams", IsReadVertexStreams(exporter.Version) ? VertexStreams.ExportYAML() : YAMLScalarNode.Empty);
            node.Add("m_Mesh", Mesh.ExportYAML(exporter));
            node.Add("m_Mesh1", Mesh1.ExportYAML(exporter));
            node.Add("m_Mesh2", Mesh2.ExportYAML(exporter));
            node.Add("m_Mesh3", Mesh3.ExportYAML(exporter));
            node.Add("m_MaskInteraction", MaskInteraction);
            return(node);
        }
		public override IEnumerable<Object> FetchDependencies(ISerializedFile file, bool isLog = false)
		{
			foreach(Object @object in base.FetchDependencies(file, isLog))
			{
				yield return @object;
			}
			
			yield return Mesh.FetchDependency(file, isLog, ToLogString, "m_Mesh");
			if (IsReadMeshes(file.Version))
			{
				yield return Mesh1.FetchDependency(file, isLog, ToLogString, "m_Mesh1");
				yield return Mesh2.FetchDependency(file, isLog, ToLogString, "m_Mesh2");
				yield return Mesh3.FetchDependency(file, isLog, ToLogString, "m_Mesh3");
			}
		}
Exemple #5
0
    public static Mesh ToUnity(this Mesh2 mesh)
    {
        var vertices = new Vector3[mesh.vertices.Length];

        for (var v = 0; v < vertices.Length; v++)
        {
            vertices[v] = mesh.vertices[v].ToUnity();
        }

        var result = new Mesh();

        result.vertices = vertices;
        result.Fill2D();
        return(result);
    }
Exemple #6
0
        public override IEnumerable <Object> FetchDependencies(ISerializedFile file, bool isLog = false)
        {
            foreach (Object asset in base.FetchDependencies(file, isLog))
            {
                yield return(asset);
            }

            yield return(Mesh.FetchDependency(file, isLog, ToLogString, MeshName));

            if (IsReadMeshes(file.Version))
            {
                yield return(Mesh1.FetchDependency(file, isLog, ToLogString, Mesh1Name));

                yield return(Mesh2.FetchDependency(file, isLog, ToLogString, Mesh2Name));

                yield return(Mesh3.FetchDependency(file, isLog, ToLogString, Mesh3Name));
            }
        }
Exemple #7
0
 public static void DebugDraw(this Mesh2 mesh, Color color, float duration = 0, bool depthTest = true)
 {
     for (var v = 1; v < mesh.vertices.Length; v++)
     {
         Debug.DrawLine(
             mesh.vertices[v - 1].ToUnity(),
             mesh.vertices[v].ToUnity(),
             color, duration, depthTest
             );
     }
     if (mesh.vertices.Length > 2)
     {
         Debug.DrawLine(
             mesh.vertices[0].ToUnity(),
             mesh.vertices[mesh.vertices.Length - 1].ToUnity(),
             color, duration, depthTest
             );
     }
 }
Exemple #8
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();
			}
		}