Beispiel #1
0
        public void MoveToScreen(RenderType type, bool realFullScreen = false)
        {
            YND.GraphicsDevice.SetRenderTarget(null);
            YND.GraphicsDevice.Clear(Color.Black);

            using (var sbh = new SpriteBatchHelper())
            {
                sbh.DrawFullScreen(_passes[type].RenderTarget, realFullScreen);
            }
        }
Beispiel #2
0
        public void Render(GameTime time, RendererPass rendererPass)
        {
            //curr = Keyboard.GetState();
            //if (curr.IsKeyDown(Keys.Space) && prev.IsKeyUp(Keys.Space)) showStarObject = !showStarObject;
            //prev = curr;

            CalculateWorldMatrix();

            if (rendererPass.RenderType == RenderType.DarknessMask)
            {
                model.Render(_worldMatrix, new TextureShaderParameters());
                CopyToDedicatedOffscreen(rendererPass);
                RemoveFromLightMask(rendererPass);
            }
            else
            {
                using (var sbh = new SpriteBatchHelper(0, BlendState.Additive))
                {
                    sbh.DrawFullScreen(_postProcessTarget);
                }

                if (ShowStarObject) model.Render(_worldMatrix, new TextureShaderParameters());
            }
        }
Beispiel #3
0
        private void CopyToDedicatedOffscreen(RendererPass rendererPass)
        {
            var starPositionScreen = YND.GraphicsDevice.Viewport.Project(Position, Camera.Instance.ProjectionMatrix, Camera.Instance.ViewMatrix, Matrix.Identity);
            var viewportSize = new Vector2(YND.GraphicsDevice.Viewport.Width, YND.GraphicsDevice.Viewport.Height);

            YND.GraphicsDevice.SetRenderTarget(_postProcessTarget);

            _postProcess.Parameters["ScreenLightPos"].SetValue(new Vector2(starPositionScreen.X / viewportSize.X, starPositionScreen.Y / viewportSize.Y));
            _postProcess.Parameters["Density"].SetValue(_density);
            _postProcess.Parameters["Weight"].SetValue(_weight);
            _postProcess.Parameters["Decay"].SetValue(_decay);
            _postProcess.Parameters["Steps"].SetValue(_steps);

            using (var sbh = new SpriteBatchHelper(_postProcess, "MatrixTransform"))
            {
                sbh.DrawFullScreen(rendererPass.RenderTarget);
            }
        }