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( Refresh.Refresh_BeginRenderPass(
Device.Handle, Device.Handle,
Handle, Handle,
renderPass.Handle, renderPass.Handle,
framebuffer.Handle, framebuffer.Handle,
renderArea.ToRefresh(), renderArea.ToRefresh(),
(IntPtr) clearColorPtr, IntPtr.Zero,
(uint)clearColors.Length, 0,
depthStencilClearValue.ToRefresh() 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++)
{
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( 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,