Add SDL_RenderGeometry based on SDL_RenderGeometryRaw

This commit is contained in:
Sylvain 2021-04-01 09:55:00 +02:00 committed by Sylvain Becker
parent e481261173
commit cc37c38e30
4 changed files with 50 additions and 0 deletions

View file

@ -85,6 +85,16 @@ typedef struct SDL_RendererInfo
int max_texture_height; /**< The maximum texture height */
} SDL_RendererInfo;
/**
* \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; /**< Normalized texture coordinates, if needed */
} SDL_Vertex;
/**
* The scaling mode for a texture.
*/
@ -1441,6 +1451,25 @@ 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,
const SDL_Vertex *vertices, int num_vertices,
const int *indices, int num_indices);
/**
* \brief Render a list of triangles, optionally using a texture and indices into the vertex arrays
* Color and alpha modulation is done per vertex (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).