add sprite texture index increment function

This commit is contained in:
ohsqueezy 2023-11-14 17:57:45 -05:00
parent 110b876648
commit 0a42df9a00
1 changed files with 11 additions and 0 deletions

View File

@ -192,6 +192,17 @@ namespace sb
return _texture_index;
}
/*!
* Increment the texture index the given number of times. Defaults to 1. It will wrap around at the end. Negative increment can be used.
*
* @param increment amount to increment the texture index
*/
void texture_increment(int increment = 1)
{
/* Add and wrap (even though model wraps as well) */
_texture_index = glm::mod(_texture_index + increment, static_cast<int>(plane.textures().size()));
}
/*!
* If the GL context is active, this can be called to load image paths previously associated with textures attached to the
* sprite's plane object.