Compare commits

..

No commits in common. "8fd00257d3d441566c283ee64f39dcd6f5e9a70c" and "ff4a158cdba9fd7a13abf7752b80f4739ab54e88" have entirely different histories.

4 changed files with 9 additions and 36 deletions

View File

@ -78,7 +78,7 @@ namespace Quik.OpenTK
if (!_glDriver.IsInit) if (!_glDriver.IsInit)
_glDriver.Init(); _glDriver.Init();
GL.Clear(GLEnum.GL_COLOR_BUFFER_BIT | GLEnum.GL_DEPTH_BUFFER_BIT); GL.Clear(GLEnum.GL_COLOR_BUFFER_BIT);
_glDriver.Draw(_vertexEngine.DrawQueue, view); _glDriver.Draw(_vertexEngine.DrawQueue, view);
_window.Context.SwapBuffers(); _window.Context.SwapBuffers();

View File

@ -118,10 +118,10 @@ namespace Quik.OpenGL
foreach (DrawCall call in queue) foreach (DrawCall call in queue)
{ {
GL.Scissor( GL.Scissor(
(int)MathF.Round(call.Bounds.Min.X), (int)MathF.Round(call.Bounds.Left),
(int)MathF.Round(size.Y - call.Bounds.Max.Y), (int)MathF.Round(view.Bottom - call.Bounds.Bottom),
(int)MathF.Round(call.Bounds.Size.X), (int)MathF.Round(call.Bounds.Right),
(int)MathF.Round(call.Bounds.Size.Y)); (int)MathF.Round(view.Bottom - call.Bounds.Top));
QMat4.Translation(out QMat4 modelMatrix, call.Bounds.Min.X, call.Bounds.Min.Y, 0); QMat4.Translation(out QMat4 modelMatrix, call.Bounds.Min.X, call.Bounds.Min.Y, 0);
QMat4 modelView = viewMatrix * modelMatrix; QMat4 modelView = viewMatrix * modelMatrix;
GL.UniformMatrix4(m4Transforms, false, in modelView); GL.UniformMatrix4(m4Transforms, false, in modelView);

View File

@ -21,7 +21,6 @@ namespace Quik.OpenGL
GL_BLEND = 0x0BE2, GL_BLEND = 0x0BE2,
GL_COLOR_BUFFER_BIT = 0x00004000, GL_COLOR_BUFFER_BIT = 0x00004000,
GL_DEPTH_BUFFER_BIT = 0x00000100,
GL_SRC_ALPHA = 0x0302, GL_SRC_ALPHA = 0x0302,
GL_ONE_MINUS_SRC_ALPHA = 0x0303, GL_ONE_MINUS_SRC_ALPHA = 0x0303,

View File

@ -2,7 +2,9 @@
using Quik.Media; using Quik.Media;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace Quik.Typography namespace Quik.Typography
{ {
@ -74,38 +76,10 @@ namespace Quik.Typography
} }
} }
public static QVec2 MeasureHorizontal(ReadOnlySpan<char> str, float size, QFont font) public static void TypesetHorizontalDirect(this CommandList list, string str, QVec2 origin, float size, QFont font)
{
var enumerator = new LineEnumerator(str);
float width = 0.0f;
float height = 0.0f;
while (enumerator.MoveNext())
{
ReadOnlySpan<char> line = enumerator.Current;
float lineHeight = 0.0f;
foreach (Rune r in line.EnumerateRunes())
{
int codepoint = r.Value;
font.Get(codepoint, size, out FontGlyph glyph);
width += glyph.Metrics.Advance.X;
lineHeight = Math.Max(lineHeight, glyph.Metrics.Size.Y);
}
height += lineHeight;
}
return new QVec2(width, height);
}
public static void TypesetHorizontalDirect(this CommandList list, ReadOnlySpan<char> str, QVec2 origin, float size, QFont font)
{ {
Dictionary<QImage, FontDrawInfo> drawInfo = new Dictionary<QImage, FontDrawInfo>(); Dictionary<QImage, FontDrawInfo> drawInfo = new Dictionary<QImage, FontDrawInfo>();
var enumerator = new LineEnumerator(str); var enumerator = new LineEnumerator(str.AsSpan());
QVec2 pen = origin; QVec2 pen = origin;
while (enumerator.MoveNext()) while (enumerator.MoveNext())