Author Topic: Serialization Problem  (Read 2121 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Serialization Problem
« on: October 24, 2013, 12:53:18 pm »
The following code produces the message at the bottom. What's wrong?

Code: [Select]
        chunk2 = Loader.loadSerializedObject(new FileInputStream("chunk2.ser"));
Object3D chunk2Trees = Loader.loadSerializedObject(new FileInputStream("chunk2trees.ser"));
chunk2Trees.setTransparency(100);
chunk2Blades = Loader.loadSerializedObjectArray(new FileInputStream("chunk2blades.ser"));
for (int i = 0; i < chunk2Blades.length; i++) {
     chunk2.addChild(chunk2Blades[i]);
     chunk2Blades[i].build();
     theWorld.addObject(chunk2Blades[i]);
}
chunk2Trees.build();
chunk2.build();
chunk2.addChild(chunk2Trees);
chunk2.setRotationPivot(SimpleVector.ORIGIN);
chunk2.rotateX((float)Math.PI*-.5f);//-.5f
chunk2.translate(superman.getZ().x*-59700f, 0, superman.getZ().z*-59700f);
theWorld.addObject(chunk2Trees);
theWorld.addObject(chunk2);
chunk3 = Loader.loadSerializedObject(new FileInputStream("chunk3.ser"));
chunk3.build();
chunk3.setRotationPivot(SimpleVector.ORIGIN);
chunk3.rotateX((float)Math.PI*-.5f);//-.5f
chunk3.translate(superman.getZ().x*-119400f, 0, superman.getZ().z*-119400f);
theWorld.addObject(chunk3);

Code: [Select]
java.lang.ArrayIndexOutOfBoundsException: 69518
        at com.threed.jpct.Object3D.recreateTextureCoords(Object3D.java:4840)
        at com.threed.jpct.Object3D.build(Object3D.java:1830)
        at SuperEndless.loadModelsSerialized(SuperEndless.java:181)
        at SuperEndless.<init>(SuperEndless.java:122)
        at SuperEndless.main(SuperEndless.java:391)
[ Thu Oct 24 12:45:21 BRST 2013 ] - ERROR: Couldn't build() object (object542):
java.lang.ArrayIndexOutOfBoundsException/69518
No octree found in serialized data!
java.lang.ArrayIndexOutOfBoundsException: 70061
        at com.threed.jpct.Object3D.recreateTextureCoords(Object3D.java:4840)
        at com.threed.jpct.Object3D.build(Object3D.java:1830)
        at SuperEndless.loadModelsSerialized(SuperEndless.java:189)
        at SuperEndless.<init>(SuperEndless.java:122)
        at SuperEndless.main(SuperEndless.java:391)
[ Thu Oct 24 12:45:21 BRST 2013 ] - ERROR: Couldn't build() object (object1707):
 java.lang.ArrayIndexOutOfBoundsException/70061

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Serialization Problem
« Reply #1 on: October 24, 2013, 01:50:21 pm »
Make sure not to serialize it in reduced mode if you are loading it with the desktop version. Maybe that causes the problem?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Serialization Problem
« Reply #2 on: October 24, 2013, 02:07:32 pm »
Yes, I'm testing with desktop. My intention is to load them on Android, though. Thanks for the tip. If it's not in the docs, would you mind adding it?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Serialization Problem
« Reply #3 on: October 24, 2013, 04:01:52 pm »
It is documented that reduced=true is for Android and false for desktop in the description of the parameter, but it might not be clear enough. I should make the file itself aware of this and throw a proper exception if one loads a reduced file on the desktop.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Serialization Problem
« Reply #4 on: October 26, 2013, 10:57:39 am »
Cool, thanks. Now I'm getting the following:

No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Serialization Problem
« Reply #5 on: October 26, 2013, 02:26:35 pm »
Because there is none. That's not an error, it's just a log message.