Merge branch 'jb-perrier-render2d-tex-tris-color'
This commit is contained in:
@@ -1932,6 +1932,29 @@ void Render2D::DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertice
|
||||
WriteTri(vertices[i], vertices[i + 1], vertices[i + 2], uvs[i], uvs[i + 1], uvs[i + 2]);
|
||||
}
|
||||
|
||||
void Render2D::DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertices, const Span<Vector2>& uvs, const Color& color)
|
||||
{
|
||||
Color colors[3] = {(Color)color, (Color)color, (Color)color};
|
||||
Span<Color> spancolor(colors, 3);
|
||||
DrawTexturedTriangles(t, vertices, uvs, spancolor);
|
||||
}
|
||||
|
||||
void Render2D::DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertices, const Span<Vector2>& uvs, const Span<Color>& colors)
|
||||
{
|
||||
CHECK(vertices.Length() == uvs.Length())
|
||||
|
||||
RENDER2D_CHECK_RENDERING_STATE;
|
||||
|
||||
Render2DDrawCall& drawCall = DrawCalls.AddOne();
|
||||
drawCall.Type = DrawCallType::FillTexture;
|
||||
drawCall.StartIB = IBIndex;
|
||||
drawCall.CountIB = vertices.Length();
|
||||
drawCall.AsTexture.Ptr = t;
|
||||
|
||||
for (int32 i = 0; i < vertices.Length(); i += 3)
|
||||
WriteTri(vertices[i], vertices[i + 1], vertices[i + 2], uvs[i], uvs[i + 1], uvs[i + 2], colors[i], colors[i + 1], colors[i + 2]);
|
||||
}
|
||||
|
||||
void Render2D::FillTriangles(const Span<Vector2>& vertices, const Span<Color>& colors, bool useAlpha)
|
||||
{
|
||||
CHECK(vertices.Length() == colors.Length());
|
||||
|
||||
@@ -402,6 +402,24 @@ public:
|
||||
/// <param name="uvs">The uvs array.</param>
|
||||
API_FUNCTION() static void DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertices, const Span<Vector2>& uvs);
|
||||
|
||||
/// <summary>
|
||||
/// Draws vertices array.
|
||||
/// </summary>
|
||||
/// <param name="t">The texture.</param>
|
||||
/// <param name="vertices">The vertices array.</param>
|
||||
/// <param name="uvs">The uvs array.</param>
|
||||
/// <param name="color">The color.</param>
|
||||
API_FUNCTION() static void DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertices, const Span<Vector2>& uvs, const Color& color);
|
||||
|
||||
/// <summary>
|
||||
/// Draws vertices array.
|
||||
/// </summary>
|
||||
/// <param name="t">The texture.</param>
|
||||
/// <param name="vertices">The vertices array.</param>
|
||||
/// <param name="uvs">The uvs array.</param>
|
||||
/// <param name="colors">The colors array.</param>
|
||||
API_FUNCTION() static void DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertices, const Span<Vector2>& uvs, const Span<Color>& colors);
|
||||
|
||||
/// <summary>
|
||||
/// Draws vertices array.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user