Added Summeries
This commit is contained in:
parent
71a22df8bd
commit
8296d9b8a9
47 changed files with 812 additions and 177 deletions
|
|
@ -11,8 +11,27 @@ using SM.OGL.Mesh;
|
|||
|
||||
namespace SM2D.Object
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a polygon.
|
||||
/// </summary>
|
||||
public class Polygon : Mesh
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override VBO Vertex { get; protected set; } = new VBO();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override VBO UVs { get; protected set; } = new VBO(pointerSize: 2);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override VBO Color { get; protected set; } = new VBO(pointerSize: 4);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override PrimitiveType PrimitiveType { get; protected set; } = PrimitiveType.TriangleFan;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a polygon with <see cref="Vector2"/>s.
|
||||
/// </summary>
|
||||
/// <param name="vertices"></param>
|
||||
public Polygon(ICollection<Vector2> vertices) : base(PrimitiveType.TriangleFan)
|
||||
{
|
||||
Color.Active = false;
|
||||
|
|
@ -27,25 +46,23 @@ namespace SM2D.Object
|
|||
if (UVs.Active) foreach (var vertex in vertices) AddUV(vertex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a polygon with <see cref="PolygonVertex"/>, what allows colors hard coded.
|
||||
/// </summary>
|
||||
/// <param name="vertices"></param>
|
||||
public Polygon(ICollection<PolygonVertex> vertices) : base(PrimitiveType.TriangleFan)
|
||||
{
|
||||
foreach (var polygonVertex in vertices)
|
||||
{
|
||||
Color.Add(polygonVertex.Color);
|
||||
Vertex.Add(polygonVertex.Vertex, 0);
|
||||
Vertex.Add(polygonVertex.Position, 0);
|
||||
}
|
||||
|
||||
UpdateBoundingBox();
|
||||
|
||||
if (UVs.Active) foreach (var vertex in vertices) AddUV(vertex.Vertex);
|
||||
if (UVs.Active) foreach (var vertex in vertices) AddUV(vertex.Position);
|
||||
}
|
||||
|
||||
public override VBO Vertex { get; protected set; } = new VBO();
|
||||
public override VBO UVs { get; protected set; } = new VBO(pointerSize: 2);
|
||||
public override VBO Color { get; protected set; } = new VBO(pointerSize: 4);
|
||||
|
||||
public override PrimitiveType PrimitiveType { get; protected set; } = PrimitiveType.TriangleFan;
|
||||
|
||||
private void AddUV(Vector2 vertex)
|
||||
{
|
||||
var uv = Vector2.Divide(vertex - BoundingBox.Min.Xy, BoundingBox.Max.Xy - BoundingBox.Min.Xy);
|
||||
|
|
@ -53,6 +70,11 @@ namespace SM2D.Object
|
|||
UVs.Add(uv);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a circle.
|
||||
/// </summary>
|
||||
/// <param name="secments"></param>
|
||||
/// <returns></returns>
|
||||
public static Polygon GenerateCircle(int secments = 32)
|
||||
{
|
||||
var vertices = new List<Vector2> {Vector2.Zero};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue