mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-24 20:12:23 +00:00
* Fix BoundingRect unit tests. * Create `graphics` library. * DynamicBatchRenderer2D * remove sprite * remove shipbuilder artifact
35 lines
1.1 KiB
C#
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];
|
|
}
|
|
}
|
|
}
|