public override void DrawFrame(GameTime time, RendererPass resultPass)
        {
            _background.Render(time, resultPass);

            using (var sbh = new SpriteBatchHelper(SpriteSortMode.Deferred, BlendState.AlphaBlend))
            {
                sbh.DrawStringOutlined(_font, YND.Speech[SpeechKey.ScaleInfo].Text, new Vector2(640, 60), 1200, Color.White, Color.Black, 2, 1);

                for (int i = 0; i < 31; i++)
                {
                    float distance = 640 * (i * 2) - displayOffset;
                    if (Math.Abs(distance) > 1000)
                        continue;

                    float scale = (distance / 1000.0f) + 1;
                    //if (scale < 0) continue;
                    sbh.Draw(pictures[i], new Vector2(640, 360), new Vector2(850, 470), Color.Lerp(Color.Transparent, Color.White, 1 - Math.Abs(scale - 1)), 0, MathHelper.Clamp(scale, 0, 5), true);
                }
            }

            //using (var sbh = new SpriteBatchHelper())
            //{
            //    sbh.DrawStringOutlined(_font, YND.Speech[SpeechKey.ScaleInfo].Text, new Vector2(640, 60), 1200, Color.White, Color.Black, 2, 1);
            //    for (int i = 0; i < 31; i++) sbh.Draw(pictures[i], new Vector2(640 * (i * 2 + 1) - displayOffset, 360), new Vector2(850, 470), Color.White);
            //}

            _backButton.Render(time, resultPass);
        }
Пример #2
0
        public void Render(GameTime time, RendererPass renderer)
        {
            if (_instanceVertices == null || _instanceVertices.VertexCount != _instances.Count) RecalculateInstances();

            _effect.CurrentTechnique = _effect.Techniques["Bilboarding"];

            _effect.Parameters["partTexture"].SetValue(_particleTexture);
            _effect.Parameters["EyePosition"].SetValue(Camera.Camera.Instance.Position);
            _effect.Parameters["opacity"].SetValue(_intensity);

            _effect.Parameters["vp"].SetValue(Camera.Camera.Instance.ViewMatrix * Camera.Camera.Instance.ProjectionMatrix);
            _effect.Parameters["World"].SetValue(Matrix.CreateFromYawPitchRoll(Rotation.X, Rotation.Y, Rotation.Z));

            _effect.CurrentTechnique.Passes[0].Apply();

            YND.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
            YND.GraphicsDevice.BlendState = BlendState.Additive;
            YND.GraphicsDevice.DepthStencilState = DepthStencilState.None;

            YND.GraphicsDevice.SetVertexBuffers(new VertexBufferBinding(_bilboardVertices, 0, 0), new VertexBufferBinding(_instanceVertices, 0, 1));
            YND.GraphicsDevice.Indices = _bilboardIndices;
            YND.GraphicsDevice.DrawInstancedPrimitives(PrimitiveType.TriangleList, 0, 0, _bilboardVertices.VertexCount, 0, 2, _instanceVertices.VertexCount);

            YND.GraphicsDevice.BlendState = BlendState.Opaque;
            YND.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        }
Пример #3
0
 public void Render(GameTime time, RendererPass rendererPass)
 {
     using (var sbh = new SpriteBatchHelper())
     {
         Vector2 position = new Vector2(YND.GraphicsDevice.Viewport.Width, YND.GraphicsDevice.Viewport.Height) * YND.SensorMouse.RightHandPosition;
         sbh.Draw(_texture, position, Vector2.One * _size, Color.Lime, _rotation, 1, true);
     }
 }
Пример #4
0
 public void Render(GameTime time, RendererPass rendererPass)
 {
     using (var sbh = new SpriteBatchHelper())
     {
         sbh.Draw(_texture, _position, Vector2.One * _size, Color.White, _rotation);
         sbh.DrawStringOutlined(_font, _caption, _position, 0, Color.White, Color.Black, 2);
     }
 }
Пример #5
0
        public override void DrawFrame(GameTime time, RendererPass resultPass)
        {
            _background.Render(time, resultPass);

            using (var sbh = new SpriteBatchHelper())
            {
                sbh.DrawStringOutlined(_font, YND.Speech[voices[currentSlot]].Text, new Vector2(640, 60), 1200, Color.White, Color.Black, 2, 1);
                for (int i = 0; i < 5; i++) sbh.Draw(pictures[i], new Vector2(640 * (i * 2 + 1) - displayOffset, 360), new Vector2(756, 471), Color.White);
            }
        }
Пример #6
0
        public override void DrawFrame(GameTime time, RendererPass resultPass)
        {
            _background.Render(time, resultPass);

            Color color = Color.White;
            if (fadeTime < 2) color = Color.Lerp(Color.Transparent, Color.White, fadeTime / 2.0f);
            if (fadeTime > 6) color = Color.Lerp(Color.White, Color.Transparent, (fadeTime - 6) / 2.0f);

            using (var sbh = new SpriteBatchHelper())
            {
                sbh.Draw(_logo, new Vector2(640, 360), new Vector2(756, 471), color);
            }
        }
 public void Render(GameTime time, RendererPass rendererPass)
 {
     if (rendererPass.RenderType == RenderType.DarknessMask)
     {
         YND.GraphicsDevice.BlendState = StaticStates.BlackState;
         RenderObject();
         YND.GraphicsDevice.BlendState = BlendState.Opaque;
     }
     else
     {
         if(rendererPass.Lights.Length > 0) _model.SetMainLightSource(Position - rendererPass.Lights[0]);
         RenderObject();
     }
 }
Пример #8
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());
            }
        }
Пример #9
0
 protected void DrawStarsOrdered(GameTime time, RendererPass renderPass)
 {
     var stars = SpaceModel.Planets.Where(o => o is StarObject);
     stars.Each(star => (star as IDrawableCelestial).Render(time, renderPass));
 }
Пример #10
0
 protected void DrawPlanetsOrdered(GameTime time, RendererPass renderPass)
 {
     var planets = SpaceModel.Planets.Where(o => !(o is StarObject) && o is IDrawableCelestial);
     planets.Each(planet => (planet as IDrawableCelestial).Render(time, renderPass));
 }
Пример #11
0
 protected void DrawCelestialsOrdered(GameTime time, RendererPass renderPass)
 {
     PrepareCeletialsForDrawing();
     DrawPlanetsOrdered(time, renderPass);
     DrawStarsOrdered(time, renderPass);
 }
Пример #12
0
 public override void DrawFrame(GameTime time, RendererPass resultPass)
 {
     _background.Render(time, resultPass);
 }
Пример #13
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);
            }
        }
Пример #14
0
        private void RemoveFromLightMask(RendererPass rendererPass)
        {
            YND.GraphicsDevice.SetRenderTarget(rendererPass.RenderTarget);

            YND.GraphicsDevice.BlendState = StaticStates.BlackState;
            model.Render(Matrix.CreateScale(1.05f) * _worldMatrix, new TextureShaderParameters());
            YND.GraphicsDevice.BlendState = BlendState.Opaque;
        }
Пример #15
0
 public void Render(GameTime time, RendererPass rendererPass)
 {
     var world = Matrix.CreateScale(50f) * Matrix.CreateTranslation(Camera.Instance.Position);
     _model.Render(world, new TextureShaderParameters());
 }
Пример #16
0
 public virtual void DrawFrame(GameTime time, RendererPass resultPass)
 {
 }