26.09.2020

+ Added BoundingBoxes to Meshes
+ SM.Base.Objects.Mesh
+ Vertex Colors
+ ShowItem Collections + 2D Equlivant
+ Default Class to store Default Values
+ SM.OGL.GLSystem to store OpenGL specific system information

+ SM2D.DrawColor // not working yet
+ SM2D.DrawComplex to allow access to all features.
+ SM2D.DrawPolygon
+ Polygon system // for 2D only yet

~ Renamed SM.OGL.Mesh to SM.OGL.GenericMesh
This commit is contained in:
Michel Fedde 2020-09-26 23:40:16 +02:00
parent c4a0847567
commit 617a7ef044
39 changed files with 598 additions and 66 deletions

View file

@ -39,6 +39,8 @@ namespace SM.Base.Text
set => _material.Tint = value;
}
public float Spacing = 1;
protected TextDrawingBasis(Font font)
{
_material.Texture = font;
@ -57,8 +59,15 @@ namespace SM.Base.Text
_modelMatrixs = new Instance[_text.Length];
float x = 0;
CharParameter _last = new CharParameter();
for (var i = 0; i < _text.Length; i++)
{
if (_text[i] == 32)
{
x += _last.Width * Spacing;
continue;
}
CharParameter parameter;
try
{
@ -66,17 +75,20 @@ namespace SM.Base.Text
}
catch
{
throw new Exception("Font doesn't contain '"+_text[i]+"'");
throw new Exception("Font doesn't contain '" + _text[i] + "'");
}
Matrix4 matrix = Matrix4.CreateScale(parameter.Width, Font.Height, 1) * Matrix4.CreateTranslation(x, 0, 0);
Matrix4 matrix = Matrix4.CreateScale(parameter.Width, Font.Height, 1) *
Matrix4.CreateTranslation(x, 0, 0);
_modelMatrixs[i] = new Instance
{
ModelMatrix = matrix,
TexturePosition = new Vector2(parameter.RelativeX, 0),
TextureScale = new Vector2(parameter.RelativeWidth, 1)
};
x += parameter.Width;
x += parameter.Width * Spacing;
_last = parameter;
}
}
}