Enable texture wrapping for SDL_RenderGeometry()

Currently wrapping is based on whether texture coordinates are outside of [0,1], but the code is structured so it's easy to add an API to set it and add additional wrapping modes if we want.

Fixes https://github.com/libsdl-org/SDL/issues/9238
Closes https://github.com/libsdl-org/SDL/pull/5369
This commit is contained in:
Sam Lantinga
2024-07-17 22:49:05 -07:00
parent 6a74ade73d
commit 03bb2c17ed
15 changed files with 1198 additions and 418 deletions

View File

@@ -30,6 +30,13 @@
extern "C" {
#endif
typedef enum SDL_TextureAddressMode
{
SDL_TEXTURE_ADDRESS_AUTO,
SDL_TEXTURE_ADDRESS_CLAMP,
SDL_TEXTURE_ADDRESS_WRAP,
} SDL_TextureAddressMode;
/**
* A rectangle, with the origin at the upper left (double precision).
*/
@@ -132,6 +139,7 @@ typedef struct SDL_RenderCommand
SDL_FColor color;
SDL_BlendMode blend;
SDL_Texture *texture;
SDL_TextureAddressMode texture_address_mode;
} draw;
struct
{
@@ -262,6 +270,7 @@ struct SDL_Renderer
float color_scale;
SDL_FColor color; /**< Color for drawing operations values */
SDL_BlendMode blendMode; /**< The drawing blend mode */
SDL_TextureAddressMode texture_address_mode;
SDL_RenderCommand *render_commands;
SDL_RenderCommand *render_commands_tail;