Loading a 3DS file (min3D framework for Android)
Posted by Dennis on May 19, 2010 in 3D, Android • 6 commentsAnother update to the min3D framework for Android. A new parser that allows you to load in 3DS files (used by the Autodesk 3ds Max 3D modeling, animation and rendering software).
In the previous tutorials (Loading 3D models with the min3D framework for Android and Loading multiple 3D objects from an Obj file (min3D for Android)) there are some basic instructions regarding resource names that apply to this bit of code as well.
Here’s the code (can be found in the Google Code repository as well):
package min3d.sampleProject1;
import min3d.core.Object3dContainer;
import min3d.core.RendererActivity;
import min3d.parser.IParser;
import min3d.parser.Parser;
public class ExampleLoad3DSFile extends RendererActivity {
private final float CAM_RADIUS_X = 20;
private final float CAM_RADIUS_Y = 15;
private final float CAM_RADIUS_Z = 30;
private final float ROTATION_SPEED = 1;
private Object3dContainer monster;
private float degrees;
@Override
public void initScene() {
IParser parser = Parser.createParser(Parser.Type.MAX_3DS,
getResources(), "min3d.sampleProject1:raw/monster_high");
parser.parse();
monster = parser.getParsedObject();
monster.scale().x = monster.scale().y = monster.scale().z = .5f;
monster.position().y = -10;
scene.addChild(monster);
scene.camera().target = monster.position();
}
@Override
public void updateScene() {
float radians = degrees * ((float)Math.PI / 180);
scene.camera().position.x = (float)Math.cos(radians) * CAM_RADIUS_X;
scene.camera().position.y = (float)Math.sin(radians) * CAM_RADIUS_Y;
scene.camera().position.z = (float)Math.sin(radians) * CAM_RADIUS_Z;
degrees += ROTATION_SPEED;
}
}
Here’s the result (click the image to see the youtube video):





Wow you’re getting amazing performance in the emulator, I would have thought you’d only get a couple of FPS, have you installed a real libgl.so somehow? Obviously I expect this to FLY on the device
Haha no, I sped up the video a bit. Emulator performance is terrible to say the least. Do you happen to know of an application that can grab a video from the handset?
Hmm none that I have heard of yet sorry. Maybe this:
http://www.androidguys.com/2009/01/30/projecting-android-on-the-big-screen/
I have DroidEx working now, don’t forget to also download the dependency args4j-2.0.16.jar, I can show you Thurs if you are around.
Help! I am getting a Rescourses$NotFoundException when debugging ExampleLoadObjFile and ExampleKeyframeAnimation at the line that reads “parse.parse();” I have no idea why this is happening.
The following wouldn’t work for me, because the parsing was involved
ExampleKeyframeAnimation
ExampleLoad3DSFile
ExampleLoadMD2File
ExampleLoadObjFile
ExampleLoadObjFileMultiple
SplashActivity