Ejemplo n.º 1
0
 public MCWorldExporter(ExportJob job, bool useDefaultPostProcessors, bool useSplatmaps) : this(job)
 {
     if (useSplatmaps)
     {
         postProcessor = new SplatmappedSurfacePostProcessor(job.data.filename, 255, regionOffsetX * 512, regionOffsetZ * 512, job.data.GridWidth, job.data.GridHeight);
     }
 }
Ejemplo n.º 2
0
        public SplatmappedGenerator(SplatmappedSurfacePostProcessor post, XElement xml, string rootPath, int ditherLimit, int offsetX, int offsetZ, int sizeX, int sizeZ)
            : base(rootPath, xml, offsetX, offsetZ, sizeX, sizeZ)
        {
            postProcessor = post;
            string mapFileName = Path.Combine(rootPath, xml.Attribute("file").Value);

            foreach (var layer in xml.Elements("layer"))
            {
                XAttribute colorAttr = layer.Attribute("color");
                if (colorAttr == null)
                {
                    ConsoleOutput.WriteError("layer is missing required attribute 'color': " + layer.ToString().Trim());
                    continue;
                }
                var color        = ParseColor(colorAttr.Value);
                var surfaceLayer = new SurfaceLayer(color, layer.Attribute("name")?.Value);
                layers.Add(surfaceLayer);
                foreach (var elem in layer.Elements())
                {
                    if (elem.Name.LocalName == "surface")
                    {
                        surfaceLayer.AddSurfaceGenerator(elem);
                    }
                    else if (elem.Name.LocalName == "gen")
                    {
                        surfaceLayer.AddSchematicGenerator(this, elem);
                    }
                    else if (elem.Name.LocalName == "biome")
                    {
                        surfaceLayer.AddBiomeGenerator(elem);
                    }
                }
            }

            Color[] mappedColors = new Color[layers.Count];
            for (int i = 0; i < layers.Count; i++)
            {
                mappedColors[i] = layers[i].layerColor;
            }

            map = SplatmapImporter.GetFixedSplatmap(mapFileName, mappedColors, ditherLimit, 0, 0, sizeX, sizeZ);
        }