Remove textures with no references

This commit is contained in:
Flamefire committed 2014-09-13 17:58:59 +02:00
1 parent 7f8e974fe1
commit 37aa8e5219
3 files changed
+15 -2

No files matched your search

+11 -1
View File
@@ -24,7 +24,7 @@ namespace VocaluxeLib.Draw
/// </summary>
public class CTextureRef
{
public readonly int ID;
public int ID;
public string TexturePath = "";
@@ -115,6 +115,16 @@ namespace VocaluxeLib.Draw
_CalcRatios();
}
~CTextureRef()
{
if (ID >= 0)
{
//Free textures that are no longer reference
CTextureRef tmp = this;
CBase.Drawing.RemoveTexture(ref tmp);
}
}
private void _CalcRatios()
{
// OpenGL has a problem with partial (NPOT) textures, so we remove 1 pixel