Holidays 12.10. -> 25.10.2020
~ Moved code around in files. SM.Base: + PostProcessing-system + OnInitialization() for Scenes. + Shader-Extensions + Added option to not react while unfocused to the window. + Added Screenshots to the window. + Connected the log system to the SM.OGL-action system. ~ Replaced IShader with abstract MaterialShader. ~ When a log compression folder doesn't exist, it will create one. SM.OGL: + Added support for UniformArrays + Added ShaderPreProcessing + Added Shader Extensions. + Added Debug actions. + SM.OGL settings ~ Framebuffer Size is automaticly changed, when the window and scale is set. SM2D: + Added easy shader drawing.
This commit is contained in:
parent
2c00dbd31a
commit
03b3942732
102 changed files with 2683 additions and 1398 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
#region usings
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
|
@ -7,46 +8,40 @@ using OpenTK.Graphics.OpenGL4;
|
|||
using SM.Base.Objects;
|
||||
using SM.OGL.Mesh;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace SM2D.Object
|
||||
{
|
||||
public class Polygon : Mesh
|
||||
{
|
||||
public override VBO Vertex { get; } = new VBO();
|
||||
public override VBO UVs { get; } = new VBO(pointerSize:2);
|
||||
public override VBO Color { get; } = new VBO(pointerSize: 4);
|
||||
|
||||
public override PrimitiveType PrimitiveType { get; } = PrimitiveType.TriangleFan;
|
||||
|
||||
|
||||
|
||||
public Polygon(ICollection<Vector2> vertices)
|
||||
{
|
||||
foreach (Vector2 vertex in vertices)
|
||||
foreach (var vertex in vertices)
|
||||
{
|
||||
Color.Add(Color4.White);
|
||||
AddVertex(vertex);
|
||||
}
|
||||
|
||||
foreach (Vector2 vertex in vertices)
|
||||
{
|
||||
AddUV(vertex);
|
||||
}
|
||||
foreach (var vertex in vertices) AddUV(vertex);
|
||||
}
|
||||
|
||||
public Polygon(ICollection<PolygonVertex> vertices)
|
||||
{
|
||||
foreach (PolygonVertex polygonVertex in vertices)
|
||||
foreach (var polygonVertex in vertices)
|
||||
{
|
||||
Color.Add(polygonVertex.Color);
|
||||
AddVertex(polygonVertex.Vertex);
|
||||
}
|
||||
|
||||
foreach (PolygonVertex vertex in vertices)
|
||||
{
|
||||
AddUV(vertex.Vertex);
|
||||
}
|
||||
foreach (var vertex in vertices) AddUV(vertex.Vertex);
|
||||
}
|
||||
|
||||
public override VBO Vertex { get; } = new VBO();
|
||||
public override VBO UVs { get; } = new VBO(pointerSize: 2);
|
||||
public override VBO Color { get; } = new VBO(pointerSize: 4);
|
||||
|
||||
public override PrimitiveType PrimitiveType { get; } = PrimitiveType.TriangleFan;
|
||||
|
||||
private void AddVertex(Vector2 vertex)
|
||||
{
|
||||
BoundingBox.Update(vertex);
|
||||
|
|
@ -55,18 +50,19 @@ namespace SM2D.Object
|
|||
|
||||
private void AddUV(Vector2 vertex)
|
||||
{
|
||||
Vector2 uv = Vector2.Divide(vertex, BoundingBox.Max.Xy) + BoundingBox.Min.Xy;
|
||||
var uv = Vector2.Divide(vertex, BoundingBox.Max.Xy) + BoundingBox.Min.Xy;
|
||||
UVs.Add(uv);
|
||||
}
|
||||
|
||||
public static Polygon GenerateCircle(int secments = 32)
|
||||
{
|
||||
List<Vector2> vertices = new List<Vector2>() {Vector2.Zero};
|
||||
var vertices = new List<Vector2> {Vector2.Zero};
|
||||
|
||||
float step = 360f / secments;
|
||||
for (int i = 0; i < secments + 1; i++)
|
||||
var step = 360f / secments;
|
||||
for (var i = 0; i < secments + 1; i++)
|
||||
{
|
||||
Vector2 vertex = new Vector2( 0.5f * (float)Math.Cos(step * i * Math.PI / 180f), 0.5f * (float)Math.Sin(step * i * Math.PI / 180f));
|
||||
var vertex = new Vector2(0.5f * (float) Math.Cos(step * i * Math.PI / 180f),
|
||||
0.5f * (float) Math.Sin(step * i * Math.PI / 180f));
|
||||
vertices.Add(vertex);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
using OpenTK;
|
||||
#region usings
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace SM2D.Object
|
||||
{
|
||||
public struct PolygonVertex
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue