Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            base.LoadContent();

            _projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
                (float)Math.PI * 0.25f,
                (float)TargetSize.Width / TargetSize.Height,
                0.05f,
                1000f);

            var camera = new Camera(_projectionMatrix)
            {
                ViewPosition = new Vector3(-.0f, .0f, 1.2f)
            };
            var device = Graphics.GraphicsDevice;

            _sun = new Sun(StarType);
            _sun.Create(Graphics, Content, camera);

            _usePostProcessor = device.GraphicsDeviceCapabilities.DeviceType == DeviceType.Hardware &&
                                device.GraphicsDeviceCapabilities.MaxPixelShaderProfile >= ShaderProfile.PS_3_0;

            if (_usePostProcessor)
            {
                _postProcessor = new PostProcessor(device, Content);
            }
        }
Ejemplo n.º 2
0
        private void CreateContentManager()
        {
            _contentManager = new ContentManager(_deviceManager, Environment.CurrentDirectory);

            try
            {
                _postProcessor = new PostProcessor(_deviceManager.GraphicsDevice, _contentManager);
            }
            catch (Exception e)
            {
                _usePostProcessor = false;
                GameLog.Client.General.Error("An error occurred loading the HDR post-processor effects.", e);
            }
        }
Ejemplo n.º 3
0
        protected override void UnloadContent()
        {
            base.UnloadContent();

            if (_sun != null)
            {
                _sun.Dispose();
            }

            _sun = null;

            if (_postProcessor != null)
            {
                _postProcessor.Dispose();
            }

            _postProcessor = null;
        }