Explorar el Código

Fix exception when textures are not found

trethaller hace 7 años
padre
commit
6bfc8d64bf
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      h3d/scene/World.hx

+ 4 - 0
h3d/scene/World.hx

@@ -176,6 +176,8 @@ class World extends Object {
 	}
 
 	function resolveSpecularTexture( path : String, mat : hxd.fmt.hmd.Data.Material) : hxd.res.Image {
+		if(mat.specularTexture == null)
+			return null;
 		try {
 			return hxd.res.Loader.currentInstance.load(mat.specularTexture).toImage();
 		} catch( e : hxd.res.NotFound ) {
@@ -184,6 +186,8 @@ class World extends Object {
 	}
 
 	function resolveNormalMap( path : String, mat : hxd.fmt.hmd.Data.Material) : hxd.res.Image {
+		if(mat.normalMap == null)
+			return null;
 		try {
 			return hxd.res.Loader.currentInstance.load(mat.normalMap).toImage();
 		} catch( e : hxd.res.NotFound ) {