Пример #1
0
        /// <summary>
        /// Causes a direct screen paint rendering of a quad that covers the specified world area.
        /// </summary>
        /// <param name="area">The area in world space to render.</param>
        public void DirectScreenPaint(VertexPrimitive area)
        {
            VertexPrimitive pixelArea = this.gameWorld.GetPixelFromWorld(area);

            // Render the quad
            this.GraphicsDevice.DrawUserPrimitives(pixelArea.PrimitiveType, pixelArea.GetVertexData(), 0, pixelArea.Count - 2, VertexPositionTexture.VertexDeclaration);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="VertexPrimitive"/> class for an existing instance and applies the specified scale to all vertices.
 /// </summary>
 /// <param name="source">The source vertex primitive.</param>
 /// <param name="scale">The scale factor.</param>
 public VertexPrimitive(VertexPrimitive source, float scale)
     : this(source.primitiveType, source.Count)
 {
     foreach (Vector2 currVector in source)
     {
         this.Add(currVector * scale);
     }
 }
Пример #3
0
 /// <summary>
 /// Converts world units to pixel units.
 /// </summary>
 /// <param name="world">The world value.</param>
 /// <returns>The pixel version of the world value.</returns>
 public VertexPrimitive GetPixelFromWorld(VertexPrimitive world)
 {
     return(new VertexPrimitive(world, this.PixelPerWorldRatio));
 }