瀏覽代碼

resolve normal and specular maps with current texture path if not absolute path found

Nicolas Cannasse 5 年之前
父節點
當前提交
a2775938cb
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      h3d/scene/World.hx

+ 10 - 0
h3d/scene/World.hx

@@ -283,6 +283,11 @@ class World extends Object {
 			return null;
 		try {
 			return hxd.res.Loader.currentInstance.load(mat.specularTexture).toImage();
+		} catch( e : hxd.res.NotFound ) try {
+			var path = path.split("/");
+			path.pop();
+			path.push(mat.specularTexture.split("/").pop());
+			return hxd.res.Loader.currentInstance.load(path.join("/")).toImage();
 		} catch( e : hxd.res.NotFound ) {
 			return null;
 		}
@@ -293,6 +298,11 @@ class World extends Object {
 			return null;
 		try {
 			return hxd.res.Loader.currentInstance.load(mat.normalMap).toImage();
+		} catch( e : hxd.res.NotFound ) try {
+			var path = path.split("/");
+			path.pop();
+			path.push(mat.normalMap.split("/").pop());
+			return hxd.res.Loader.currentInstance.load(path.join("/")).toImage();
 		} catch( e : hxd.res.NotFound ) {
 			return null;
 		}