Hi,
im an absolute beginner with jpct-ae and now trying to import a .3ds file, which i made in blender (its already got a texture).
I was reading in this forum for quite some time and in the API of jpct but didnt succeed to get it work.
I already managed to get my app run, showing a cube, that can be turned by touch, now i just want to replace this cube by my .3ds file.
I read a comment somewhere in this forum, that the .3ds file should be in res/raw folder, is this correct?
And what code do i have to use to import the .3ds?
Till now, my code looks like this (excerpt)
[...]
Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(masterContext.getResources().getDrawable(R.drawable.ic_launcher)), 64, 64));
TextureManager.getInstance().addTexture("ic_launcher", texture);
cube = Primitives.getCube(10);
cube.calcTextureWrapSpherical();
cube.setTexture("ic_launcher");
cube.strip();
cube.build();
world.addObject(cube);
[...]
I tried to load the file via the loadModel-method from the API:
private Object3D loadModel(String filename, float scale) throws IOException {
InputStream stream = mContext.getAssets().open("cube.3ds");
Object3D[] model = Loader.load3DS(stream, 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;
}
I have no clue, if this is the right approach.
My .3ds file is very small, I think like 1KB (its just a cube also), so it should work without renaming it to .mp3.
Thanks for the help.