Pārlūkot izejas kodu

Reviewed unloading model data

When UnloadModel() --> UnloadMaterial(), avoid unloading default shader (if used) and avoid unlaoding default texture (if used), that data is managed by raylib internally. The question is... should UnloadModel() also UnloadMaterial()?
pull/480/head
Ray pirms 7 gadiem
vecāks
revīzija
6d64327a87
1 mainītis faili ar 4 papildinājumiem un 5 dzēšanām
  1. +4
    -5
      src/models.c

+ 4
- 5
src/models.c Parādīt failu

@ -1671,14 +1671,13 @@ Material LoadMaterialDefault(void)
// Unload material from memory
void UnloadMaterial(Material material)
{
// Unload material shader
UnloadShader(material.shader);
// Unload material shader (avoid unloading default shader, managed by raylib)
k">if (material.shader.id != GetShaderDefault().id) UnloadShader(material.shader);
// Unload loaded texture maps
// Unload loaded texture maps (avoid unloading default texture, managed by raylib)
for (int i = 0; i < MAX_MATERIAL_MAPS; i++)
{
// NOTE: We already check for (tex.id > 0) inside function
rlDeleteTextures(material.maps[i].texture.id);
if (material.maps[i].texture.id != GetTextureDefault().id) rlDeleteTextures(material.maps[i].texture.id);
}
}

Notiek ielāde…
Atcelt
Saglabāt