change clear color type

pull/14/head
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;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using MoonWorks.Math;
using RefreshCS; using RefreshCS;
namespace MoonWorks.Graphics namespace MoonWorks.Graphics
@ -20,22 +21,51 @@ namespace MoonWorks.Graphics
RenderPass renderPass, RenderPass renderPass,
Framebuffer framebuffer, Framebuffer framebuffer,
in Rect renderArea, in Rect renderArea,
in DepthStencilValue depthStencilClearValue, in DepthStencilValue depthStencilClearValue
params Color[] clearColors
) { ) {
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( colors[i] = new Refresh.Vec4
Device.Handle, {
Handle, x = clearColors[i].X,
renderPass.Handle, y = clearColors[i].Y,
framebuffer.Handle, z = clearColors[i].Z,
renderArea.ToRefresh(), w = clearColors[i].W
(IntPtr) clearColorPtr, };
(uint)clearColors.Length,
depthStencilClearValue.ToRefresh()
);
} }
Refresh.Refresh_BeginRenderPass(
Device.Handle,
Handle,
renderPass.Handle,
framebuffer.Handle,
renderArea.ToRefresh(),
(IntPtr) colors,
(uint)clearColors.Length,
depthStencilClearValue.ToRefresh()
);
} }
public unsafe void BeginRenderPass( public unsafe void BeginRenderPass(
@ -216,9 +246,20 @@ namespace MoonWorks.Graphics
in Rect clearRect, in Rect clearRect,
ClearOptionsFlags clearOptions, ClearOptionsFlags clearOptions,
in DepthStencilValue depthStencilClearValue, 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( Refresh.Refresh_Clear(
Device.Handle, Device.Handle,
Handle, Handle,

View File

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