Esempio n. 1
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion));
            node.Add(PatchesName, Patches.ExportYAML(container));
            node.Add(DetailPrototypesName, DetailPrototypes.ExportYAML(container));
            node.Add(PatchCountName, PatchCount);
            node.Add(PatchSamplesName, PatchSamples);
            node.Add(RandomRotationsName, RandomRotations.ExportYAML(container));
            if (HasAtlasTexture(container.ExportVersion))
            {
                node.Add(AtlasTextureName, AtlasTexture.ExportYAML(container));
            }

            node.Add(WavingGrassTintName, WavingGrassTint.ExportYAML(container));
            node.Add(WavingGrassStrengthName, WavingGrassStrength);
            node.Add(WavingGrassAmountName, WavingGrassAmount);
            node.Add(WavingGrassSpeedName, WavingGrassSpeed);
            if (HasDetailBillboardShader(container.ExportVersion))
            {
                node.Add(DetailBillboardShaderName, DetailBillboardShader.ExportYAML(container));
                node.Add(DetailMeshLitShaderName, DetailMeshLitShader.ExportYAML(container));
                node.Add(DetailMeshGrassShaderName, DetailMeshGrassShader.ExportYAML(container));
            }
            TreeDatabase.ExportYAML(container, node);
            if (!HasAtlasTexture(container.ExportVersion))
            {
                node.Add(PreloadTextureAtlasDataName, PreloadTextureAtlasData.ExportYAML(container));
            }
            return(node);
        }
Esempio n. 2
0
        public void Read(AssetReader reader)
        {
            Patches          = reader.ReadAssetArray <DetailPatch>();
            DetailPrototypes = reader.ReadAssetArray <DetailPrototype>();
            PatchCount       = reader.ReadInt32();
            PatchSamples     = reader.ReadInt32();
            RandomRotations  = reader.ReadAssetArray <Vector3f>();
            if (HasAtlasTexture(reader.Version))
            {
                AtlasTexture.Read(reader);
            }

            WavingGrassTint.Read(reader);
            WavingGrassStrength = reader.ReadSingle();
            WavingGrassAmount   = reader.ReadSingle();
            WavingGrassSpeed    = reader.ReadSingle();
            if (HasDetailBillboardShader(reader.Version))
            {
                DetailBillboardShader.Read(reader);
                DetailMeshLitShader.Read(reader);
                DetailMeshGrassShader.Read(reader);
            }

            TreeDatabase.Read(reader);
            if (!HasAtlasTexture(reader.Version))
            {
                PreloadTextureAtlasData = reader.ReadAssetArray <PPtr <Texture2D> >();
            }
        }
Esempio n. 3
0
        public void Write(AssetWriter writer)
        {
            Patches.Write(writer);
            DetailPrototypes.Write(writer);
            writer.Write(PatchCount);
            writer.Write(PatchSamples);
            RandomRotations.Write(writer);
            if (HasAtlasTexture(writer.Version))
            {
                AtlasTexture.Write(writer);
            }

            WavingGrassTint.Write(writer);
            writer.Write(WavingGrassStrength);
            writer.Write(WavingGrassAmount);
            writer.Write(WavingGrassSpeed);
            if (HasDetailBillboardShader(writer.Version))
            {
                DetailBillboardShader.Write(writer);
                DetailMeshLitShader.Write(writer);
                DetailMeshGrassShader.Write(writer);
            }

            TreeDatabase.Write(writer);
            if (!HasAtlasTexture(writer.Version))
            {
                PreloadTextureAtlasData.Write(writer);
            }
        }
Esempio n. 4
0
 public IEnumerable <PPtr <Object> > FetchDependencies(DependencyContext context)
 {
     foreach (PPtr <Object> asset in context.FetchDependencies(DetailPrototypes, DetailPrototypesName))
     {
         yield return(asset);
     }
     if (HasAtlasTexture(context.Version))
     {
         yield return(context.FetchDependency(AtlasTexture, AtlasTextureName));
     }
     foreach (PPtr <Object> asset in TreeDatabase.FetchDependencies(context))
     {
         yield return(asset);
     }
     if (!HasAtlasTexture(context.Version))
     {
         foreach (PPtr <Object> asset in context.FetchDependencies(PreloadTextureAtlasData, PreloadTextureAtlasDataName))
         {
             yield return(asset);
         }
     }
 }