add shortcut for instance binding

pull/53/head
cosmonaut 2024-01-23 12:43:07 -08:00
parent 0df2944ccf
commit 34e6c1e720
2 changed files with 4 additions and 4 deletions

View File

@ -127,12 +127,12 @@ namespace MoonWorks.Graphics
public uint Stride;
public VertexInputRate InputRate;
public static VertexBinding Create<T>(uint binding = 0) where T : unmanaged
public static VertexBinding Create<T>(uint binding = 0, VertexInputRate inputRate = VertexInputRate.Vertex) where T : unmanaged
{
return new VertexBinding
{
Binding = binding,
InputRate = VertexInputRate.Vertex,
InputRate = inputRate,
Stride = (uint) Marshal.SizeOf<T>()
};
}

View File

@ -14,9 +14,9 @@ namespace MoonWorks.Graphics
VertexAttributes = attributes;
}
public static VertexBindingAndAttributes Create<T>(uint bindingIndex) where T : unmanaged, IVertexType
public static VertexBindingAndAttributes Create<T>(uint bindingIndex, VertexInputRate inputRate = VertexInputRate.Vertex) where T : unmanaged, IVertexType
{
VertexBinding binding = VertexBinding.Create<T>(bindingIndex);
VertexBinding binding = VertexBinding.Create<T>(bindingIndex, inputRate);
VertexAttribute[] attributes = new VertexAttribute[T.Formats.Length];
uint offset = 0;