示例#1
0
        public Emulator(Audio audio, TextureDisplay texture_display)
        {
            m_memory = new Memory();

            m_processor = new CPU.Z80(
                m_memory.CPUWrite,
                m_memory.CPURead,
                OnIOWrite,
                OnIORead,
                OnInterruptAcknowledge,
                OnClock);

            m_gate_array = new GateArray(m_memory, m_processor);

            m_keyboard = new Keyboard();

            m_crtc = new CRTC(m_gate_array);

            m_psg = new PSG(audio, m_keyboard);
            m_ppi = new PPI(m_crtc, m_gate_array, m_psg);

            m_monitor = new Monitor(texture_display, m_crtc, m_memory, m_gate_array);

            Reset();
        }
示例#2
0
文件: Main.cs 项目: antmillar/UserEvo
 public void DisplayPhenotypes(int count)
 {
     for (int i = 0; i < count; i++)
     {
         //convert initial genomes to images
         Color[] specimen = geneticAlgo.Encoder.Decode(geneticAlgo.Population._genomes[i].genome);
         TextureDisplay.applyTexture(specimen, rawImages[i], width, height);
     }
 }
示例#3
0
        public override void Process(IPostProcessorContext context)
        {
            Instrument.Begin(InstrumentProcess);

            DrawShadowScene(context);
            Filter(context);

            TextureDisplay.Add(shadowSceneMap);

            Instrument.End();
        }
示例#4
0
        public override void Process(IPostProcessorContext context)
        {
            Instrument.Begin(InstrumentProcess);

            DrawNormalDepth(context);
            Filter(context);

            TextureDisplay.Add(normalDepthMap);

            Instrument.End();
        }
示例#5
0
        public Monitor(TextureDisplay texture_display, CRTC crtc, Memory memory, GateArray gate_array)
        {
            m_texture_display = texture_display;
            m_crtc            = crtc;
            m_memory          = memory;
            m_gate_array      = gate_array;

            m_pen_colours = new uint[GateArray.NUM_PEN_SETTINGS];

            // Implicitly hookup the CRTC to the monitor.
            m_crtc.AddHSyncCallback(OnHSync);
            m_crtc.AddVSyncCallback(OnVSync);

            Reset();
        }
示例#6
0
        // シャドウ マップを描画。
        public void Draw(ref Vector3 lightDirection)
        {
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.BlendState        = BlendState.Opaque;

            // 各ライト カメラで描画。
            for (int i = 0; i < splitCameras.Length; i++)
            {
                var camera        = splitCameras[i];
                var renderTarget  = splitRenderTargets[i];
                var shadowCasters = splitShadowCasters[i];

                //------------------------------------------------------------
                // ライトのビュー×射影行列の更新

                splitLightCameras[i].Update(camera, ref lightDirection);

                //------------------------------------------------------------
                // エフェクト

                shadowMapEffect.LightViewProjection = splitLightCameras[i].LightViewProjection;

                //------------------------------------------------------------
                // 描画

                GraphicsDevice.SetRenderTarget(renderTarget);
                GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.White, 1.0f, 0);

                while (0 < shadowCasters.Count)
                {
                    var shadowCaster = shadowCasters.Dequeue();
                    shadowCaster.Draw(shadowMapEffect);
                }

                if (shadowMapEffect.ShadowMapTechnique == Techniques.Vsm && blur != null)
                {
                    blur.Filter(renderTarget);
                }

                GraphicsDevice.SetRenderTarget(null);

                TextureDisplay.Add(renderTarget);
            }
        }
示例#7
0
        private void ExportAll_Click(object sender, RoutedEventArgs e)
        {
            UndertaleSprite sprite = this.DataContext as UndertaleSprite;

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.FileName   = sprite.Name.Content + ".png";
            dlg.DefaultExt = ".png";
            dlg.Filter     = "PNG files (.png)|*.png|All files|*";

            if (dlg.ShowDialog() == true)
            {
                try
                {
                    if (sprite.Textures.Count > 1)
                    {
                        string dir  = System.IO.Path.GetDirectoryName(dlg.FileName);
                        string name = System.IO.Path.GetFileNameWithoutExtension(dlg.FileName);
                        string path = System.IO.Path.Combine(dir, name);
                        string ext  = System.IO.Path.GetExtension(dlg.FileName);

                        Directory.CreateDirectory(path);
                        foreach (var tex in sprite.Textures.Select((tex, id) => new { id, tex }))
                        {
                            try
                            {
                                TextureList.SelectedItem = tex.tex;
                                using (var file = File.OpenWrite(System.IO.Path.Combine(path, tex.id + ext)))
                                {
                                    TextureDisplay.SaveImagePNG(file);
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Failed to export file: " + ex.Message, "Failed to export file", MessageBoxButton.OK, MessageBoxImage.Error);
                            }
                        }
                    }
                    else if (sprite.Textures.Count == 1)
                    {
                        try
                        {
                            using (var file = File.OpenWrite(dlg.FileName))
                            {
                                TextureDisplay.SaveImagePNG(file);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Failed to export file: " + ex.Message, "Failed to export file", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("No frames to export", "Failed to export sprite", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to export: " + ex.Message, "Failed to export sprite", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
示例#8
0
        protected override void Initialize()
        {
            #region ロギング

            logger.Info("Initialize");

            EnvironmentLog.Info();
            GraphicsAdapterLog.Info();

            #endregion

            #region FPS カウンタ

            var fpsCounter = new FpsCounter(this);
            fpsCounter.Content.RootDirectory = "Content";
            fpsCounter.HorizontalAlignment   = DebugHorizontalAlignment.Right;
            fpsCounter.SampleSpan            = TimeSpan.FromSeconds(2);
            //fpsCounter.Enabled = false;
            //fpsCounter.Visible = false;
            Components.Add(fpsCounter);

            #endregion

            #region タイム ルーラ

            timeRuler = new TimeRuler(this);
            timeRuler.BackgroundColor = Color.Black;
            timeRuler.Visible         = false;
            Components.Add(timeRuler);

            #endregion

            #region モニタ

            monitorListener = new TimeRulerMonitorListener(timeRuler);
            Instrument.Listeners.Add(monitorListener);

            int barIndex = 0;

            monitorListener.CreateMarker(InstrumentUpdate, barIndex, Color.White);

            barIndex++;
            monitorListener.CreateMarker(PartitionManager.InstrumentUpdate, barIndex, Color.Cyan);
            barIndex++;
            monitorListener.CreateMarker(PartitionManager.InstrumentCheckPassivations, barIndex, Color.Orange);
            monitorListener.CreateMarker(PartitionManager.InstrumentCheckActivations, barIndex, Color.Green);
            monitorListener.CreateMarker(PartitionManager.InstrumentPassivate, barIndex, Color.Red);
            barIndex++;
            monitorListener.CreateMarker(ChunkManager.InstrumentProcessProcessBuildVerticesRequests, barIndex, Color.Green);
            barIndex++;
            monitorListener.CreateMarker(ChunkManager.InstrumentProcessChunkTaskRequests, barIndex, Color.Yellow);
            barIndex++;
            monitorListener.CreateMarker(ChunkManager.InstrumentUpdateMeshBuffers, barIndex, Color.Magenta);

            barIndex++;
            monitorListener.CreateMarker(RegionManager.InstrumentUpdate, barIndex, Color.White);

            barIndex++;
            monitorListener.CreateMarker(InstrumentDraw, barIndex, Color.White);

            barIndex++;
            monitorListener.CreateMarker(SceneManager.InstrumentDraw, barIndex, Color.Cyan);
            barIndex++;
            monitorListener.CreateMarker(SceneManager.InstrumentDrawShadowMap, barIndex, Color.Cyan);
            monitorListener.CreateMarker(SceneManager.InstrumentDrawScene, barIndex, Color.Orange);
            monitorListener.CreateMarker(SceneManager.InstrumentOcclusionQuery, barIndex, Color.Green);
            monitorListener.CreateMarker(SceneManager.InstrumentDrawSceneObjects, barIndex, Color.Red);
            monitorListener.CreateMarker(SceneManager.InstrumentDrawParticles, barIndex, Color.Yellow);
            monitorListener.CreateMarker(SceneManager.InstrumentPostProcess, barIndex, Color.Magenta);

            #endregion

            #region テクスチャ ディスプレイ

            textureDisplay         = new TextureDisplay(this);
            textureDisplay.Visible = false;
            Components.Add(textureDisplay);

            #endregion

            base.Initialize();
        }