Hi Egon,
When I tried to load 3ds model into jpct-ae, it showed the 3D object with black texture. Did I miss something? I did exactly like in JPCT wiki tutorial. I'm using Blender 2.66a to export the 3ds. If I call calcTextureWrapSpherical(), the texture shows. Unfortunately, I want it to follow the texture mapping in 3ds instead of jpct texture wrapping.
Code:
//onSurfaceChanged
try {
Object3D obj = load3DSModel(context.getAssets().open("monkey.3ds"), 20);
obj.setName("monkey");
obj.build();
world.addObject(obj);
} catch (IOException e) {
Log.e("kkl", "Error reading 3ds", e);
}
private Object3D load3DSModel(InputStream is, float scale) {
Object3D[] model = Loader.load3DS(is, scale);
Object3D o3d = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < model.length; i++) {
temp = model[i];
temp.setCenter(SimpleVector.ORIGIN);
temp.rotateX((float) (-.5 * Math.PI));
temp.rotateMesh();
temp.setRotationMatrix(new Matrix());
o3d = Object3D.mergeObjects(o3d, temp);
o3d.build();
}
return o3d;
}
Log:
05-05 23:23:04.348: I/jPCT-AE(15498): Loading file from InputStream
05-05 23:23:04.348: I/jPCT-AE(15498): Expanding buffers...16384 bytes
05-05 23:23:04.348: I/jPCT-AE(15498): File from InputStream loaded...16026 bytes
05-05 23:23:04.348: I/jPCT-AE(15498): Processing new material leafmat!
05-05 23:23:04.353: I/jPCT-AE(15498): Processing object from 3DS-file: Suzanne
05-05 23:23:04.418: I/jPCT-AE(15498): Object 'Suzanne_jPCT0' created using 968 polygons and 505 vertices.
05-05 23:23:04.468: I/jPCT-AE(15498): Normal vectors calculated in 37ms!
05-05 23:23:04.468: I/jPCT-AE(15498): Memory usage before compacting: 19105 KB used out of 19783 KB. Max. memory available to the VM is 49152 KB.
05-05 23:23:04.683: I/jPCT-AE(15498): Memory usage after compacting: 14468 KB used out of 19783 KB. Max. memory available to the VM is 49152 KB.
05-05 23:23:04.763: I/jPCT-AE(15498): Subobject of object 2/monkey compiled to indexed fixed point data using 2904/505 vertices in 55ms!
05-05 23:23:04.763: I/jPCT-AE(15498): Object 2/monkey compiled to 0 subobjects in 77ms!