Hi Guys,
I am currently working on a Project but my problem is i got a big file cause it is a building for a game to move in. I serialized it and now zipped it also cause i had a outofmemory exception but the loading from the zip file doesnt work here is the code
ZipInputStream zis = new ZipInputStream(mContext.getResources().openRawResource(R.raw.ab));
// try {
// if(zis.getNextEntry() != null)
// zis.getNextEntry(); tried this already
// } catch (IOException e) {e.printStackTrace();}
model = Loader.loadSerializedObject(zis);
// model.calcTextureWrapSpherical();
// model.setTexture("texture");
model.strip();
model.scale(10);
model.build();
world.addObject(model);
the exception i get is: (im not getting whats actually wrong here so i ask you guys)
Systemerr:
java.lang.NullPointerException at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:61)
at com.threed.jpct.Loader.loadSerializedObject(Loader.java:104)
at and.testandroid.JPCTAESkeletonActivity$MyRenderer.onSurfaceChanged(JPCTAESkeletonActivity.java:197)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1325)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
so i get this fatal error
java.lang.RuntimeException: [ 1411066378308 ] - ERROR: Can't deserialize object: null
i know that the loader seems not to load the file correctly but why?
file is located in res/raw/ab.zip/ab.ser
so what am i missing here that it cannot be loaded?
i serlialized the object with that code
Object3D model = null;
String modelName = "ab";
// TextureManager.getInstance().flush();
//TextureManager tm = TextureManager.getInstance();
//Texture grass2 = new Texture("C:/Worksapce/SaveMe/res/raw/f15e.jpg");
DeSerializer de = new DeSerializer();
model = model.mergeAll(Loader.load3DS(new FileInputStream("C:/Users/Jascha/documents/3DObjects/"+modelName+".3ds"), 1));
model.build();
de.serialize(model, new FileOutputStream("C:/users/Jascha/documents/3DObjects/serialized/"+modelName+".ser"), true);
code worked fine with small models and without zip
Thank you for your help