public void Draw(Ship ship, LineBatch lineBatch, PointBatch pointBatch, Camera camera)
        {
            // Draw the ship
            Matrix rotation = Matrix.CreateRotationZ(ship.Movement.Rotation);
            Matrix translation = Matrix.CreateTranslation(new Vector3(ship.Movement.Position.X, ship.Movement.Position.Y, 0.0f));

            lineBatch.Begin(rotation * translation, camera);

            for (int v = 0; v < vertices.Count; v++)
            {
                lineBatch.Draw(vertices[v], vertices[(v + 1) % vertices.Count], lineWidth, color);
            }

            lineBatch.End();

            pointBatch.Begin(translation, camera);
            pointBatch.Draw(Vector3.Zero, lightRadius, lightColor);
            pointBatch.End();
        }
 /// <summary>
 /// Loads graphics content needed to display the world
 /// </summary>
 /// <param name="graphicsDevice"></param>
 public void LoadContent(GraphicsDevice graphicsDevice)
 {
     lineBatch = new LineBatch(graphicsDevice);
     pointBatch = new PointBatch(graphicsDevice);
     spriteBatch = new SpriteBatch(graphicsDevice);
     bloom = new Bloom(graphicsDevice, spriteBatch);
 }
Esempio n. 3
0
        public void Draw(LineBatch lineBatch, Camera camera)
        {
            lineBatch.Begin(Matrix.Identity, camera);

            for (int i = 0; i < startPoints.Count; i++)
            {
                lineBatch.Draw(startPoints[i], endPoints[i], widths[i], colors[i]);
            }

            lineBatch.Draw(new Vector3(bounds.Min.X, bounds.Min.Y, bounds.Min.Z), new Vector3(bounds.Max.X, bounds.Min.Y, bounds.Max.Z), 5.0f, Color.White);
            lineBatch.Draw(new Vector3(bounds.Min.X, bounds.Max.Y, bounds.Min.Z), new Vector3(bounds.Max.X, bounds.Max.Y, bounds.Max.Z), 5.0f, Color.White);
            lineBatch.Draw(new Vector3(bounds.Min.X, bounds.Min.Y, bounds.Min.Z), new Vector3(bounds.Min.X, bounds.Max.Y, bounds.Max.Z), 5.0f, Color.White);
            lineBatch.Draw(new Vector3(bounds.Max.X, bounds.Min.Y, bounds.Min.Z), new Vector3(bounds.Max.X, bounds.Max.Y, bounds.Max.Z), 5.0f, Color.White);

            lineBatch.End();
        }