Ejemplo n.º 1
0
 public void Read(AssetReader reader)
 {
     m_patches          = reader.ReadAssetArray <DetailPatch>();
     m_detailPrototypes = reader.ReadAssetArray <DetailPrototype>();
     PatchCount         = reader.ReadInt32();
     PatchSamples       = reader.ReadInt32();
     m_randomRotations  = reader.ReadAssetArray <Vector3f>();
     if (IsReadAtlasTexture(reader.Version))
     {
         AtlasTexture.Read(reader);
     }
     WavingGrassTint.Read(reader);
     WavingGrassStrength = reader.ReadSingle();
     WavingGrassAmount   = reader.ReadSingle();
     WavingGrassSpeed    = reader.ReadSingle();
     if (IsReadDetailBillboardShader(reader.Version))
     {
         DetailBillboardShader.Read(reader);
         DetailMeshLitShader.Read(reader);
         DetailMeshGrassShader.Read(reader);
     }
     m_treeInstances  = reader.ReadAssetArray <TreeInstance>();
     m_treePrototypes = reader.ReadAssetArray <TreePrototype>();
     if (IsReadPreloadTextureAtlasData(reader.Version))
     {
         m_preloadTextureAtlasData = reader.ReadAssetArray <PPtr <Texture2D> >();
     }
 }
Ejemplo n.º 2
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);
        }
Ejemplo 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);
            }
        }
Ejemplo n.º 4
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> >();
            }
        }
Ejemplo n.º 5
0
        private YAMLNode ExportDetailMeshGrassShader(IExportContainer container)
        {
            if (IsReadDetailBillboardShader(container.Version))
            {
                return(DetailMeshGrassShader.ExportYAML(container));
            }

            EngineBuiltInAsset buildInAsset = EngineBuiltInAssets.GetShader(EngineBuiltInAssets.TerrainWavingDoublePass, container.ExportVersion);

            return(buildInAsset.ToExportPointer().ExportYAML(container));
        }
Ejemplo n.º 6
0
        private YAMLNode ExportDetailMeshGrassShader(IExportContainer container)
        {
            if (IsReadDetailBillboardShader(container.Version))
            {
                return(DetailMeshGrassShader.ExportYAML(container));
            }

            EngineBuiltInAsset buildInAsset = EngineBuiltInAssets.Shaders[EngineBuiltInAssets.TerrainWavingDoublePass];
            ExportPointer      pointer      = new ExportPointer(buildInAsset.ExportID, buildInAsset.GUID, AssetType.Internal);

            return(pointer.ExportYAML(container));
        }