Functions and structures for managing memory caches. More...
Classes | |
struct | CubeMapCache |
Structure to cache cube map textures. More... | |
struct | TextureCache |
Structure to cache textures. More... | |
struct | ModelCache |
Structure to cache models. More... | |
struct | ShaderCache |
Structure to cache shaders. More... | |
struct | MixMusicCache |
Structure to cache music. More... | |
struct | MixChunkCache |
Structure to cache sound effects. More... | |
struct | MemoryCaches |
Structure to manage all types of caches. More... | |
Typedefs | |
typedef u32 | TextureMap |
Alias for u32 representing a texture map. | |
typedef unsigned int | Shader |
Represents an unsigned integer used as a shader identifier. | |
Functions | |
void | init_memory_cache () |
Initializes the memory cache. | |
void | free_shaders () |
Frees the allocated shaders. | |
ModelData * | get_model_from_cache (const char *name) |
Gets a model from the cache. | |
void | add_model_to_cache (const char *name, ModelData *model) |
Adds a model to the cache. | |
void | free_models () |
Frees the allocated models. | |
Mix_Music * | get_mix_music_from_cache (const char *name) |
Gets a music from the cache. | |
void | add_mix_music_to_cache (const char *name, Mix_Music *music) |
Adds a music to the cache. | |
void | free_musics () |
Frees the allocated music. | |
Mix_Chunk * | get_mix_chunk_from_cache (const char *name) |
Gets a sound effect from the cache. | |
void | add_mix_chunk_to_cache (const char *name, Mix_Chunk *chunk) |
Adds a sound effect to the cache. | |
void | free_chunks () |
Frees the allocated sound effects. | |
void | free_textures () |
Frees the allocated textures. | |
void | free_cubemaps () |
Frees the allocated cubemaps. | |
void | free_memory_cache () |
Frees the entire memory cache. | |
Functions and structures for managing memory caches.
This module provides structures and functions to manage caches for cube maps, textures, models, and shaders. It includes initialization and cleanup functions to handle the memory allocation and deallocation for these resources.
Alias for u32 representing a texture map.
Represents an unsigned integer used as a shader identifier.
void init_memory_cache | ( | ) |
Initializes the memory cache.
This function sets up the memory cache for use in the project.
void free_shaders | ( | ) |
Frees the allocated shaders.
This function releases the memory allocated for shaders.
ModelData * get_model_from_cache | ( | const char * | name | ) |
Gets a model from the cache.
name | The name of the model. |
This function retrieves a model from the cache with the specified name. If the model is not found, it returns NULL.
void add_model_to_cache | ( | const char * | name, |
ModelData * | model | ||
) |
Adds a model to the cache.
name | The name of the model. |
model | The model data to add to the cache. |
This function adds a model to the cache with the specified name.
void free_models | ( | ) |
Frees the allocated models.
This function releases the memory allocated for models.
Mix_Music * get_mix_music_from_cache | ( | const char * | name | ) |
Gets a music from the cache.
name | The name of the music. |
This function retrieves a music from the cache with the specified name.
void add_mix_music_to_cache | ( | const char * | name, |
Mix_Music * | music | ||
) |
Adds a music to the cache.
name | The name of the music. |
music | The music data to add to the cache. |
This function adds a music to the cache with the specified name.
void free_musics | ( | ) |
Frees the allocated music.
This function releases the memory allocated for music.
Mix_Chunk * get_mix_chunk_from_cache | ( | const char * | name | ) |
Gets a sound effect from the cache.
name | The name of the sound effect. |
This function retrieves a sound effect from the cache with the specified name.
void add_mix_chunk_to_cache | ( | const char * | name, |
Mix_Chunk * | chunk | ||
) |
Adds a sound effect to the cache.
name | The name of the sound effect. |
music | The sound effect data to add to the cache. |
This function adds a sound effect to the cache with the specified name.
void free_chunks | ( | ) |
Frees the allocated sound effects.
This function releases the memory allocated for sound effects.
void free_textures | ( | ) |
Frees the allocated textures.
This function releases the memory allocated for textures.
void free_cubemaps | ( | ) |
Frees the allocated cubemaps.
This function releases the memory allocated for cubemaps.
void free_memory_cache | ( | ) |
Frees the entire memory cache.
This function releases all memory allocated in the memory cache.