parent
0df2944ccf
commit
42e3ac91af
|
@ -127,12 +127,12 @@ namespace MoonWorks.Graphics
|
||||||
public uint Stride;
|
public uint Stride;
|
||||||
public VertexInputRate InputRate;
|
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
|
return new VertexBinding
|
||||||
{
|
{
|
||||||
Binding = binding,
|
Binding = binding,
|
||||||
InputRate = VertexInputRate.Vertex,
|
InputRate = inputRate,
|
||||||
Stride = (uint) Marshal.SizeOf<T>()
|
Stride = (uint) Marshal.SizeOf<T>()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ namespace MoonWorks.Graphics
|
||||||
VertexAttributes = attributes;
|
VertexAttributes = attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VertexBindingAndAttributes Create<T>(uint bindingIndex) where T : unmanaged, IVertexType
|
public static VertexBindingAndAttributes Create<T>(uint bindingIndex, uint locationOffset = 0, 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];
|
VertexAttribute[] attributes = new VertexAttribute[T.Formats.Length];
|
||||||
uint offset = 0;
|
uint offset = 0;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace MoonWorks.Graphics
|
||||||
attributes[i] = new VertexAttribute
|
attributes[i] = new VertexAttribute
|
||||||
{
|
{
|
||||||
Binding = bindingIndex,
|
Binding = bindingIndex,
|
||||||
Location = i,
|
Location = locationOffset + i,
|
||||||
Format = format,
|
Format = format,
|
||||||
Offset = offset
|
Offset = offset
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue