예제 #1
0
 /// <summary>
 /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its options map.
 /// Override this method with component-specific drawing code.
 /// </summary>
 /// <param name="gameTime">Time passed since the last call to DrawOptionsMap.</param>
 /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
 /// <param name="drawBoundingBox">The bounding box of the sprite within the texture.</param>
 protected void DrawOptionsMap(GameTime gameTime, DeferredRenderSystem renderSystem, Rectangle drawBoundingBox)
 {
     renderSystem.BeginRender(this.optionMapFlagsShader);
     this.optionMapFlagsShader.ConfigureShaderAndApplyPass(renderSystem, this);
     renderSystem.DrawSprite(this.spriteTexture, this.Position, drawBoundingBox, Color.White, this.Rotation, Vector2.Zero, this.RenderScale, SpriteEffects.None);
     renderSystem.EndRender();
 }
예제 #2
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to be drawn.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawColorMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender();

            this.ForEachTile((pos, rect) => renderSystem.DrawSprite(this.SpriteTexture, pos, rect, this.RenderColor, this.Rotation, Vector2.Zero, this.RenderScale, SpriteEffects.None));

            renderSystem.EndRender();
        }
 /// <summary>
 /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to be drawn.
 /// Override this method with component-specific drawing code.
 /// </summary>
 /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
 /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
 public override void DrawColorMap(GameTime gameTime, DeferredRenderSystem renderSystem)
 {
     renderSystem.BeginRender(this.shaderAsset);
     this.shaderAsset.ConfigureShader(renderSystem);
     this.shaderAsset.ApplyPass(0);
     renderSystem.DrawSprite(this.SpriteTexture, this.Position, null, this.RenderColor, this.Rotation, Vector2.Zero, this.RenderScale, SpriteEffects.None);
     renderSystem.EndRender();
 }
예제 #4
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its options map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawOptionsMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawOptionsMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender(this.OptionMapFlagsShader);
            this.OptionMapFlagsShader.ConfigureShaderAndApplyPass(renderSystem, this);

            this.ForEachTile((pos, rect) => renderSystem.DrawSprite(this.SpriteTexture, pos, rect, Color.White, this.Rotation, Vector2.Zero, this.RenderScale, SpriteEffects.None));

            renderSystem.EndRender();
        }
예제 #5
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its options map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawOptionsMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender(this.optionMapFlagsShader);
            this.optionMapFlagsShader.ConfigureShaderAndApplyPass(renderSystem, this);

            RectangleF posRect = new RectangleF(this.targetSprite.Position.X - this.lineWidth * 2.0f, this.targetSprite.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);

            renderSystem.DrawFilledRectangle(posRect, Color.Black, this.Rotation);                                                                   // Draw position
            renderSystem.DrawRectangleBorder(this.targetSprite.SpriteWorldBounds, Color.Black, this.lineWidth, 0.0f);                                // Draw bounding rectangle
            renderSystem.DrawLine(this.targetSprite.Position, this.targetSprite.Position + this.targetSprite.Velocity, Color.Black, this.lineWidth); // Draw velocity line

            renderSystem.EndRender();
        }
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its color map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawColorMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender();

            RectangleF posRect = new RectangleF(this.targetPostProcess.Position.X - this.lineWidth * 2.0f, this.targetPostProcess.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);
            float      lineMag = this.targetPostProcess.Velocity.Length();

            renderSystem.DrawFilledRectangle(posRect, Color.White, this.targetPostProcess.Rotation);                                                               // Draw position
            renderSystem.DrawRectangleBorder(this.targetPostProcess.GetWorldDrawBounds(), Color.Green, this.lineWidth, 0.0f);                                      // Draw bounding rectangle
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + this.targetPostProcess.Velocity, Color.Blue, this.lineWidth); // Draw velocity line
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + (lineMag * this.targetPostProcess.RotationVector), Color.OrangeRed, this.lineWidth);

            renderSystem.EndRender();
        }
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its options map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawOptionsMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender(this.optionMapFlagsShader);
            this.optionMapFlagsShader.ConfigureShaderAndApplyPass(renderSystem, this);

            RectangleF posRect = new RectangleF(this.targetPostProcess.Position.X - this.lineWidth * 2.0f, this.targetPostProcess.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);
            float      lineMag = this.targetPostProcess.Velocity.Length();

            renderSystem.DrawFilledRectangle(posRect, Color.Black, this.targetPostProcess.Rotation);                                                                // Draw position
            renderSystem.DrawRectangleBorder(this.targetPostProcess.GetWorldDrawBounds(), Color.Black, this.lineWidth, 0.0f);                                       // Draw bounding rectangle
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + this.targetPostProcess.Velocity, Color.Black, this.lineWidth); // Draw velocity line
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + (lineMag * this.targetPostProcess.RotationVector), Color.Black, this.lineWidth);

            renderSystem.EndRender();
        }
예제 #8
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its color map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawColorMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender();

            RectangleF posRect = new RectangleF(this.targetSprite.Position.X - this.lineWidth * 2.0f, this.targetSprite.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);

            renderSystem.DrawFilledRectangle(posRect, Color.White, this.Rotation); // Draw position

            // Draw shape outline if it exists
            if (this.targetSprite.SpriteWorldShape != null)
            {
                for (int index = 0; index < this.targetSprite.SpriteWorldShape.Count - 1; index++)
                {
                    renderSystem.DrawLine(this.targetSprite.SpriteWorldShape[index], this.targetSprite.SpriteWorldShape[index + 1], Color.Red, this.lineWidth);
                }
            }

            renderSystem.DrawRectangleBorder(this.targetSprite.SpriteWorldBounds, Color.Green, this.lineWidth, 0.0f);                               // Draw bounding rectangle
            renderSystem.DrawLine(this.targetSprite.Position, this.targetSprite.Position + this.targetSprite.Velocity, Color.Blue, this.lineWidth); // Draw velocity line

            renderSystem.EndRender();
        }
예제 #9
0
 /// <summary>
 /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its normal map.
 /// Override this method with component-specific drawing code.
 /// </summary>
 /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
 /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
 /// <param name="drawBoundingBox">The bounding box of the sprite within the texture.</param>
 protected void DrawNormalMap(GameTime gameTime, DeferredRenderSystem renderSystem, Rectangle drawBoundingBox)
 {
     renderSystem.BeginRender();
     renderSystem.DrawSprite(this.spriteNormalTexture, this.Position, drawBoundingBox, Color.White, this.Rotation, Vector2.Zero, this.RenderScale, SpriteEffects.None);
     renderSystem.EndRender();
 }