Author Topic: Loader.readTextureNames3DS raise an exception  (Read 454 times)

Offline mAlinka

  • byte
  • *
  • Posts: 21
    • View Profile
Loader.readTextureNames3DS raise an exception
« on: December 03, 2015, 01:43:37 pm »
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:
Quote
12-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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Loader.readTextureNames3DS raise an exception
« Reply #1 on: December 03, 2015, 02:16:29 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Loader.readTextureNames3DS raise an exception
« Reply #2 on: December 03, 2015, 05:02:04 pm »
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.

Offline mAlinka

  • byte
  • *
  • Posts: 21
    • View Profile
Re: Loader.readTextureNames3DS raise an exception
« Reply #3 on: December 04, 2015, 07:52:23 am »
I've tried a new version and it works! No exceptions and even texture names was loaded.
Thank you for reply and attention!