Example #1
0
 /// <inheritdoc />
 protected override void UnloadContent()
 {
     Primitive.Dispose();
     Arrows.ForEach(arrow => arrow.Dispose());
     Arrows.Clear();
     Primitive.Dispose();
     FullScreenQuad.Dispose();
     Effect.Dispose();
     DebugTextureEffect.Dispose();
     base.UnloadContent();
 }
Example #2
0
        /// <inheritdoc />
        public override void Draw(GameTime gameTime)
        {
            Game.Background = Color.Black;

            var viewProjection = Camera.View * Camera.Projection;

            GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            GraphicsDevice.SetRenderTarget(DepthRenderTarget);
            GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);

            DrawSpheres(DrawDepthEffect, viewProjection);


            // Set the render target as null, we are drawing on the screen!
            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);

            DrawSpheres(Effect, viewProjection);

            RasterizerState rasterizerState = new RasterizerState();

            rasterizerState.CullMode       = CullMode.None;
            GraphicsDevice.RasterizerState = rasterizerState;

            if (ShowArrows)
            {
                Arrows.ForEach(arrow => arrow.Draw(Matrix.Identity, Camera.View, Camera.Projection));
            }


            // Debug our shadowmap!
            // Show a simple quad with the texture
            DebugTextureEffect.Parameters["World"].SetValue(Matrix.CreateScale(0.2f) * Matrix.CreateTranslation(new Vector3(-0.75f, -0.75f, 0f)));
            DebugTextureEffect.Parameters["baseTexture"].SetValue(DepthRenderTarget);
            FullScreenQuad.Draw(DebugTextureEffect);

            Game.SpriteBatch.Begin();
            Game.SpriteBatch.DrawString(SpriteFont, "Con la tecla 'J' se prende y apaga el modo Wireframe",
                                        new Vector2(50, 50), Color.Yellow);
            Game.SpriteBatch.DrawString(SpriteFont, "Con la tecla 'K' se prenden y apagan las flechas", new Vector2(50, 80),
                                        Color.LightYellow);
            Game.SpriteBatch.DrawString(SpriteFont, "Con la tecla 'L' se habilita y deshabilita el back-face culling", new Vector2(50, 110),
                                        Color.LightGreen);
            Game.SpriteBatch.End();

            AxisLines.Draw(Camera.View, Camera.Projection);
            base.Draw(gameTime);
        }
 public override void Render()
 {
     //set Arrow Properties
     foreach (var arrow in Arrows)
     {
         arrow.Fill            = Fill;
         arrow.StrokeThickness = StrokeThickness;
         arrow.Thickness       = Thickness;
         arrow.Stroke          = Stroke;
         arrow.Visibility      = Visibility;
     }
     //set headLine Properties
     HeaderLine.Fill            = Fill;
     HeaderLine.StrokeThickness = StrokeThickness;
     HeaderLine.Thickness       = Thickness;
     HeaderLine.Stroke          = Stroke;
     HeaderLine.Visibility      = Visibility;
     //
     HeaderLine.Render();
     Arrows.ForEach(e => e.Render());
 }
        public override void SetScale(double value)
        {
            HeaderLine.SetScale(value);
            HeaderLine.SetTranslate(0, -Height * value + Height);
            Arrows.ForEach(e => e.Remove());

            Spacings = 10 * value;
            var span = Math.Sqrt(
                Math.Pow(StartPoint.X - EndPoint.X, 2) +
                Math.Pow(StartPoint.Y - EndPoint.Y, 2));

            var spaces = Split.Equal(span * value, Spacings);

            foreach (var space in spaces)
            {
                var arrow = new Arrow(GCanvas, new Point(StartPoint.X + space, StartPoint.Y), Height * value);
                arrow.Rotate(180);

                Arrows.Add(arrow);
            }
            HeaderLine.Remove();
            Render();
        }
 public override void Hide()
 {
     HeaderLine.Hide();
     Arrows.ForEach(e => e.Hide());
 }
 public override void Remove()
 {
     GCanvas.Canvas.Children.Remove(HeaderLine.Line);
     Arrows.ForEach(e => e.Remove());
     Arrows.Clear();
 }