change clear color type

main
cosmonaut 2021-02-09 22:51:30 -08:00
parent aab0917603
commit d1e691a02b
3 changed files with 58 additions and 17 deletions

@ -1 +1 @@
Subproject commit a92549a91395900f30fe9010dfe86e19fedd4e85
Subproject commit 800069ad58bf33518280002749365d254f09cd38

View File

@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using MoonWorks.Math;
using RefreshCS;
namespace MoonWorks.Graphics
@ -20,22 +21,51 @@ namespace MoonWorks.Graphics
RenderPass renderPass,
Framebuffer framebuffer,
in Rect renderArea,
in DepthStencilValue depthStencilClearValue,
params Color[] clearColors
in DepthStencilValue depthStencilClearValue
) {
fixed (Color* clearColorPtr = &clearColors[0])
Refresh.Refresh_BeginRenderPass(
Device.Handle,
Handle,
renderPass.Handle,
framebuffer.Handle,
renderArea.ToRefresh(),
IntPtr.Zero,
0,
depthStencilClearValue.ToRefresh()
);
}
public unsafe void BeginRenderPass(
RenderPass renderPass,
Framebuffer framebuffer,
in Rect renderArea,
in DepthStencilValue depthStencilClearValue,
params Vector4[] clearColors
) {
Refresh.Vec4* colors = stackalloc Refresh.Vec4[clearColors.Length];
for (var i = 0; i < clearColors.Length; i++)
{
Refresh.Refresh_BeginRenderPass(
Device.Handle,
Handle,
renderPass.Handle,
framebuffer.Handle,
renderArea.ToRefresh(),
(IntPtr) clearColorPtr,
(uint)clearColors.Length,
depthStencilClearValue.ToRefresh()
);
colors[i] = new Refresh.Vec4
{
x = clearColors[i].X,
y = clearColors[i].Y,
z = clearColors[i].Z,
w = clearColors[i].W
};
}
Refresh.Refresh_BeginRenderPass(
Device.Handle,
Handle,
renderPass.Handle,
framebuffer.Handle,
renderArea.ToRefresh(),
(IntPtr) colors,
(uint)clearColors.Length,
depthStencilClearValue.ToRefresh()
);
}
public unsafe void BeginRenderPass(
@ -216,9 +246,20 @@ namespace MoonWorks.Graphics
in Rect clearRect,
ClearOptionsFlags clearOptions,
in DepthStencilValue depthStencilClearValue,
params Color[] clearColors
params Vector4[] clearColors
) {
Refresh.Color* colors = stackalloc Refresh.Color[clearColors.Length];
Refresh.Vec4* colors = stackalloc Refresh.Vec4[clearColors.Length];
for (var i = 0; i < clearColors.Length; i++)
{
colors[i] = new Refresh.Vec4
{
x = clearColors[i].X,
y = clearColors[i].Y,
z = clearColors[i].Z,
w = clearColors[i].W
};
}
Refresh.Refresh_Clear(
Device.Handle,
Handle,

View File

@ -97,7 +97,7 @@ namespace MoonWorks.Graphics
SixtyFour
}
public enum CubeMapFace
public enum CubeMapFace : uint
{
PositiveX,
NegativeX,