add a few useful functions

pull/20/head
cosmonaut 2022-05-13 16:26:26 -07:00
parent 66d363459b
commit 2bd88e1dc1
3 changed files with 29 additions and 0 deletions

View File

@ -281,6 +281,24 @@ namespace MoonWorks.Graphics
StencilStoreOp = StoreOp.DontCare;
}
public DepthStencilAttachmentInfo(
Texture texture,
LoadOp loadOp = LoadOp.DontCare,
StoreOp storeOp = StoreOp.Store,
LoadOp stencilLoadOp = LoadOp.DontCare,
StoreOp stencilStoreOp = StoreOp.Store
) {
Texture = texture;
Depth = 0;
Layer = 0;
Level = 0;
DepthStencilClearValue = new DepthStencilValue();
LoadOp = loadOp;
StoreOp = storeOp;
StencilLoadOp = stencilLoadOp;
StencilStoreOp = stencilStoreOp;
}
public Refresh.DepthStencilAttachmentInfo ToRefresh()
{
return new Refresh.DepthStencilAttachmentInfo

View File

@ -8,6 +8,12 @@
public VertexBinding[] VertexBindings;
public VertexAttribute[] VertexAttributes;
public VertexInputState()
{
VertexBindings = new VertexBinding[0];
VertexAttributes = new VertexAttribute[0];
}
public VertexInputState(
VertexBinding vertexBinding,
params VertexAttribute[] vertexAttributes

View File

@ -280,6 +280,11 @@ namespace MoonWorks.Math
return result;
}
public static float Quantize(float value, float step)
{
return (float) System.Math.Floor(value / step) * step;
}
/// <summary>
/// Converts radians to degrees.
/// </summary>