Jelajahi Sumber

added preventAutoDispose()

ncannasse 8 tahun lalu
induk
melakukan
a1d982e983
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 8 0
      h3d/mat/Texture.hx

+ 8 - 0
h3d/mat/Texture.hx

@@ -107,6 +107,14 @@ class Texture {
 		return t;
 	}
 
+	/**
+		In case of out of GPU memory, textures that hasn't been used for a long time will be disposed.
+		Calling this will make this texture not considered for auto disposal.
+	**/
+	public function preventAutoDispose() {
+		lastFrame = 0x7FFFFFFF;
+	}
+
 	function set_onLoaded(v) {
 		onLoaded = v;
 		if( v != null && !flags.has(Loading) ) v();