示例#1
0
文件: Window.cs 项目: Dmihawk/Terrain
        public bool Frame(float frameTime)
        {
            _frameCounter.Frame();

            TimeOfDay.Frame(frameTime);

            var result = _input.Frame();

            var heightDifference = 0.0f;

            if (_quadTree.GetHeightAtPosition(_camera.Position.X, _camera.Position.Z, out float height))
            {
                heightDifference = _camera.Position.Y - (height + 2.0f);
            }

            result &= HandleInput(frameTime, heightDifference);

            if (_camera.Position.Y < (height + 2.0f))
            {
                _camera.Position.Y = height + 2.0f;
            }

            result &= _userInterface.Frame(_frameCounter.FPS, _player.Position, _player.Rotation, _directX.DeviceContext);
            result &= _foliage.Frame(_camera.Position, _directX.DeviceContext);

            _skyPlane.Frame();

            result &= Render();

            return(result);
        }
        public bool Frame(float frameTime)
        {
            // Update the system stats.
            FPS.Frame();

            // Do the frame input processing.
            if (!HandleInput(frameTime))
            {
                return(false);
            }

            // Do the frame processing for the user interface.
            if (!UserInterface.Frame(FPS.FPS, Position.PositionX, Position.PositionY, Position.PositionZ, Position.RotationX, Position.RotationY, Position.RotationZ, D3D.DeviceContext))
            {
                return(false);
            }

            // Do the frame processing for the foliage.
            if (!Foliage.Frame(Camera.GetPosition(), D3D.DeviceContext))
            {
                return(false);
            }

            // Render the graphics.
            if (!Render())
            {
                return(false);
            }

            return(true);
        }