// Copyright (c) Craftwork Games. All rights reserved.
// Licensed under the MIT license.
// See LICENSE file in the project root for full license information.
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MonoGame.Extended.Graphics;
public static class GraphicsDeviceExtensions
{
#if FNA
// MomoGame compatibility layer
///
/// Draw geometry by indexing into the vertex buffer.
///
/// The type of primitives in the index buffer.
/// Used to offset the vertex range indexed from the vertex buffer.
/// The index within the index buffer to start drawing from.
/// The number of primitives to render from the index buffer.
public static void DrawIndexedPrimitives(this GraphicsDevice graphicsDevice, PrimitiveType primitiveType, int baseVertex, int startIndex, int primitiveCount)
{
int minVertexIndex = 0;
int numVertices = graphicsDevice.GetVertexBuffers()[0].VertexBuffer.VertexCount;
graphicsDevice.DrawIndexedPrimitives(primitiveType, baseVertex, minVertexIndex, numVertices, startIndex, primitiveCount);
}
#endif
}