浏览代码

adding cacheImage in Engine.

clementlandrin 1 月之前
父节点
当前提交
cf0be210fb
共有 1 个文件被更改,包括 9 次插入0 次删除
  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;
 	}