1
Support / Re: How can I serialize a mesh?
« on: August 11, 2011, 03:46:24 pm »
so with the touchevents i can slide
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
TextureManager.getInstance().flush();
TextureManager tm = TextureManager.getInstance();
Texture textureai1 = new Texture(getResources().getDrawable(R.drawable.ai1));
Texture textureai2 = new Texture(getResources().getDrawable(R.drawable.ai2));
tm.addTexture("ai1", textureai1);
tm.addTexture("ai2", textureai2);
i have loaded nothing texture in my scene, nothing
TextureManager.getInstance().flush();
TextureManager tm = TextureManager.getInstance();
Texture textureai1 = new Texture(getResources().getDrawable(R.drawable.ai1));
Texture textureai2 = new Texture(getResources().getDrawable(R.drawable.ai2));
tm.addTexture("ai1", textureai1);
tm.addTexture("ai2", textureai2);
Object3D[] scee = Loader.loadSerializedObjectArray(getResources().openRawResource(R.raw.sersce));
world.addObjects(scee);
for(int i = 0; i < scee.length; i++) {
System.out.println("serializing object: " + i + "/" + scee.length);
SimpleVector Sv = new SimpleVector();
Sv.x = 0;
Sv.y = 0;
Sv.z = 0;
scee[i].strip();
scee[i].build();
TextureManager.getInstance().flush();
TextureManager tm = TextureManager.getInstance();
Texture textureai1 = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.ai1)), 256, 256));
Texture textureai2 = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.ai2)), 256, 256));
textureai1.compress();
textureai2.compress();
tm.addTexture("ai1", textureai1);
tm.addTexture("ai2", textureai2);
Object3D[] scee = Loader.loadSerializedObjectArray(getResources().openRawResource(R.raw.sersce));
world.addObjects(scee);
for(int i = 0; i < scee.length; i++) {
System.out.println("serializing object: " + i + "/" + scee.length);
SimpleVector Sv = new SimpleVector();
Sv.x = 0;
Sv.y = 0;
Sv.z = 0;
scee[i].strip();
scee[i].build();
for(int i = 0; i < scee.length; i++) {
System.out.println("serializing object: " + i + "/" + scee.length);
scee[i].build();
de.serialize(scee[i], new FileOutputStream("C:/workspace/file/res/raw/serscee"+i+".ser"), true);
}
How do i do to not load each ser one per one, i try , i try to load by array but i don't arrive, there is possibility that you help me same if i am bad in javatm.addTexture("ai", textureai);
scee[i].setTexture("ai");
Object3D[] sce = null;
TextureManager.getInstance().flush();
TextureManager tm = TextureManager.getInstance();
Texture textureai = new Texture("C:/workspace/file/res/drawable/ai.jpg");
DeSerializer de;
sce = Loader.load3DS("C:/workspace/file/res/raw/sce.3ds",20);
tm.addTexture("ai", textureai);
sce.setTexture("ai");
// sce.build();
de = new DeSerializer();
de.serializeArray(sce, new FileOutputStream("C:/workspace/file/res/raw/sersc.ser"), true);
Scee = Loader.loadSerializedObjectArray(getResources().openRawResource(R.raw.sersc));
and i have the same problem that in my jpct i have changed the public static void main(String[ ] args) throws FileNotFoundException {
Object3D[] sc = null;
DeSerializer de;
sc = Loader.load3DS("C:/workspace/file/res/raw/sc.3ds",20);
//sc.build;
de = new DeSerializer();
de.serializeArray(sc, new FileOutputStream("C:/workspace/file/res/raw/sersc.ser"), true);
}
}
i write this, i have modified the serialize by the serializeArray, but i have still an object which is loaded TextureManager.getInstance().flush();
TextureManager tm = TextureManager.getInstance();
Texture textureai= new Texture("C:/workspace/file/res/drawable/ai.jpg");
tm.addTexture("ai", textureai);
scene.setTexture("textureai");
it's correct, is'nt it??