Jelajahi Sumber

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

Nicolas Cannasse 5 tahun lalu
induk
melakukan
a2775938cb
1 mengubah file dengan 10 tambahan dan 0 penghapusan
  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;
 		}