Explorar o código

adding cacheImage in Engine.

clementlandrin hai 1 mes
pai
achega
cf0be210fb
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      h3d/Engine.hx

+ 9 - 0
h3d/Engine.hx

@@ -457,6 +457,15 @@ class Engine {
 		#end
 	}
 
+	public function cacheImage(res : hxd.res.Image) : h3d.mat.Texture {
+		var t : h3d.mat.Texture = resCache.get(res);
+		if ( t != null )
+			return t;
+		t = res.toTexture();
+		resCache.set(res, t);
+		return t;
+	}
+
 	function get_fps() {
 		return Math.ceil(realFps * 100) / 100;
 	}