Add Span utils to RenderBatch/fix DrawCounter
This commit is contained in:
parent
ee1557aca5
commit
4597f6600f
1 changed files with 29 additions and 0 deletions
|
|
@ -28,6 +28,11 @@ public unsafe partial struct RenderBatch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DrawCall* Draws;
|
public DrawCall* Draws;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Draw calls counter
|
||||||
|
/// </summary>
|
||||||
|
public int DrawCounter;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current depth value for next draw
|
/// Current depth value for next draw
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -76,6 +81,30 @@ public unsafe partial struct VertexBuffer
|
||||||
/// OpenGL Vertex Buffer Objects id (4 types of vertex data)
|
/// OpenGL Vertex Buffer Objects id (4 types of vertex data)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public fixed uint VboId[4];
|
public fixed uint VboId[4];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Access <see cref="Vertices"/>
|
||||||
|
/// </summary>
|
||||||
|
public readonly Span<T> VerticesAs<T>() where T : unmanaged
|
||||||
|
{
|
||||||
|
return new(Vertices, ElementCount * sizeof(float) / sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Access <see cref="TexCoords"/>
|
||||||
|
/// </summary>
|
||||||
|
public readonly Span<T> TexCoordsAs<T>() where T : unmanaged
|
||||||
|
{
|
||||||
|
return new(TexCoords, ElementCount * sizeof(float) / sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Access <see cref="Colors"/>
|
||||||
|
/// </summary>
|
||||||
|
public readonly Span<T> ColorsAs<T>() where T : unmanaged
|
||||||
|
{
|
||||||
|
return new(Colors, ElementCount * sizeof(byte) / sizeof(T));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue