示例#1
0
        // ** Initialization and control
        public void Configure(RenderConfiguration Configuration)
        {
            _Config = Configuration;

            _ColourPalette = _Config.Palette;
            _Metrics       = _Config.Metrics;

            _Chunks = Configuration.Chunks;

            if (_Config.AdvancedRenderOptions.Exists(x => x.Key.ToLower() == "mode"))
            {
                switch (_Config.AdvancedRenderOptions.Find(x => x.Key.ToLower() == "mode").Value)
                {
                case "c":
                    _RenderStartY = GetStartRenderYCave;
                    break;

                case "C":
                    _RenderStartY = GetStartRenderYCaveAlternate;
                    break;

                default:
                    _RenderStartY = GetStartRenderYNormal;
                    break;
                }
            }
            else
            {
                _RenderStartY = GetStartRenderYNormal;
            }
        }
示例#2
0
 public Heatmap(WorldMetrics Metrics, Granularity Granularity)
 {
     _Granularity = Granularity;
     _Width       = (((Metrics.MaxX - Metrics.MinX + 1) << 4) >> (int)_Granularity);
     _Height      = (((Metrics.MaxZ - Metrics.MinZ + 1) << 4) >> (int)_Granularity);
     _Map         = new int[_Height * _Width];
 }
示例#3
0
        private void cbDimension_SelectedIndexChanged(object Sender, EventArgs E)
        {
            // Measure World
            WorldMetrics Metrics = new WorldMetrics(_World, ((DimensionListEntry)cbDimension.SelectedItem).Value);

            _RenderingConfig.Dimension = Metrics.Dimension;
            _RenderingConfig.Metrics   = Metrics;

            lblWorldMax.Text = String.Format("{0}, {1}", Metrics.MaxX, Metrics.MaxZ);
            lblWorldMin.Text = String.Format("{0}, {1}", Metrics.MinX, Metrics.MinZ);

            QueuePreview();
        }
示例#4
0
 internal RenderConfiguration(BlockPalette UsePalette, WorldMetrics UseMetrics)
 {
     MinLightLevel        = 15;
     WorldPath            = "";
     SaveFilename         = "";
     ScanFilename         = "";
     MetricsFilename      = "";
     Dimension            = "";
     EnableMultithreading = false;
     Palette               = UsePalette;
     Metrics               = UseMetrics;
     RendererName          = "Standard";
     MaxThreads            = Environment.ProcessorCount;
     AdvancedRenderOptions = new List <KeyValuePair <string, string> >();
     SubregionChunks       = new Rectangle();
     RenderSubregion       = false;
 }
示例#5
0
        public void Process(RegionChunkManager Chunks, WorldMetrics Metrics, String Filename)
        {
            // *** Accumulate list of sign types
            _SignMap = CreateSignMap();


            int    NumLen          = Metrics.NumberOfChunks.ToString().Length;
            int    NumCount        = Metrics.NumberOfChunks;
            string NumFormat       = "D" + NumLen;
            int    ProcessedChunks = 0;

            Console.Write("Scanned " + 0.ToString(NumFormat) + " of " + Metrics.NumberOfChunks.ToString() + " chunks (0%)");
            Point ProcessedCountPoint   = new Point(8, Console.CursorTop);
            Point PercentageUpdatePoint = new Point(Console.CursorLeft - 3, Console.CursorTop);


            // *** Find all signs in the world and scan
            foreach (ChunkRef Chunk in Chunks)
            {
                ProcessedChunks++;
                Console.SetCursorPosition(ProcessedCountPoint.X, ProcessedCountPoint.Y);
                Console.Write(ProcessedChunks.ToString(NumFormat));

                Console.SetCursorPosition(PercentageUpdatePoint.X, PercentageUpdatePoint.Y);
                Console.Write(((100 * ProcessedChunks) / NumCount).ToString() + "%)");

                ProcessChunk(Chunk);
            }
            Console.WriteLine("");
            Console.WriteLine("Scan completed.  Saving sign data...");

            XmlWriter Writer = XmlWriter.Create(Filename);

            Writer.WriteStartElement("Signs");

            // *** Curly braces used to ensure that start and end element counts are matched.
            foreach (SignBase Sign in _ExportableSigns)
            {
                Writer.WriteStartElement("Sign");
                {
                    Writer.WriteAttributeString("Type", Sign.SignType());

                    Writer.WriteStartElement("Location");
                    {
                        Writer.WriteElementString("X", Sign.Location.X.ToString());
                        Writer.WriteElementString("Y", Sign.Location.Y.ToString());
                    }
                    Writer.WriteEndElement();

                    List <KeyValuePair <String, String> > Params = new List <KeyValuePair <string, string> >();

                    Sign.ExportParameters(Params);

                    foreach (KeyValuePair <String, String> Param in Params)
                    {
                        Writer.WriteStartElement(Param.Key);
                        {
                            Writer.WriteString(Param.Value);
                        }
                        Writer.WriteEndElement();
                    }
                }
                Writer.WriteEndElement();
            }

            Writer.WriteEndElement();

            Writer.Flush();
            Writer.Close();

            Console.WriteLine("Wrote sign data to file " + Path.GetFileName(Filename));
        }