From f22fc4ca355b1eeee0c0299fead95356ef50526d Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Tue, 16 Mar 2021 15:07:44 +0100
Subject: [PATCH] Add API: SDL_Vertex type and SDL_RenderGeometry
---
include/SDL_render.h | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/include/SDL_render.h b/include/SDL_render.h
index 8a8bf8ed63..9d4be913aa 100644
--- a/include/SDL_render.h
+++ b/include/SDL_render.h
@@ -137,6 +137,17 @@ typedef struct SDL_Renderer SDL_Renderer;
struct SDL_Texture;
typedef struct SDL_Texture SDL_Texture;
+/**
+ * \brief Vertex structure
+ */
+typedef struct SDL_Vertex
+{
+ SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
+ SDL_Color color; /**< Vertex color */
+ SDL_FPoint tex_coord; /**< Texture coordinates (0..texture width, 0..texture height),
+ if needed */
+} SDL_Vertex;
+
/* Function prototypes */
@@ -1442,6 +1453,26 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
const SDL_FPoint *center,
const SDL_RendererFlip flip);
+/**
+ * \brief Render a list of triangles, optionally using a texture and indices into the vertex array
+ * Color and alpha modulation is done per vertex (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
+ *
+ * \param texture (optional) The SDL texture to use.
+ * \param vertices Vertices.
+ * \param num_vertices Number of vertices.
+ * \param indices (optional) An array of integer indices into the 'vertices' array, if NULL all vertices will be rendered in sequential order.
+ * \param num_indices Number of indices.
+ *
+ * \sa SDL_Vertex
+ *
+ * \return 0 on success, or -1 if the operation is not supported
+ */
+extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
+ SDL_Texture *texture,
+ SDL_Vertex *vertices, int num_vertices,
+ int *indices, int num_indices);
+
+
/**
* Read pixels from the current rendering target to an array of pixels.
*