Loader.readTextureNames3DS raise an exception

Started by mAlinka, December 03, 2015, 01:43:37 PM

Previous topic - Next topic

mAlinka

Hello!
I using Loader.readTextureNames3DS method to load texture names from model 3ds file. It works fine. But recently I tryed to load a new model (attached) and Loader.readTextureNames3DS falled down with exception. Here is a part of log:
Quote12-03 05:01:10.417: E/AndroidRuntime(1201): FATAL EXCEPTION: main
12-03 05:01:10.417: E/AndroidRuntime(1201): Process: ru.orientiryug.tofar, PID: 1201
12-03 05:01:10.417: E/AndroidRuntime(1201): java.lang.ArrayIndexOutOfBoundsException: length=12189; index=-1486432958
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.getShortInt(Loader.java:1094)
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.getChunkHeader(Loader.java:2159)
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.readTextureNames3DS(Loader.java:1427)
12-03 05:01:10.417: E/AndroidRuntime(1201):    at com.threed.jpct.Loader.readTextureNames3DS(Loader.java:176)

I can use another approach to retrieve texture names as it described in thread http://www.jpct.net/forum2/index.php/topic,1644.msg12249.html#msg12249
But just for know is the model incorrect and cannot be used with readTextureNames3DS method? (Loading model with Loader.load3DS works fine.)
The model file was exported from 3Ds Max. Is there any rules how to export textured models from 3Ds Max to make it compatible for readTextureNames3DS?

EgonOlsen

That's strange, because load3DS should do exactly the same thing internally. That one method works and the other doesn't is strange....I'll have a look.

EgonOlsen

The actual 3ds loader had an additional exit condition that stopped the loading process if the file contains a negative offset in one chunk. The texture names loader didn't have that. I've added it, please give this version a try: http://jpct.de/download/beta/jpct_ae.jar. I've no idea what actually causes this...must be some flaw in either the file or the specs that I used to implement the loader...anyway, I hope it works now.

mAlinka

I've tried a new version and it works! No exceptions and even texture names was loaded.
Thank you for reply and attention!