fixed xmloader bug, user must free model shaders and textures as they might be shared (#933)
This commit is contained in:
parent
f3555a1016
commit
2d5cc5ddbf
2 changed files with 14 additions and 9 deletions
|
@ -703,7 +703,12 @@ Model LoadModelFromMesh(Mesh mesh)
|
||||||
void UnloadModel(Model model)
|
void UnloadModel(Model model)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < model.meshCount; i++) UnloadMesh(model.meshes[i]);
|
for (int i = 0; i < model.meshCount; i++) UnloadMesh(model.meshes[i]);
|
||||||
for (int i = 0; i < model.materialCount; i++) UnloadMaterial(model.materials[i]);
|
|
||||||
|
// as the user could be sharing shaders and textures between
|
||||||
|
// models, don't unload the material but free it's maps instead
|
||||||
|
// the user is responsible for freeing models shaders and textures
|
||||||
|
//for (int i = 0; i < model.materialCount; i++) UnloadMaterial(model.materials[i]);
|
||||||
|
for (int i = 0; i < model.materialCount; i++) RL_FREE(model.materials[i].maps);
|
||||||
|
|
||||||
RL_FREE(model.meshes);
|
RL_FREE(model.meshes);
|
||||||
RL_FREE(model.materials);
|
RL_FREE(model.materials);
|
||||||
|
|
|
@ -1250,7 +1250,7 @@ Music LoadMusicStream(const char *fileName)
|
||||||
|
|
||||||
int result = jar_xm_create_context_from_file(&ctxXm, 48000, fileName);
|
int result = jar_xm_create_context_from_file(&ctxXm, 48000, fileName);
|
||||||
|
|
||||||
if (result > 0) // XM context created successfully
|
if (result == 0) // XM context created successfully
|
||||||
{
|
{
|
||||||
music.ctxType = MUSIC_MODULE_XM;
|
music.ctxType = MUSIC_MODULE_XM;
|
||||||
jar_xm_set_max_loop_count(ctxXm, 0); // Set infinite number of loops
|
jar_xm_set_max_loop_count(ctxXm, 0); // Set infinite number of loops
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue