我想请问一下Java3D中对于.obj模型文件的.mtl贴图文件怎么样同时装载.
也就是在装载.OBJ文件的同时导入其贴图文件.
网上找了很多资料,说是将.obj和.mtl放在同一目录下,默认的装载器会自动读取.mtl文件。问题是总算弄到装载器自动去读取.mtl文件这步上了,却报了下面这个异常:
- Java code
Exception in thread "main" java.lang.IllegalArgumentException: Empty region! at javax.imageio.ImageReader.computeRegions(ImageReader.java:2689) at com.sun.imageio.plugins.wbmp.WBMPImageReader.read(WBMPImageReader.java:184) at javax.imageio.ImageIO.read(ImageIO.java:1422) at javax.imageio.ImageIO.read(ImageIO.java:1282) at com.sun.j3d.utils.image.TextureLoader$1.run(TextureLoader.java:304) at java.security.AccessController.doPrivileged(Native Method) at com.sun.j3d.utils.image.TextureLoader.<init>(TextureLoader.java:299) at com.sun.j3d.loaders.objectfile.ObjectFileMaterials.readMapKd(ObjectFileMaterials.java:305) at com.sun.j3d.loaders.objectfile.ObjectFileMaterials.readFile(ObjectFileMaterials.java:361) at com.sun.j3d.loaders.objectfile.ObjectFileMaterials.readMaterialFile(ObjectFileMaterials.java:408) at com.sun.j3d.loaders.objectfile.ObjectFile.loadMaterialFile(ObjectFile.java:525) at com.sun.j3d.loaders.objectfile.ObjectFile.readFile(ObjectFile.java:589) at com.sun.j3d.loaders.objectfile.ObjectFile.load(ObjectFile.java:1248) at com.sun.j3d.loaders.objectfile.ObjectFile.load(ObjectFile.java:676) at test.ObjLoader.createSceneGraph(ObjLoader.java:102) at test.ObjLoader.<init>(ObjLoader.java:132) at test.ObjLoader.main(ObjLoader.java:143)
有使用过Java3D模型装载的兄弟们能不能帮帮我呢?
------解决方案--------------------
Exception in thread "main" java.lang.IllegalArgumentException: Empty region!
异常提示:region为空吧 是不是要定义region选项
------解决方案--------------------
学习下