rendering.c: batching for sprites (blended vs unblended), separation of rendering submodules; textures.c: textures_get_atlas_id()
This commit is contained in:
@@ -8,10 +8,10 @@
|
||||
#include <glad/glad.h>
|
||||
|
||||
/* type safe structure for persistent texture handles */
|
||||
typedef struct { int id; } t_texture_key;
|
||||
typedef struct { uint16_t id; } t_texture_key;
|
||||
|
||||
/* tests whether given key structure corresponds to any texture */
|
||||
#define m_texture_key_is_valid(p_key) ((p_key).id != -1)
|
||||
#define m_texture_key_is_valid(p_key) ((p_key).id != (uint16_t)-1)
|
||||
|
||||
void textures_cache_init(struct texture_cache *cache, SDL_Window *window);
|
||||
void textures_cache_deinit(struct texture_cache *cache);
|
||||
@@ -39,6 +39,9 @@ t_rect textures_get_srcrect(const struct texture_cache *cache, t_texture_key key
|
||||
/* returns a rect of dimensions of the whole texture (whole atlas) */
|
||||
t_rect textures_get_dims(const struct texture_cache *cache, t_texture_key key);
|
||||
|
||||
/* returns an identifier that is equal for all textures placed in the same atlas */
|
||||
int32_t textures_get_atlas_id(const struct texture_cache *cache, t_texture_key key);
|
||||
|
||||
/* binds atlas texture in opengl state */
|
||||
void textures_bind(const struct texture_cache *cache, t_texture_key key, GLenum target);
|
||||
|
||||
|
Reference in New Issue
Block a user