Converted project to ^nullable enable.
This commit is contained in:
parent
55e9d775cd
commit
1ccab1c85a
@ -14,10 +14,10 @@ namespace Quik.OpenTK
|
|||||||
private readonly List<OpenTKPort> _ports = new List<OpenTKPort>();
|
private readonly List<OpenTKPort> _ports = new List<OpenTKPort>();
|
||||||
|
|
||||||
// These shall remain a sad nop for now.
|
// These shall remain a sad nop for now.
|
||||||
public string Title { get; set; }
|
public string? Title { get; set; }
|
||||||
public QImage Icon { get; set; }
|
public QImage? Icon { get; set; } = null;
|
||||||
|
|
||||||
public event EventHandler EventRaised;
|
public event EventHandler? EventRaised;
|
||||||
|
|
||||||
public NativeWindowSettings DefaultSettings { get; set; } = NativeWindowSettings.Default;
|
public NativeWindowSettings DefaultSettings { get; set; } = NativeWindowSettings.Default;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace Quik.OpenTK
|
|||||||
|
|
||||||
public bool IsValid => !isDisposed;
|
public bool IsValid => !isDisposed;
|
||||||
|
|
||||||
public event EventHandler EventRaised;
|
public event EventHandler? EventRaised;
|
||||||
|
|
||||||
public OpenTKPort(NativeWindow window)
|
public OpenTKPort(NativeWindow window)
|
||||||
{
|
{
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>7.3</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -28,7 +28,7 @@ namespace Quik.CommandMachine
|
|||||||
private float _f4;
|
private float _f4;
|
||||||
|
|
||||||
[FieldOffset(24)]
|
[FieldOffset(24)]
|
||||||
private object _object;
|
private object? _object = null;
|
||||||
|
|
||||||
public bool IsCommand => _type == FrameType.Command;
|
public bool IsCommand => _type == FrameType.Command;
|
||||||
public bool IsInteger =>
|
public bool IsInteger =>
|
||||||
@ -200,7 +200,7 @@ namespace Quik.CommandMachine
|
|||||||
|
|
||||||
public T As<T>()
|
public T As<T>()
|
||||||
{
|
{
|
||||||
return (T)_object;
|
return (T)_object!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetF(int i)
|
public float GetF(int i)
|
||||||
|
@ -75,11 +75,11 @@ namespace Quik.Controls
|
|||||||
cmd.PopStyle();
|
cmd.PopStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public event EventHandler StyleChanged;
|
public event EventHandler? StyleChanged;
|
||||||
public event EventHandler VisualsInvalidated;
|
public event EventHandler? VisualsInvalidated;
|
||||||
public event EventHandler VisualsValidated;
|
public event EventHandler? VisualsValidated;
|
||||||
public event EventHandler LayoutInvalidated;
|
public event EventHandler? LayoutInvalidated;
|
||||||
public event EventHandler LayoutValidated;
|
public event EventHandler? LayoutValidated;
|
||||||
|
|
||||||
protected virtual void OnStyleChanged(object sender, EventArgs ea)
|
protected virtual void OnStyleChanged(object sender, EventArgs ea)
|
||||||
{
|
{
|
||||||
|
@ -6,17 +6,16 @@ namespace Quik.Controls
|
|||||||
{
|
{
|
||||||
public class Label : Control
|
public class Label : Control
|
||||||
{
|
{
|
||||||
public string Text { get; set; }
|
public string Text { get; set; } = string.Empty;
|
||||||
public QFont Font { get; set; }
|
public QFont? Font { get; set; }
|
||||||
public float TextSize { get; set; }
|
public float TextSize { get; set; }
|
||||||
|
|
||||||
public bool AutoSize { get; set; } = true;
|
public bool AutoSize { get; set; } = true;
|
||||||
|
|
||||||
protected override void ValidateLayout()
|
protected override void ValidateLayout()
|
||||||
{
|
{
|
||||||
if (AutoSize)
|
if (AutoSize)
|
||||||
{
|
{
|
||||||
QVec2 size = Typesetter.MeasureHorizontal(Text, TextSize, Font);
|
QVec2 size = Typesetter.MeasureHorizontal(Text, TextSize, Font!);
|
||||||
Size = size;
|
Size = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,7 +25,7 @@ namespace Quik.Controls
|
|||||||
float padding = Padding;
|
float padding = Padding;
|
||||||
QVec2 origin = new QVec2(padding, padding);
|
QVec2 origin = new QVec2(padding, padding);
|
||||||
|
|
||||||
cmd.TypesetHorizontalDirect(Text, origin, TextSize, Font);
|
cmd.TypesetHorizontalDirect(Text, origin, TextSize, Font!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,8 +11,8 @@ namespace Quik.Controls
|
|||||||
{
|
{
|
||||||
private QVec2 size;
|
private QVec2 size;
|
||||||
|
|
||||||
public UIBase Parent { get; protected set; }
|
public UIBase? Parent { get; protected set; }
|
||||||
public string Id { get; set; }
|
public string? Id { get; set; }
|
||||||
public QRectangle Bounds
|
public QRectangle Bounds
|
||||||
{
|
{
|
||||||
get => new QRectangle(Position + Size, Position);
|
get => new QRectangle(Position + Size, Position);
|
||||||
@ -58,7 +58,7 @@ namespace Quik.Controls
|
|||||||
public bool IsMaximumSizeSet => MaximumSize != new QVec2(-1, -1);
|
public bool IsMaximumSizeSet => MaximumSize != new QVec2(-1, -1);
|
||||||
public bool IsMinimumSizeSet => MinimumSize != new QVec2(-1, -1);
|
public bool IsMinimumSizeSet => MinimumSize != new QVec2(-1, -1);
|
||||||
|
|
||||||
public virtual void NotifyEvent(object sender, EventArgs args)
|
public virtual void NotifyEvent(object? sender, EventArgs args)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ namespace Quik.Controls
|
|||||||
PaintEnd(cmd);
|
PaintEnd(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public event EventHandler<ResizedEventArgs> Resized;
|
public event EventHandler<ResizedEventArgs>? Resized;
|
||||||
|
|
||||||
public virtual void OnResized(object sender, ResizedEventArgs ea)
|
public virtual void OnResized(object sender, ResizedEventArgs ea)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,6 @@ namespace Quik.Media.Color
|
|||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
buffer = null;
|
|
||||||
if (handle.IsAllocated) handle.Free();
|
if (handle.IsAllocated) handle.Free();
|
||||||
|
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using Quik.Media.Color;
|
using Quik.Media.Color;
|
||||||
|
|
||||||
namespace Quik.Media.Font
|
namespace Quik.Media.Font
|
||||||
@ -20,7 +17,7 @@ namespace Quik.Media.Font
|
|||||||
private readonly List<AtlasPage> atlases = new List<AtlasPage>();
|
private readonly List<AtlasPage> atlases = new List<AtlasPage>();
|
||||||
private readonly Dictionary<int, FontAtlasGlyphInfo> glyphs = new Dictionary<int, FontAtlasGlyphInfo>();
|
private readonly Dictionary<int, FontAtlasGlyphInfo> glyphs = new Dictionary<int, FontAtlasGlyphInfo>();
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
private AtlasPage last = null;
|
private AtlasPage? last = null;
|
||||||
private bool isSdf = false;
|
private bool isSdf = false;
|
||||||
private int expansion;
|
private int expansion;
|
||||||
|
|
||||||
@ -31,7 +28,7 @@ namespace Quik.Media.Font
|
|||||||
{
|
{
|
||||||
foreach (AtlasPage page in atlases)
|
foreach (AtlasPage page in atlases)
|
||||||
{
|
{
|
||||||
(page.Image as QImageBuffer).SetSdf(value);
|
((QImageBuffer)page.Image).SetSdf(value);
|
||||||
}
|
}
|
||||||
isSdf = value;
|
isSdf = value;
|
||||||
}
|
}
|
||||||
@ -59,7 +56,7 @@ namespace Quik.Media.Font
|
|||||||
AddPage();
|
AddPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
last.PutGlyph(source, ref info);
|
last!.PutGlyph(source, ref info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddPage()
|
private void AddPage()
|
||||||
@ -73,7 +70,7 @@ namespace Quik.Media.Font
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
last = new AtlasPage(width, height, expansion);
|
last = new AtlasPage(width, height, expansion);
|
||||||
(last.Image as QImageBuffer).SetSdf(IsSdf);
|
((QImageBuffer)last.Image).SetSdf(IsSdf);
|
||||||
atlases.Add(last);
|
atlases.Add(last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,9 +74,9 @@ namespace Quik.Media.Font
|
|||||||
return this == other;
|
return this == other;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object? obj)
|
||||||
{
|
{
|
||||||
return (obj.GetType() == typeof(FontFace)) &&
|
return (obj?.GetType() == typeof(FontFace)) &&
|
||||||
this == (FontFace)obj;
|
this == (FontFace)obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace Quik.Media
|
|||||||
|
|
||||||
public void Get(int codepoint, float size, out FontGlyph glyph)
|
public void Get(int codepoint, float size, out FontGlyph glyph)
|
||||||
{
|
{
|
||||||
SizedFontCollection collection;
|
SizedFontCollection? collection;
|
||||||
|
|
||||||
if (!_atlasses.TryGetValue(size, out collection))
|
if (!_atlasses.TryGetValue(size, out collection))
|
||||||
{
|
{
|
||||||
@ -102,11 +102,11 @@ namespace Quik.Media
|
|||||||
public readonly struct FontGlyph
|
public readonly struct FontGlyph
|
||||||
{
|
{
|
||||||
public readonly int CodePoint;
|
public readonly int CodePoint;
|
||||||
public readonly QImage Image;
|
public readonly QImage? Image;
|
||||||
public readonly QGlyphMetrics Metrics;
|
public readonly QGlyphMetrics Metrics;
|
||||||
public readonly QRectangle UVs;
|
public readonly QRectangle UVs;
|
||||||
|
|
||||||
public FontGlyph(int codepoint, QImage image, in QGlyphMetrics metrics, in QRectangle uvs)
|
public FontGlyph(int codepoint, QImage? image, in QGlyphMetrics metrics, in QRectangle uvs)
|
||||||
{
|
{
|
||||||
CodePoint = codepoint;
|
CodePoint = codepoint;
|
||||||
Image = image;
|
Image = image;
|
||||||
|
@ -7,10 +7,10 @@ namespace Quik.OpenGL
|
|||||||
{
|
{
|
||||||
private delegate void BufferDataProc(GLEnum target, int size, void* data, GLEnum usageHint);
|
private delegate void BufferDataProc(GLEnum target, int size, void* data, GLEnum usageHint);
|
||||||
|
|
||||||
private static GenObjectsProc _genBuffers;
|
private static GenObjectsProc? _genBuffers;
|
||||||
private static GenObjectsProc _deleteBuffers;
|
private static GenObjectsProc? _deleteBuffers;
|
||||||
private static BindSlottedProc _bindBuffer;
|
private static BindSlottedProc? _bindBuffer;
|
||||||
private static BufferDataProc _bufferData;
|
private static BufferDataProc? _bufferData;
|
||||||
|
|
||||||
private static void LoadBuffer()
|
private static void LoadBuffer()
|
||||||
{
|
{
|
||||||
@ -24,7 +24,7 @@ namespace Quik.OpenGL
|
|||||||
public static void GenBuffers(int count, out int buffers)
|
public static void GenBuffers(int count, out int buffers)
|
||||||
{
|
{
|
||||||
fixed (int *ptr = &buffers)
|
fixed (int *ptr = &buffers)
|
||||||
_genBuffers(count, ptr);
|
_genBuffers!(count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -41,7 +41,7 @@ namespace Quik.OpenGL
|
|||||||
public static void DeleteBuffers(int count, ref int buffers)
|
public static void DeleteBuffers(int count, ref int buffers)
|
||||||
{
|
{
|
||||||
fixed (int *ptr = &buffers)
|
fixed (int *ptr = &buffers)
|
||||||
_deleteBuffers(count, ptr);
|
_deleteBuffers!(count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -53,19 +53,19 @@ namespace Quik.OpenGL
|
|||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void BindBuffer(GLEnum target, int buffer)
|
public static void BindBuffer(GLEnum target, int buffer)
|
||||||
{
|
{
|
||||||
_bindBuffer(target, buffer);
|
_bindBuffer!(target, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void BufferData(GLEnum target, int size, IntPtr data, GLEnum usageHint) =>
|
public static void BufferData(GLEnum target, int size, IntPtr data, GLEnum usageHint) =>
|
||||||
_bufferData(target, size, (void*)data, usageHint);
|
_bufferData!(target, size, (void*)data, usageHint);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void BufferData<T>(GLEnum target, int size, ref T data, GLEnum usageHint)
|
public static void BufferData<T>(GLEnum target, int size, ref T data, GLEnum usageHint)
|
||||||
where T : unmanaged
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed (T* ptr = &data)
|
fixed (T* ptr = &data)
|
||||||
_bufferData(target, size, ptr, usageHint);
|
_bufferData!(target, size, ptr, usageHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
|
@ -16,16 +16,16 @@ namespace Quik.OpenGL
|
|||||||
private delegate void DeleteProgramProc(int program);
|
private delegate void DeleteProgramProc(int program);
|
||||||
private delegate int GetShaderLocationProc(int program, byte *name);
|
private delegate int GetShaderLocationProc(int program, byte *name);
|
||||||
|
|
||||||
private static CreateProgramProc _createProgram;
|
private static CreateProgramProc? _createProgram;
|
||||||
private static UseProgramProc _useProgram;
|
private static UseProgramProc? _useProgram;
|
||||||
private static AttachShaderProc _attachShader;
|
private static AttachShaderProc? _attachShader;
|
||||||
private static DetachShaderProc _detachShader;
|
private static DetachShaderProc? _detachShader;
|
||||||
private static LinkProgramProc _linkProgram;
|
private static LinkProgramProc? _linkProgram;
|
||||||
private static GetProgramProc _getProgram;
|
private static GetProgramProc? _getProgram;
|
||||||
private static GetProgramInfoLogProc _getProgramInfoLog;
|
private static GetProgramInfoLogProc? _getProgramInfoLog;
|
||||||
private static DeleteProgramProc _deleteProgram;
|
private static DeleteProgramProc? _deleteProgram;
|
||||||
private static GetShaderLocationProc _getUniformLocation;
|
private static GetShaderLocationProc? _getUniformLocation;
|
||||||
private static GetShaderLocationProc _getAttribLocation;
|
private static GetShaderLocationProc? _getAttribLocation;
|
||||||
|
|
||||||
private static void LoadProgram()
|
private static void LoadProgram()
|
||||||
{
|
{
|
||||||
@ -42,26 +42,26 @@ namespace Quik.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static int CreateProgram() => _createProgram();
|
public static int CreateProgram() => _createProgram!();
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UseProgram(int program) => _useProgram(program);
|
public static void UseProgram(int program) => _useProgram!(program);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void AttachShader(int program, int shader) => _attachShader(program, shader);
|
public static void AttachShader(int program, int shader) => _attachShader!(program, shader);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DetachShader(int program, int shader) => _detachShader(program, shader);
|
public static void DetachShader(int program, int shader) => _detachShader!(program, shader);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void LinkProgram(int program) => _linkProgram(program);
|
public static void LinkProgram(int program) => _linkProgram!(program);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void GetProgram(int program, GLEnum pname, out int value)
|
public static void GetProgram(int program, GLEnum pname, out int value)
|
||||||
{
|
{
|
||||||
value = default;
|
value = default;
|
||||||
fixed (int* ptr = &value)
|
fixed (int* ptr = &value)
|
||||||
_getProgram(program, pname, ptr);
|
_getProgram!(program, pname, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -71,26 +71,26 @@ namespace Quik.OpenGL
|
|||||||
byte[] infoLog = new byte[length];
|
byte[] infoLog = new byte[length];
|
||||||
|
|
||||||
fixed (byte *ptr = infoLog)
|
fixed (byte *ptr = infoLog)
|
||||||
_getProgramInfoLog(program, length, &length, ptr);
|
_getProgramInfoLog!(program, length, &length, ptr);
|
||||||
|
|
||||||
return Encoding.UTF8.GetString(infoLog);
|
return Encoding.UTF8.GetString(infoLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DeleteProgram(int program) => _deleteProgram(program);
|
public static void DeleteProgram(int program) => _deleteProgram!(program);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static int GetUniformLocation(int program, string name)
|
public static int GetUniformLocation(int program, string name)
|
||||||
{
|
{
|
||||||
fixed(byte* ptr = Encoding.UTF8.GetBytes(name))
|
fixed(byte* ptr = Encoding.UTF8.GetBytes(name))
|
||||||
return _getUniformLocation(program, ptr);
|
return _getUniformLocation!(program, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static int GetAttribLocation(int program, string name)
|
public static int GetAttribLocation(int program, string name)
|
||||||
{
|
{
|
||||||
fixed(byte* ptr = Encoding.UTF8.GetBytes(name))
|
fixed(byte* ptr = Encoding.UTF8.GetBytes(name))
|
||||||
return _getAttribLocation(program, ptr);
|
return _getAttribLocation!(program, ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,12 +15,12 @@ namespace Quik.OpenGL
|
|||||||
private delegate void GetShaderInfoLogProc(int shader, int maxLength, int* length, byte* infoLog);
|
private delegate void GetShaderInfoLogProc(int shader, int maxLength, int* length, byte* infoLog);
|
||||||
private delegate void DeleteShaderProc(int id);
|
private delegate void DeleteShaderProc(int id);
|
||||||
|
|
||||||
private static CreateShaderProc _createShader;
|
private static CreateShaderProc? _createShader;
|
||||||
private static ShaderSourceProc _shaderSource;
|
private static ShaderSourceProc? _shaderSource;
|
||||||
private static CompileShaderProc _compileShader;
|
private static CompileShaderProc? _compileShader;
|
||||||
private static GetShaderProc _getShader;
|
private static GetShaderProc? _getShader;
|
||||||
private static GetShaderInfoLogProc _getShaderInfoLog;
|
private static GetShaderInfoLogProc? _getShaderInfoLog;
|
||||||
private static DeleteShaderProc _deleteShader;
|
private static DeleteShaderProc? _deleteShader;
|
||||||
|
|
||||||
private static void LoadShader()
|
private static void LoadShader()
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ namespace Quik.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static int CreateShader(GLEnum type) => _createShader(type);
|
public static int CreateShader(GLEnum type) => _createShader!(type);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void ShaderSource(int shader, string source)
|
public static void ShaderSource(int shader, string source)
|
||||||
@ -43,7 +43,7 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
fixed (byte* ptr = &sourceUTF8[0])
|
fixed (byte* ptr = &sourceUTF8[0])
|
||||||
{
|
{
|
||||||
_shaderSource(shader, 1, &ptr, &length);
|
_shaderSource!(shader, 1, &ptr, &length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ namespace Quik.OpenGL
|
|||||||
fixed (byte** ptr = &pointers[0])
|
fixed (byte** ptr = &pointers[0])
|
||||||
fixed (int * len = &lengths[0])
|
fixed (int * len = &lengths[0])
|
||||||
{
|
{
|
||||||
_shaderSource(shader, count, ptr, len);
|
_shaderSource!(shader, count, ptr, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -82,14 +82,14 @@ namespace Quik.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void CompileShader(int shader) => _compileShader(shader);
|
public static void CompileShader(int shader) => _compileShader!(shader);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void GetShader(int shader, GLEnum pname, out int value)
|
public static void GetShader(int shader, GLEnum pname, out int value)
|
||||||
{
|
{
|
||||||
value = default;
|
value = default;
|
||||||
fixed (int *ptr = &value)
|
fixed (int *ptr = &value)
|
||||||
_getShader(shader, pname, ptr);
|
_getShader!(shader, pname, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -99,12 +99,12 @@ namespace Quik.OpenGL
|
|||||||
byte[] infoLog = new byte[length];
|
byte[] infoLog = new byte[length];
|
||||||
|
|
||||||
fixed (byte *ptr = infoLog)
|
fixed (byte *ptr = infoLog)
|
||||||
_getShaderInfoLog(shader, length, &length, ptr);
|
_getShaderInfoLog!(shader, length, &length, ptr);
|
||||||
|
|
||||||
return Encoding.UTF8.GetString(infoLog);
|
return Encoding.UTF8.GetString(infoLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DeleteShader(int shader) => _deleteShader(shader);
|
public static void DeleteShader(int shader) => _deleteShader!(shader);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,21 +18,21 @@ namespace Quik.OpenGL
|
|||||||
private delegate void TexParameterfvProc(GLEnum target, GLEnum pname, float* value);
|
private delegate void TexParameterfvProc(GLEnum target, GLEnum pname, float* value);
|
||||||
private delegate void GenerateMipmapProc(GLEnum target);
|
private delegate void GenerateMipmapProc(GLEnum target);
|
||||||
|
|
||||||
private static GenObjectsProc _genTextures;
|
private static GenObjectsProc? _genTextures;
|
||||||
private static GenObjectsProc _deleteTextures;
|
private static GenObjectsProc? _deleteTextures;
|
||||||
private static BindSlottedProc _bindTexture;
|
private static BindSlottedProc? _bindTexture;
|
||||||
private static ActiveTextureProc _activeTexture;
|
private static ActiveTextureProc? _activeTexture;
|
||||||
private static PixelStoreiProc _pixelStorei;
|
private static PixelStoreiProc? _pixelStorei;
|
||||||
private static PixelStorefProc _pixelStoref;
|
private static PixelStorefProc? _pixelStoref;
|
||||||
private static TexImage2DProc _texImage2D;
|
private static TexImage2DProc? _texImage2D;
|
||||||
private static TexImage3DProc _texImage3D;
|
private static TexImage3DProc? _texImage3D;
|
||||||
private static TexSubImage2DProc _texSubImage2D;
|
private static TexSubImage2DProc? _texSubImage2D;
|
||||||
private static TexSubImage3DProc _texSubImage3D;
|
private static TexSubImage3DProc? _texSubImage3D;
|
||||||
private static TexParameteriProc _texParameteri;
|
private static TexParameteriProc? _texParameteri;
|
||||||
private static TexParameterfProc _texParameterf;
|
private static TexParameterfProc? _texParameterf;
|
||||||
private static TexParameterivProc _texParameteriv;
|
private static TexParameterivProc? _texParameteriv;
|
||||||
private static TexParameterfvProc _texParameterfv;
|
private static TexParameterfvProc? _texParameterfv;
|
||||||
private static GenerateMipmapProc _generateMipmap;
|
private static GenerateMipmapProc? _generateMipmap;
|
||||||
|
|
||||||
private static void LoadTexture()
|
private static void LoadTexture()
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ namespace Quik.OpenGL
|
|||||||
public static void GenTextures(int count, out int textures)
|
public static void GenTextures(int count, out int textures)
|
||||||
{
|
{
|
||||||
fixed (int *ptr = &textures)
|
fixed (int *ptr = &textures)
|
||||||
_genTextures(count, ptr);
|
_genTextures!(count, ptr);
|
||||||
}
|
}
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static int GenTexture()
|
public static int GenTexture()
|
||||||
@ -72,7 +72,7 @@ namespace Quik.OpenGL
|
|||||||
public static void DeleteTextures(int count, in int textures)
|
public static void DeleteTextures(int count, in int textures)
|
||||||
{
|
{
|
||||||
fixed (int* ptr = &textures)
|
fixed (int* ptr = &textures)
|
||||||
_deleteTextures(count, ptr);
|
_deleteTextures!(count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -82,26 +82,26 @@ namespace Quik.OpenGL
|
|||||||
public static void DeleteTextures(int[] textures) => DeleteTextures(textures.Length, in textures[0]);
|
public static void DeleteTextures(int[] textures) => DeleteTextures(textures.Length, in textures[0]);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void BindTexture(GLEnum target, int texture) => _bindTexture(target, texture);
|
public static void BindTexture(GLEnum target, int texture) => _bindTexture!(target, texture);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void ActiveTexture(GLEnum unit) => _activeTexture(unit);
|
public static void ActiveTexture(GLEnum unit) => _activeTexture!(unit);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void PixelStore(GLEnum pname, int value) => _pixelStorei(pname, value);
|
public static void PixelStore(GLEnum pname, int value) => _pixelStorei!(pname, value);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void PixelStore(GLEnum pname, float value) => _pixelStoref(pname, value);
|
public static void PixelStore(GLEnum pname, float value) => _pixelStoref!(pname, value);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexImage2D(GLEnum target, int level, GLEnum internalFormat, int width, int height, int border, GLEnum format, GLEnum pixelType, IntPtr data) =>
|
public static void TexImage2D(GLEnum target, int level, GLEnum internalFormat, int width, int height, int border, GLEnum format, GLEnum pixelType, IntPtr data) =>
|
||||||
_texImage2D(target, level, internalFormat, width, height, border, format, pixelType, (void*)data);
|
_texImage2D!(target, level, internalFormat, width, height, border, format, pixelType, (void*)data);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexImage2D<T>(GLEnum target, int level, GLEnum internalFormat, int width, int height, int border, GLEnum format, GLEnum pixelType, in T data) where T : unmanaged
|
public static void TexImage2D<T>(GLEnum target, int level, GLEnum internalFormat, int width, int height, int border, GLEnum format, GLEnum pixelType, in T data) where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed(T *ptr = &data)
|
fixed(T *ptr = &data)
|
||||||
_texImage2D(target, level, internalFormat, width, height, border, format, pixelType, ptr);
|
_texImage2D!(target, level, internalFormat, width, height, border, format, pixelType, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -110,14 +110,14 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexImage3D(GLEnum target, int level, GLEnum internalFormat, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, void* data) =>
|
public static void TexImage3D(GLEnum target, int level, GLEnum internalFormat, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, void* data) =>
|
||||||
_texImage3D(target, level, internalFormat, width, height, depth, border, format, pixelType, data);
|
_texImage3D!(target, level, internalFormat, width, height, depth, border, format, pixelType, data);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexImage3D<T>(GLEnum target, int level, GLEnum internalFormat, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, in T data)
|
public static void TexImage3D<T>(GLEnum target, int level, GLEnum internalFormat, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, in T data)
|
||||||
where T : unmanaged
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed (T* ptr = &data)
|
fixed (T* ptr = &data)
|
||||||
_texImage3D(target, level, internalFormat, width, height, depth, border, format, pixelType, ptr);
|
_texImage3D!(target, level, internalFormat, width, height, depth, border, format, pixelType, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -127,13 +127,13 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexSubImage2D(GLEnum target, int level, int x, int y, int width, int height, GLEnum format, GLEnum pixelType, IntPtr data) =>
|
public static void TexSubImage2D(GLEnum target, int level, int x, int y, int width, int height, GLEnum format, GLEnum pixelType, IntPtr data) =>
|
||||||
_texSubImage2D(target, level, x, y, width, height,format, pixelType, (void*)data);
|
_texSubImage2D!(target, level, x, y, width, height,format, pixelType, (void*)data);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexSubImage2d<T>(GLEnum target, int level, int x, int y, int width, int height, GLEnum format, GLEnum pixelType, in T data) where T : unmanaged
|
public static void TexSubImage2d<T>(GLEnum target, int level, int x, int y, int width, int height, GLEnum format, GLEnum pixelType, in T data) where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed(T *ptr = &data)
|
fixed(T *ptr = &data)
|
||||||
_texSubImage2D(target, level, x, y, width, height, format, pixelType, ptr);
|
_texSubImage2D!(target, level, x, y, width, height, format, pixelType, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -142,14 +142,14 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexSubImage3D(GLEnum target, int level, int x, int y, int z, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, void* data) =>
|
public static void TexSubImage3D(GLEnum target, int level, int x, int y, int z, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, void* data) =>
|
||||||
_texSubImage3D(target, level, x, y, z, width, height, depth, border, format, pixelType, data);
|
_texSubImage3D!(target, level, x, y, z, width, height, depth, border, format, pixelType, data);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexSubImage3D<T>(GLEnum target, int level, int x, int y, int z, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, in T data)
|
public static void TexSubImage3D<T>(GLEnum target, int level, int x, int y, int z, int width, int height, int depth, int border, GLEnum format, GLEnum pixelType, in T data)
|
||||||
where T : unmanaged
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed (T* ptr = &data)
|
fixed (T* ptr = &data)
|
||||||
_texSubImage3D(target, level, x, y, z, width, height, depth, border, format, pixelType, ptr);
|
_texSubImage3D!(target, level, x, y, z, width, height, depth, border, format, pixelType, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -158,16 +158,16 @@ namespace Quik.OpenGL
|
|||||||
TexSubImage3D(target, level, x, y, z, width, height, depth, border, format, pixelType, in data[0]);
|
TexSubImage3D(target, level, x, y, z, width, height, depth, border, format, pixelType, in data[0]);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexParameter(GLEnum target, GLEnum pname, int value) => _texParameteri(target, pname, value);
|
public static void TexParameter(GLEnum target, GLEnum pname, int value) => _texParameteri!(target, pname, value);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexParameter(GLEnum target, GLEnum pname, GLEnum value) => _texParameteri(target, pname, (int)value);
|
public static void TexParameter(GLEnum target, GLEnum pname, GLEnum value) => _texParameteri!(target, pname, (int)value);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexParameter(GLEnum target, GLEnum pname, float value) => _texParameterf(target, pname, value);
|
public static void TexParameter(GLEnum target, GLEnum pname, float value) => _texParameterf!(target, pname, value);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexParameter(GLEnum target, GLEnum pname, ref int values)
|
public static void TexParameter(GLEnum target, GLEnum pname, ref int values)
|
||||||
{
|
{
|
||||||
fixed (int *ptr = &values)
|
fixed (int *ptr = &values)
|
||||||
_texParameteriv(target, pname, ptr);
|
_texParameteriv!(target, pname, ptr);
|
||||||
}
|
}
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexParameter(GLEnum target, GLEnum pname, int[] values) => TexParameter(target, pname, ref values[0]);
|
public static void TexParameter(GLEnum target, GLEnum pname, int[] values) => TexParameter(target, pname, ref values[0]);
|
||||||
@ -176,12 +176,12 @@ namespace Quik.OpenGL
|
|||||||
public static void TexParameter(GLEnum target, GLEnum pname, ref float values)
|
public static void TexParameter(GLEnum target, GLEnum pname, ref float values)
|
||||||
{
|
{
|
||||||
fixed (float *ptr = &values)
|
fixed (float *ptr = &values)
|
||||||
_texParameterfv(target, pname, ptr);
|
_texParameterfv!(target, pname, ptr);
|
||||||
}
|
}
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void TexParameter(GLEnum target, GLEnum pname, float[] values) => TexParameter(target, pname, ref values[0]);
|
public static void TexParameter(GLEnum target, GLEnum pname, float[] values) => TexParameter(target, pname, ref values[0]);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void GenerateMipmap(GLEnum target) => _generateMipmap(target);
|
public static void GenerateMipmap(GLEnum target) => _generateMipmap!(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,25 +16,25 @@ namespace Quik.OpenGL
|
|||||||
private delegate void UniformNivProc(int location, int count, int* value);
|
private delegate void UniformNivProc(int location, int count, int* value);
|
||||||
private delegate void UniformMatrixNxNfvProc(int location, int count, bool transpose, float *value);
|
private delegate void UniformMatrixNxNfvProc(int location, int count, bool transpose, float *value);
|
||||||
|
|
||||||
private static Uniform1fProc _uniform1f;
|
private static Uniform1fProc? _uniform1f;
|
||||||
private static Uniform2fProc _uniform2f;
|
private static Uniform2fProc? _uniform2f;
|
||||||
private static Uniform3fProc _uniform3f;
|
private static Uniform3fProc? _uniform3f;
|
||||||
private static Uniform4fProc _uniform4f;
|
private static Uniform4fProc? _uniform4f;
|
||||||
private static Uniform1iProc _uniform1i;
|
private static Uniform1iProc? _uniform1i;
|
||||||
private static Uniform2iProc _uniform2i;
|
private static Uniform2iProc? _uniform2i;
|
||||||
private static Uniform3iProc _uniform3i;
|
private static Uniform3iProc? _uniform3i;
|
||||||
private static Uniform4iProc _uniform4i;
|
private static Uniform4iProc? _uniform4i;
|
||||||
private static UniformNfvProc _uniform1fv;
|
private static UniformNfvProc? _uniform1fv;
|
||||||
private static UniformNfvProc _uniform2fv;
|
private static UniformNfvProc? _uniform2fv;
|
||||||
private static UniformNfvProc _uniform3fv;
|
private static UniformNfvProc? _uniform3fv;
|
||||||
private static UniformNfvProc _uniform4fv;
|
private static UniformNfvProc? _uniform4fv;
|
||||||
private static UniformNivProc _uniform1iv;
|
private static UniformNivProc? _uniform1iv;
|
||||||
private static UniformNivProc _uniform2iv;
|
private static UniformNivProc? _uniform2iv;
|
||||||
private static UniformNivProc _uniform3iv;
|
private static UniformNivProc? _uniform3iv;
|
||||||
private static UniformNivProc _uniform4iv;
|
private static UniformNivProc? _uniform4iv;
|
||||||
private static UniformMatrixNxNfvProc _uniformMatrix2fv;
|
private static UniformMatrixNxNfvProc? _uniformMatrix2fv;
|
||||||
private static UniformMatrixNxNfvProc _uniformMatrix3fv;
|
private static UniformMatrixNxNfvProc? _uniformMatrix3fv;
|
||||||
private static UniformMatrixNxNfvProc _uniformMatrix4fv;
|
private static UniformMatrixNxNfvProc? _uniformMatrix4fv;
|
||||||
|
|
||||||
public static void LoadUniform()
|
public static void LoadUniform()
|
||||||
{
|
{
|
||||||
@ -62,161 +62,161 @@ namespace Quik.OpenGL
|
|||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform1(int location, float x)
|
public static void Uniform1(int location, float x)
|
||||||
{
|
{
|
||||||
_uniform1f(location, x);
|
_uniform1f!(location, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform2(int location, float x, float y)
|
public static void Uniform2(int location, float x, float y)
|
||||||
{
|
{
|
||||||
_uniform2f(location, x, y);
|
_uniform2f!(location, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform3(int location, float x, float y, float z)
|
public static void Uniform3(int location, float x, float y, float z)
|
||||||
{
|
{
|
||||||
_uniform3f(location, x, y, z);
|
_uniform3f!(location, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform4(int location, float x, float y, float z, float w)
|
public static void Uniform4(int location, float x, float y, float z, float w)
|
||||||
{
|
{
|
||||||
_uniform4f(location, x, y, z, w);
|
_uniform4f!(location, x, y, z, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform1(int location, int x)
|
public static void Uniform1(int location, int x)
|
||||||
{
|
{
|
||||||
_uniform1i(location, x);
|
_uniform1i!(location, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform2(int location, int x, int y)
|
public static void Uniform2(int location, int x, int y)
|
||||||
{
|
{
|
||||||
_uniform2i(location, x, y);
|
_uniform2i!(location, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform3(int location, int x, int y, int z)
|
public static void Uniform3(int location, int x, int y, int z)
|
||||||
{
|
{
|
||||||
_uniform3i(location, x, y, z);
|
_uniform3i!(location, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform4(int location, int x, int y, int z, int w)
|
public static void Uniform4(int location, int x, int y, int z, int w)
|
||||||
{
|
{
|
||||||
_uniform4i(location, x, y, z, w);
|
_uniform4i!(location, x, y, z, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform1(int location, int count, ref float first)
|
public static void Uniform1(int location, int count, ref float first)
|
||||||
{
|
{
|
||||||
fixed(float *ptr = &first)
|
fixed(float *ptr = &first)
|
||||||
_uniform1fv(location, count, ptr);
|
_uniform1fv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform2(int location, int count, ref float first)
|
public static void Uniform2(int location, int count, ref float first)
|
||||||
{
|
{
|
||||||
fixed(float *ptr = &first)
|
fixed(float *ptr = &first)
|
||||||
_uniform2fv(location, count, ptr);
|
_uniform2fv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform3(int location, int count, ref float first)
|
public static void Uniform3(int location, int count, ref float first)
|
||||||
{
|
{
|
||||||
fixed(float *ptr = &first)
|
fixed(float *ptr = &first)
|
||||||
_uniform3fv(location, count, ptr);
|
_uniform3fv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform4(int location, int count, ref float first)
|
public static void Uniform4(int location, int count, ref float first)
|
||||||
{
|
{
|
||||||
fixed(float *ptr = &first)
|
fixed(float *ptr = &first)
|
||||||
_uniform4fv(location, count, ptr);
|
_uniform4fv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform1(int location, int count, ref int first)
|
public static void Uniform1(int location, int count, ref int first)
|
||||||
{
|
{
|
||||||
fixed(int *ptr = &first)
|
fixed(int *ptr = &first)
|
||||||
_uniform1iv(location, count, ptr);
|
_uniform1iv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform2(int location, int count, ref int first)
|
public static void Uniform2(int location, int count, ref int first)
|
||||||
{
|
{
|
||||||
fixed(int *ptr = &first)
|
fixed(int *ptr = &first)
|
||||||
_uniform2iv(location, count, ptr);
|
_uniform2iv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform3(int location, int count, ref int first)
|
public static void Uniform3(int location, int count, ref int first)
|
||||||
{
|
{
|
||||||
fixed(int *ptr = &first)
|
fixed(int *ptr = &first)
|
||||||
_uniform3iv(location, count, ptr);
|
_uniform3iv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Uniform4(int location, int count, ref int first)
|
public static void Uniform4(int location, int count, ref int first)
|
||||||
{
|
{
|
||||||
fixed(int *ptr = &first)
|
fixed(int *ptr = &first)
|
||||||
_uniform4iv(location, count, ptr);
|
_uniform4iv!(location, count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix2(int location, bool transpose, ref float m11)
|
public static void UniformMatrix2(int location, bool transpose, ref float m11)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m11)
|
fixed (float* ptr = &m11)
|
||||||
_uniformMatrix2fv(location, 1, transpose, ptr);
|
_uniformMatrix2fv!(location, 1, transpose, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix3(int location, bool transpose, ref float m11)
|
public static void UniformMatrix3(int location, bool transpose, ref float m11)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m11)
|
fixed (float* ptr = &m11)
|
||||||
_uniformMatrix3fv(location, 1, transpose, ptr);
|
_uniformMatrix3fv!(location, 1, transpose, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix4(int location, bool transpose, ref float m11)
|
public static void UniformMatrix4(int location, bool transpose, ref float m11)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m11)
|
fixed (float* ptr = &m11)
|
||||||
_uniformMatrix4fv(location, 1, transpose, ptr);
|
_uniformMatrix4fv!(location, 1, transpose, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix2(int location, int count, bool transpose, ref float m11)
|
public static void UniformMatrix2(int location, int count, bool transpose, ref float m11)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m11)
|
fixed (float* ptr = &m11)
|
||||||
_uniformMatrix2fv(location, count, transpose, ptr);
|
_uniformMatrix2fv!(location, count, transpose, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix3(int location, int count, bool transpose, ref float m11)
|
public static void UniformMatrix3(int location, int count, bool transpose, ref float m11)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m11)
|
fixed (float* ptr = &m11)
|
||||||
_uniformMatrix3fv(location, count, transpose, ptr);
|
_uniformMatrix3fv!(location, count, transpose, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix4(int location, int count, bool transpose, ref float m11)
|
public static void UniformMatrix4(int location, int count, bool transpose, ref float m11)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m11)
|
fixed (float* ptr = &m11)
|
||||||
_uniformMatrix4fv(location, count, transpose, ptr);
|
_uniformMatrix4fv!(location, count, transpose, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix4(int location, bool transpose, in QMat4 m4)
|
public static void UniformMatrix4(int location, bool transpose, in QMat4 m4)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m4.M11)
|
fixed (float* ptr = &m4.M11)
|
||||||
_uniformMatrix4fv(location, 1, transpose, ptr);
|
_uniformMatrix4fv!(location, 1, transpose, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void UniformMatrix4(int location, int count, bool transpose, ref QMat4 m4)
|
public static void UniformMatrix4(int location, int count, bool transpose, ref QMat4 m4)
|
||||||
{
|
{
|
||||||
fixed (float* ptr = &m4.M11)
|
fixed (float* ptr = &m4.M11)
|
||||||
_uniformMatrix4fv(location, count, transpose, ptr);
|
_uniformMatrix4fv!(location, count, transpose, ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,13 +9,13 @@ namespace Quik.OpenGL
|
|||||||
private delegate void VertexAttribPointerProc(int location, int size, GLEnum type, bool normalized, int stride, IntPtr offset);
|
private delegate void VertexAttribPointerProc(int location, int size, GLEnum type, bool normalized, int stride, IntPtr offset);
|
||||||
private delegate void VertexAttribIPointerProc(int location, int size, GLEnum type, int stride, IntPtr offset);
|
private delegate void VertexAttribIPointerProc(int location, int size, GLEnum type, int stride, IntPtr offset);
|
||||||
|
|
||||||
private static GenObjectsProc _genVertexArrays;
|
private static GenObjectsProc? _genVertexArrays;
|
||||||
private static GenObjectsProc _deleteVertexArrays;
|
private static GenObjectsProc? _deleteVertexArrays;
|
||||||
private static BindObjectProc _bindVertexArray;
|
private static BindObjectProc? _bindVertexArray;
|
||||||
private static EnableVertexAttribArrayProc _enableVertexAttribArray;
|
private static EnableVertexAttribArrayProc? _enableVertexAttribArray;
|
||||||
private static EnableVertexAttribArrayProc _disableVertexAttribArray;
|
private static EnableVertexAttribArrayProc? _disableVertexAttribArray;
|
||||||
private static VertexAttribPointerProc _vertexAttribPointer;
|
private static VertexAttribPointerProc? _vertexAttribPointer;
|
||||||
private static VertexAttribIPointerProc _vertexAttribIPointer;
|
private static VertexAttribIPointerProc? _vertexAttribIPointer;
|
||||||
|
|
||||||
private static void LoadVertexArrays()
|
private static void LoadVertexArrays()
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@ namespace Quik.OpenGL
|
|||||||
public static void GenVertexArrays(int count, out int vertexArrays)
|
public static void GenVertexArrays(int count, out int vertexArrays)
|
||||||
{
|
{
|
||||||
fixed (int *ptr = &vertexArrays)
|
fixed (int *ptr = &vertexArrays)
|
||||||
_genVertexArrays(count, ptr);
|
_genVertexArrays!(count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -49,7 +49,7 @@ namespace Quik.OpenGL
|
|||||||
public static void DeleteVertexArrays(int count, ref int vertexArrays)
|
public static void DeleteVertexArrays(int count, ref int vertexArrays)
|
||||||
{
|
{
|
||||||
fixed (int *ptr = &vertexArrays)
|
fixed (int *ptr = &vertexArrays)
|
||||||
_deleteVertexArrays(count, ptr);
|
_deleteVertexArrays!(count, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
@ -59,20 +59,20 @@ namespace Quik.OpenGL
|
|||||||
public static void DeleteVertexArray(int vertexArray) => DeleteVertexArrays(1, ref vertexArray);
|
public static void DeleteVertexArray(int vertexArray) => DeleteVertexArrays(1, ref vertexArray);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void BindVertexArray(int vertexArray) => _bindVertexArray(vertexArray);
|
public static void BindVertexArray(int vertexArray) => _bindVertexArray!(vertexArray);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void EnableVertexAttribArray(int location) => _enableVertexAttribArray(location);
|
public static void EnableVertexAttribArray(int location) => _enableVertexAttribArray!(location);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DisableVertexAttribArray(int location) => _disableVertexAttribArray(location);
|
public static void DisableVertexAttribArray(int location) => _disableVertexAttribArray!(location);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void VertexAttribPointer(int location, int size, GLEnum type, bool normalized, int stride, int offset) =>
|
public static void VertexAttribPointer(int location, int size, GLEnum type, bool normalized, int stride, int offset) =>
|
||||||
_vertexAttribPointer(location, size, type, normalized, stride, (IntPtr)offset);
|
_vertexAttribPointer!(location, size, type, normalized, stride, (IntPtr)offset);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void VertexAttribIPointer(int location, int size, GLEnum type, int stride, int offset) =>
|
public static void VertexAttribIPointer(int location, int size, GLEnum type, int stride, int offset) =>
|
||||||
_vertexAttribIPointer(location, size, type, stride, (IntPtr)offset);
|
_vertexAttribIPointer!(location, size, type, stride, (IntPtr)offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,25 +23,25 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
private const short AggressiveInlining = (short)MethodImplOptions.AggressiveInlining;
|
private const short AggressiveInlining = (short)MethodImplOptions.AggressiveInlining;
|
||||||
|
|
||||||
private static GetProcAddressProc _getProcAddress;
|
private static GetProcAddressProc? _getProcAddress;
|
||||||
private static GLEnum1Proc _enable;
|
private static GLEnum1Proc? _enable;
|
||||||
private static GLEnum1Proc _disable;
|
private static GLEnum1Proc? _disable;
|
||||||
private static GLEnum2Proc _blendFunc;
|
private static GLEnum2Proc? _blendFunc;
|
||||||
private static GLEnum1Proc _depthFunc;
|
private static GLEnum1Proc? _depthFunc;
|
||||||
private static GLEnum1Proc _clear;
|
private static GLEnum1Proc? _clear;
|
||||||
private static GLI4Proc _viewport;
|
private static GLI4Proc? _viewport;
|
||||||
private static GLI4Proc _scissor;
|
private static GLI4Proc? _scissor;
|
||||||
private static GLF4Proc _clearColor;
|
private static GLF4Proc? _clearColor;
|
||||||
private static DrawElementsProc _drawElements;
|
private static DrawElementsProc? _drawElements;
|
||||||
private static DrawArraysProc _drawArrays;
|
private static DrawArraysProc? _drawArrays;
|
||||||
private static GetIntegervProc _getIntegerv;
|
private static GetIntegervProc? _getIntegerv;
|
||||||
private static GetFloatvProc _getFloatv;
|
private static GetFloatvProc? _getFloatv;
|
||||||
private static GetStringProc _getString;
|
private static GetStringProc? _getString;
|
||||||
|
|
||||||
private static T GetProcAddress<T>(string procName)
|
private static T GetProcAddress<T>(string procName)
|
||||||
where T : Delegate
|
where T : Delegate
|
||||||
{
|
{
|
||||||
IntPtr funcptr = _getProcAddress(procName);
|
IntPtr funcptr = _getProcAddress!(procName);
|
||||||
return Marshal.GetDelegateForFunctionPointer<T>(funcptr);
|
return Marshal.GetDelegateForFunctionPointer<T>(funcptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,27 +72,27 @@ namespace Quik.OpenGL
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Enable(GLEnum cap) => _enable(cap);
|
public static void Enable(GLEnum cap) => _enable!(cap);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Disable(GLEnum cap) => _disable(cap);
|
public static void Disable(GLEnum cap) => _disable!(cap);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void BlendFunc(GLEnum src, GLEnum dst) => _blendFunc(src, dst);
|
public static void BlendFunc(GLEnum src, GLEnum dst) => _blendFunc!(src, dst);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DepthFunc(GLEnum func) => _depthFunc(func);
|
public static void DepthFunc(GLEnum func) => _depthFunc!(func);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Clear(GLEnum buffer_bits) => _clear(buffer_bits);
|
public static void Clear(GLEnum buffer_bits) => _clear!(buffer_bits);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Viewport(int x, int y, int w, int h) => _viewport(x, y, w, h);
|
public static void Viewport(int x, int y, int w, int h) => _viewport!(x, y, w, h);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Scissor(int x, int y, int w, int h) => _scissor(x, y, w, h);
|
public static void Scissor(int x, int y, int w, int h) => _scissor!(x, y, w, h);
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void ClearColor(float r, float g, float b, float a) => _clearColor(r, g, b, a);
|
public static void ClearColor(float r, float g, float b, float a) => _clearColor!(r, g, b, a);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DrawElements(GLEnum primitive, int count, GLEnum type, int offset) => _drawElements(primitive, count, type, (void*)offset);
|
public static void DrawElements(GLEnum primitive, int count, GLEnum type, int offset) => _drawElements!(primitive, count, type, (void*)offset);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void DrawArrays(GLEnum primitive, int offset, int count) => _drawArrays(primitive, offset, count);
|
public static void DrawArrays(GLEnum primitive, int offset, int count) => _drawArrays!(primitive, offset, count);
|
||||||
|
|
||||||
[MethodImpl(AggressiveInlining)]
|
[MethodImpl(AggressiveInlining)]
|
||||||
public static void Get(GLEnum pname, out int value)
|
public static void Get(GLEnum pname, out int value)
|
||||||
@ -100,7 +100,7 @@ namespace Quik.OpenGL
|
|||||||
value = default;
|
value = default;
|
||||||
fixed(int* ptr = &value)
|
fixed(int* ptr = &value)
|
||||||
{
|
{
|
||||||
_getIntegerv(pname, ptr);
|
_getIntegerv!(pname, ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ namespace Quik.OpenGL
|
|||||||
value = default;
|
value = default;
|
||||||
fixed (float* ptr = &value)
|
fixed (float* ptr = &value)
|
||||||
{
|
{
|
||||||
_getFloatv(pname, ptr);
|
_getFloatv!(pname, ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ namespace Quik.OpenGL
|
|||||||
public static string GetString(GLEnum pname)
|
public static string GetString(GLEnum pname)
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
byte* str = _getString(pname);
|
byte* str = _getString!(pname);
|
||||||
|
|
||||||
for (length = 0; str[length] == 0 || length < 256; length++);
|
for (length = 0; str[length] == 0 || length < 256; length++);
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace Quik.OpenGL
|
|||||||
private readonly TextureManager textures = new TextureManager();
|
private readonly TextureManager textures = new TextureManager();
|
||||||
|
|
||||||
public bool IsInit { get; private set; } = false;
|
public bool IsInit { get; private set; } = false;
|
||||||
public event Action<GL21Driver> OnGCDispose;
|
public event Action<GL21Driver>? OnGCDispose;
|
||||||
|
|
||||||
public GL21Driver()
|
public GL21Driver()
|
||||||
{
|
{
|
||||||
@ -91,7 +91,7 @@ namespace Quik.OpenGL
|
|||||||
{
|
{
|
||||||
AssertInit();
|
AssertInit();
|
||||||
|
|
||||||
if (!data.TryGetValue(queue, out DrawData draw))
|
if (!data.TryGetValue(queue, out DrawData? draw))
|
||||||
{
|
{
|
||||||
draw = new DrawData(this, queue);
|
draw = new DrawData(this, queue);
|
||||||
data.Add(queue, draw);
|
data.Add(queue, draw);
|
||||||
@ -163,7 +163,7 @@ namespace Quik.OpenGL
|
|||||||
{
|
{
|
||||||
AssertInit();
|
AssertInit();
|
||||||
|
|
||||||
if (!data.TryGetValue(queue, out DrawData draw))
|
if (!data.TryGetValue(queue, out DrawData? draw))
|
||||||
return;
|
return;
|
||||||
draw.Dispose();
|
draw.Dispose();
|
||||||
data.Remove(queue);
|
data.Remove(queue);
|
||||||
@ -171,7 +171,7 @@ namespace Quik.OpenGL
|
|||||||
|
|
||||||
private static int CreateShader(GLEnum type, string name)
|
private static int CreateShader(GLEnum type, string name)
|
||||||
{
|
{
|
||||||
StreamReader source = new StreamReader(typeof(GL21Driver).Assembly.GetManifestResourceStream(name));
|
StreamReader source = new StreamReader(typeof(GL21Driver).Assembly.GetManifestResourceStream(name) ?? throw new Exception("Resource not found."));
|
||||||
string text = source.ReadToEnd();
|
string text = source.ReadToEnd();
|
||||||
source.Dispose();
|
source.Dispose();
|
||||||
|
|
||||||
|
@ -19,17 +19,17 @@ namespace Quik.PAL
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The title of the application.
|
/// The title of the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Title { get; set; }
|
string? Title { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default icon for the application.
|
/// The default icon for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
QImage Icon { get; set; }
|
QImage? Icon { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The event raised when an event is received.
|
/// The event raised when an event is received.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event EventHandler EventRaised;
|
event EventHandler? EventRaised;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raise the events that have been enqueued.
|
/// Raise the events that have been enqueued.
|
||||||
|
@ -34,7 +34,7 @@ namespace Quik.PAL
|
|||||||
set => platform.PortSetPosition(handle, value);
|
set => platform.PortSetPosition(handle, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UIBase UIElement { get; set; }
|
public UIBase? UIElement { get; set; }
|
||||||
|
|
||||||
public bool IsValid => platform.PortIsValid(handle);
|
public bool IsValid => platform.PortIsValid(handle);
|
||||||
|
|
||||||
@ -70,13 +70,12 @@ namespace Quik.PAL
|
|||||||
platform.PortFocus(handle);
|
platform.PortFocus(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Paint(CommandList list = null)
|
public void Paint(CommandList? list = null)
|
||||||
{
|
{
|
||||||
if (UIElement == null)
|
if (UIElement == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(list == null)
|
list ??= new CommandList();
|
||||||
list = new CommandList();
|
|
||||||
|
|
||||||
list.Clear();
|
list.Clear();
|
||||||
UIElement.Bounds = new QRectangle(Size, new QVec2(0,0));
|
UIElement.Bounds = new QRectangle(Size, new QVec2(0,0));
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>8</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Title of the application.
|
/// Title of the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Title
|
public string? Title
|
||||||
{
|
{
|
||||||
get => Platform.Title;
|
get => Platform.Title;
|
||||||
set => Platform.Title = value;
|
set => Platform.Title = value;
|
||||||
@ -31,13 +31,13 @@ namespace Quik
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Application icon.
|
/// Application icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public QImage Icon
|
public QImage? Icon
|
||||||
{
|
{
|
||||||
get => Platform.Icon;
|
get => Platform.Icon;
|
||||||
set => Platform.Icon = value;
|
set => Platform.Icon = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuikPort MainPort { get; private set; } = null;
|
public QuikPort? MainPort { get; private set; } = null;
|
||||||
|
|
||||||
public FontProvider FontProvider { get; }
|
public FontProvider FontProvider { get; }
|
||||||
|
|
||||||
@ -53,9 +53,9 @@ namespace Quik
|
|||||||
Current = this;
|
Current = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDisposable GetMedia(object key, MediaHint hint)
|
public IDisposable? GetMedia(object key, MediaHint hint)
|
||||||
{
|
{
|
||||||
IDisposable disposable = null;
|
IDisposable? disposable = null;
|
||||||
|
|
||||||
foreach (MediaLoader loader in MediaLoaders)
|
foreach (MediaLoader loader in MediaLoaders)
|
||||||
{
|
{
|
||||||
@ -68,9 +68,9 @@ namespace Quik
|
|||||||
return disposable;
|
return disposable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDisposable GetMedia<T>(T key, MediaHint hint)
|
public IDisposable? GetMedia<T>(T key, MediaHint hint)
|
||||||
{
|
{
|
||||||
IDisposable disposable = null;
|
IDisposable? disposable = null;
|
||||||
|
|
||||||
foreach (MediaLoader loader in MediaLoaders)
|
foreach (MediaLoader loader in MediaLoaders)
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ namespace Quik
|
|||||||
|
|
||||||
public bool RunSync()
|
public bool RunSync()
|
||||||
{
|
{
|
||||||
if (!MainPort.IsValid)
|
if (!MainPort!.IsValid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Platform.ProcessEvents(false);
|
Platform.ProcessEvents(false);
|
||||||
@ -123,7 +123,7 @@ namespace Quik
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QuikApplication Current { get; private set; }
|
public static QuikApplication Current { get; private set; } = null!;
|
||||||
|
|
||||||
public static void SetCurrentApplication(QuikApplication application)
|
public static void SetCurrentApplication(QuikApplication application)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ namespace Quik
|
|||||||
|
|
||||||
public static bool operator !=(QVec2 a, QVec2 b) => a.X != b.X || a.Y != b.Y;
|
public static bool operator !=(QVec2 a, QVec2 b) => a.X != b.X || a.Y != b.Y;
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object? obj)
|
||||||
{
|
{
|
||||||
if (obj is QVec2)
|
if (obj is QVec2)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace Quik
|
|||||||
|
|
||||||
public abstract class StyleBase
|
public abstract class StyleBase
|
||||||
{
|
{
|
||||||
public abstract object this[string key] { get; set; }
|
public abstract object? this[string key] { get; set; }
|
||||||
|
|
||||||
public QColor? Color
|
public QColor? Color
|
||||||
{
|
{
|
||||||
@ -109,9 +109,9 @@ namespace Quik
|
|||||||
set => this["list-marker-position"] = value;
|
set => this["list-marker-position"] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QImage ListMarkerImage
|
public QImage? ListMarkerImage
|
||||||
{
|
{
|
||||||
get => (QImage)this["list-marker-image"];
|
get => (QImage?)this["list-marker-image"];
|
||||||
set => this["list-marker-image"] = value;
|
set => this["list-marker-image"] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,9 +127,9 @@ namespace Quik
|
|||||||
set => this["stroke-color"] = value;
|
set => this["stroke-color"] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FontFace Font
|
public FontFace? Font
|
||||||
{
|
{
|
||||||
get => (FontFace)this["font"];
|
get => (FontFace?)this["font"];
|
||||||
set => this["font"] = value;
|
set => this["font"] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,9 +144,9 @@ namespace Quik
|
|||||||
{
|
{
|
||||||
private readonly Dictionary<string, object> _keys = new Dictionary<string, object>();
|
private readonly Dictionary<string, object> _keys = new Dictionary<string, object>();
|
||||||
|
|
||||||
public override object this[string styleKey]
|
public override object? this[string styleKey]
|
||||||
{
|
{
|
||||||
get => _keys.TryGetValue(styleKey, out object value) ? value : null;
|
get => _keys.TryGetValue(styleKey, out object? value) ? value : null;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
@ -163,11 +163,11 @@ namespace Quik
|
|||||||
|
|
||||||
public Style BaseStyle { get; }
|
public Style BaseStyle { get; }
|
||||||
|
|
||||||
public override object this[string key]
|
public override object? this[string key]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
object value = null;
|
object? value = null;
|
||||||
|
|
||||||
for (int i = _styles.Count; i != 0 && value == null; i--)
|
for (int i = _styles.Count; i != 0 && value == null; i--)
|
||||||
{
|
{
|
||||||
|
@ -16,18 +16,19 @@ namespace Quik.Typography
|
|||||||
private Dictionary<FontFace, QFont> Fonts { get; } = new Dictionary<FontFace, QFont>();
|
private Dictionary<FontFace, QFont> Fonts { get; } = new Dictionary<FontFace, QFont>();
|
||||||
private HashSet<QFont> UsedFonts { get; } = new HashSet<QFont>();
|
private HashSet<QFont> UsedFonts { get; } = new HashSet<QFont>();
|
||||||
public readonly FontRasterizerOptions RasterizerOptions;
|
public readonly FontRasterizerOptions RasterizerOptions;
|
||||||
public IFontDataBase Database { get; set; }
|
public IFontDataBase? Database { get; set; }
|
||||||
public IFontFactory FontFactory { get; set; }
|
public IFontFactory? FontFactory { get; set; }
|
||||||
private readonly QuikApplication App;
|
private readonly QuikApplication App;
|
||||||
|
|
||||||
public QFont this[FontFace info]
|
public QFont this[FontFace info]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!Fonts.TryGetValue(info, out QFont font))
|
if (!Fonts.TryGetValue(info, out QFont? font))
|
||||||
{
|
{
|
||||||
using Stream str = Database?.Open(info);
|
using Stream str = Database?.Open(info) ?? throw new Exception("Font could not be found.");
|
||||||
if (FontFactory.TryOpen(str, out font))
|
|
||||||
|
if (FontFactory?.TryOpen(str, out font) ?? false)
|
||||||
{
|
{
|
||||||
Fonts.Add(info, font);
|
Fonts.Add(info, font);
|
||||||
}
|
}
|
||||||
@ -46,7 +47,7 @@ namespace Quik.Typography
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this[Database.GetSystemFontFace(family)];
|
return this[Database?.GetSystemFontFace(family) ?? throw new Exception("No font database.")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,21 +56,21 @@ namespace Quik.Typography
|
|||||||
RasterizerOptions = options;
|
RasterizerOptions = options;
|
||||||
App = app;
|
App = app;
|
||||||
|
|
||||||
Type fdb = Type.GetType("Quik.Media.Defaults.FontDataBaseProvider, Quik.Media.Defaults");
|
Type? fdb = Type.GetType("Quik.Media.Defaults.FontDataBaseProvider, Quik.Media.Defaults");
|
||||||
if (fdb != null)
|
if (fdb != null)
|
||||||
{
|
{
|
||||||
PropertyInfo instanceProperty = fdb.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.GetProperty);
|
PropertyInfo? instanceProperty = fdb.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.GetProperty);
|
||||||
if (instanceProperty != null)
|
if (instanceProperty != null)
|
||||||
{
|
{
|
||||||
Database = (IFontDataBase)instanceProperty.GetValue(null);
|
Database = (IFontDataBase)instanceProperty.GetValue(null)!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Type ffact = Type.GetType("Quik.Media.Defaults.FreeTypeFontFactory, Quik.Media.Defaults");
|
Type? ffact = Type.GetType("Quik.Media.Defaults.FreeTypeFontFactory, Quik.Media.Defaults");
|
||||||
if (ffact != null)
|
if (ffact != null)
|
||||||
{
|
{
|
||||||
ConstructorInfo ctor = ffact.GetConstructor(Array.Empty<Type>());
|
ConstructorInfo? ctor = ffact.GetConstructor(Array.Empty<Type>());
|
||||||
FontFactory = (IFontFactory)ctor.Invoke(null);
|
FontFactory = (IFontFactory?)ctor?.Invoke(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public FontProvider(QuikApplication app)
|
public FontProvider(QuikApplication app)
|
||||||
|
@ -135,7 +135,7 @@ namespace Quik.Typography
|
|||||||
|
|
||||||
font.Get(codepoint, size, out FontGlyph glyph);
|
font.Get(codepoint, size, out FontGlyph glyph);
|
||||||
ref readonly QGlyphMetrics metrics = ref glyph.Metrics;
|
ref readonly QGlyphMetrics metrics = ref glyph.Metrics;
|
||||||
QImage image = glyph.Image;
|
QImage? image = glyph.Image;
|
||||||
|
|
||||||
if (image == null)
|
if (image == null)
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ namespace Quik.VertexGenerator
|
|||||||
private int _start;
|
private int _start;
|
||||||
private int _baseOffset;
|
private int _baseOffset;
|
||||||
private QRectangle _bounds;
|
private QRectangle _bounds;
|
||||||
private QImage _texture;
|
private QImage? _texture;
|
||||||
|
|
||||||
public int ZDepth { get; private set; }
|
public int ZDepth { get; private set; }
|
||||||
public QuikVertex[] VertexArray => _vertices.InternalArray;
|
public QuikVertex[] VertexArray => _vertices.InternalArray;
|
||||||
@ -33,7 +33,7 @@ namespace Quik.VertexGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void StartDrawCall(in QRectangle bounds, QImage texture, int baseOffset)
|
public void StartDrawCall(in QRectangle bounds, QImage? texture, int baseOffset)
|
||||||
{
|
{
|
||||||
_start = ElementCount;
|
_start = ElementCount;
|
||||||
_texture = texture;
|
_texture = texture;
|
||||||
@ -100,9 +100,9 @@ namespace Quik.VertexGenerator
|
|||||||
public int Start { get; }
|
public int Start { get; }
|
||||||
public int Count { get; }
|
public int Count { get; }
|
||||||
public QRectangle Bounds { get; }
|
public QRectangle Bounds { get; }
|
||||||
public QImage Texture { get; }
|
public QImage? Texture { get; }
|
||||||
|
|
||||||
public DrawCall(int start, int count, in QRectangle bounds, QImage texture)
|
public DrawCall(int start, int count, in QRectangle bounds, QImage? texture)
|
||||||
{
|
{
|
||||||
Start = start;
|
Start = start;
|
||||||
Count = count;
|
Count = count;
|
||||||
|
@ -20,7 +20,7 @@ namespace QuikDemo
|
|||||||
|
|
||||||
public class EmptyView : View
|
public class EmptyView : View
|
||||||
{
|
{
|
||||||
private QFont font;
|
private QFont? font;
|
||||||
private readonly Label Label = new Label() { Text = "Hello world!", Position = new QVec2(300, 300) };
|
private readonly Label Label = new Label() { Text = "Hello world!", Position = new QVec2(300, 300) };
|
||||||
|
|
||||||
protected override void PaintBegin(CommandList cmd)
|
protected override void PaintBegin(CommandList cmd)
|
||||||
|
Loading…
Reference in New Issue
Block a user