FPS を計測して画面に表示するクラスです。
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Example #1
0
        protected override void Initialize()
        {
            #region ���M���O

            logger.Info("Initialize");

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

            #endregion

            #region FPS �J�E���^

            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 �^�C�� ���[��

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

            #endregion

            #region ���j�^

            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 �e�N�X�`�� �f�B�X�v���C

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

            #endregion

            base.Initialize();
        }
Example #2
0
        protected override void Initialize()
        {
            var viewport = GraphicsDevice.Viewport;
            viewInput.InitialMousePositionX = viewport.Width / 2;
            viewInput.InitialMousePositionY = viewport.Height / 2;
            viewInput.FreeView = view;
            viewInput.MoveVelocity = moveVelocity;
            viewInput.DashFactor = dashFactor;

            //view.Position = new Vector3(50, 30, 50);
            view.Position = new Vector3(-150000.0f, 30, -150000.0f);
            view.Yaw(MathHelper.PiOver4 * 5);
            view.Update();

            projection.FarPlaneDistance = farPlaneDistance;
            projection.Update();

            defaultRasterizerState.CullMode = CullMode.CullCounterClockwiseFace;
            defaultRasterizerState.FillMode = FillMode.Solid;

            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);

            base.Initialize();
        }