New Image3D command.

This commit is contained in:
H. Utku Maden 2024-04-11 19:33:42 +03:00
parent 7ce474d92a
commit 20c126fb88
3 changed files with 45 additions and 12 deletions

@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace Quik.CommandMachine namespace Quik.CommandMachine
{ {
@ -230,7 +231,7 @@ namespace Quik.CommandMachine
Enqueue(uv); Enqueue(uv);
} }
public void Image(QuikTexture texture, QRectangle[] rectangles, bool interleavedUV = false) public void Image(QuikTexture texture, ReadOnlySpan<QRectangle> rectangles, bool interleavedUV = false)
{ {
int count = rectangles.Length; int count = rectangles.Length;
ImageCommandFlags flags = ImageCommandFlags.None; ImageCommandFlags flags = ImageCommandFlags.None;
@ -251,7 +252,7 @@ namespace Quik.CommandMachine
} }
} }
public void Image(QuikTexture texture, QRectangle[] rectangles, QRectangle[] uvs) public void Image(QuikTexture texture, ReadOnlySpan<QRectangle> rectangles, ReadOnlySpan<QRectangle> uvs)
{ {
int count = Math.Min(rectangles.Length, uvs.Length); int count = Math.Min(rectangles.Length, uvs.Length);
Enqueue(Command.Image); Enqueue(Command.Image);
@ -265,6 +266,30 @@ namespace Quik.CommandMachine
} }
} }
public void Image3D(QuikTexture texture, in Image3DCall call)
{
Enqueue(Command.Image);
Enqueue(new Frame(ImageCommandFlags.Image3d | ImageCommandFlags.Single));
Enqueue(new Frame(texture));
Enqueue(call.Rectangle);
Enqueue(call.UVs);
Enqueue(new Frame(call.Layer));
}
public void Image3D(QuikTexture texture, ReadOnlySpan<Image3DCall> calls)
{
Enqueue(Command.Image);
Enqueue(new Frame((int)ImageCommandFlags.Image3d, calls.Length));
Enqueue(new Frame(texture));
foreach (Image3DCall call in calls)
{
Enqueue(call.Rectangle);
Enqueue(call.UVs);
Enqueue(new Frame(call.Layer));
}
}
public void Splice(CommandList list) public void Splice(CommandList list)
{ {
foreach (Frame frame in list) foreach (Frame frame in list)

@ -0,0 +1,18 @@
namespace Quik.CommandMachine
{
public enum ImageCommandFlags
{
None = 0,
Single = 1 << 0,
UVs = 1 << 1,
Image3d = 1 << 2,
}
public struct Image3DCall
{
public QRectangle Rectangle;
public QRectangle UVs;
public int Layer;
}
}

@ -1,10 +0,0 @@
namespace Quik.CommandMachine
{
public enum ImageCommandFlags
{
None = 0,
Single = 1 << 0,
UVs = 1 << 1
}
}