Files
MonoGame.Extended/Source/MonoGame.Extended.Graphics/Geometry/GraphicsGeometryBuilder.cs
T
Lucas Girouard-StranksandDylan Wilson b3b634fbad DynamicBatch rework (#317)
* Fix BoundingRect unit tests.

* Create `graphics` library.

* DynamicBatchRenderer2D

* remove sprite

* remove shipbuilder artifact
2016-11-29 20:03:46 +10:00

35 lines
1.1 KiB
C#

using System;
using Microsoft.Xna.Framework.Graphics;
namespace MonoGame.Extended.Graphics.Geometry
{
public abstract class GraphicsGeometryBuilder<TVertexType, TIndexType>
where TVertexType : struct, IVertexType
where TIndexType : struct
{
public PrimitiveType PrimitiveType { get; }
public int PrimitivesCount { get; }
public TVertexType[] Vertices { get; }
public TIndexType[] Indices { get; }
protected GraphicsGeometryBuilder(PrimitiveType primitiveType, int verticesCount, int indicesCount)
{
PrimitiveType = primitiveType;
PrimitivesCount = primitiveType.GetPrimitivesCount(indicesCount);
if (verticesCount < 1)
{
throw new ArgumentOutOfRangeException(nameof(verticesCount));
}
if (indicesCount < 1)
{
throw new ArgumentOutOfRangeException(nameof(indicesCount));
}
Vertices = new TVertexType[verticesCount];
Indices = new TIndexType[indicesCount];
}
}
}