소스 검색

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;
 		}