Loads and loads of small improvements I added while developing on my game
This commit is contained in:
parent
41421b1df9
commit
a7c71e7ea1
107 changed files with 2278 additions and 1023 deletions
|
|
@ -16,13 +16,16 @@ namespace SM2D.Object
|
|||
{
|
||||
public Polygon(ICollection<Vector2> vertices) : base(PrimitiveType.TriangleFan)
|
||||
{
|
||||
Color.Active = false;
|
||||
|
||||
foreach (var vertex in vertices)
|
||||
{
|
||||
Color.Add(Color4.White);
|
||||
AddVertex(vertex);
|
||||
Vertex.Add(vertex, 0);
|
||||
}
|
||||
|
||||
foreach (var vertex in vertices) AddUV(vertex);
|
||||
UpdateBoundingBox();
|
||||
|
||||
if (UVs.Active) foreach (var vertex in vertices) AddUV(vertex);
|
||||
}
|
||||
|
||||
public Polygon(ICollection<PolygonVertex> vertices) : base(PrimitiveType.TriangleFan)
|
||||
|
|
@ -30,10 +33,12 @@ namespace SM2D.Object
|
|||
foreach (var polygonVertex in vertices)
|
||||
{
|
||||
Color.Add(polygonVertex.Color);
|
||||
AddVertex(polygonVertex.Vertex);
|
||||
Vertex.Add(polygonVertex.Vertex, 0);
|
||||
}
|
||||
|
||||
foreach (var vertex in vertices) AddUV(vertex.Vertex);
|
||||
UpdateBoundingBox();
|
||||
|
||||
if (UVs.Active) foreach (var vertex in vertices) AddUV(vertex.Vertex);
|
||||
}
|
||||
|
||||
public override VBO Vertex { get; protected set; } = new VBO();
|
||||
|
|
@ -42,12 +47,6 @@ namespace SM2D.Object
|
|||
|
||||
public override PrimitiveType PrimitiveType { get; protected set; } = PrimitiveType.TriangleFan;
|
||||
|
||||
private void AddVertex(Vector2 vertex)
|
||||
{
|
||||
BoundingBox.Update(vertex);
|
||||
Vertex.Add(vertex, 0);
|
||||
}
|
||||
|
||||
private void AddUV(Vector2 vertex)
|
||||
{
|
||||
var uv = Vector2.Divide(vertex - BoundingBox.Min.Xy, BoundingBox.Max.Xy - BoundingBox.Min.Xy);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue