Serialization Problem

Started by AGP, October 24, 2013, 12:53:18 PM

Previous topic - Next topic

AGP

The following code produces the message at the bottom. What's wrong?


        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);



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

EgonOlsen

Make sure not to serialize it in reduced mode if you are loading it with the desktop version. Maybe that causes the problem?

AGP

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?

EgonOlsen

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.

AGP

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!

EgonOlsen

Because there is none. That's not an error, it's just a log message.