Newbie to jME with questions

Very new to this forum.



My project group at school is trying to make a 3D version of Tetris with pieces crafted in Art of Illusion. We currently have a playable version that uses GLUT to draw plain cubes for occupied positions. However, this looks rater sad and we'd like to make use of AOI for more detailed pieces. We're using AOI version 2.4 and JOGL version 1.1.1 in case it makes a difference.



I've made a 3D cube in AOI and tried converting the exported obj file to jME. I haven't been successful with TestObjJmeWrite. I found for an eclipse plugin that does conversions, and it created a jME file of my object. So what can I do with this file? Is there a jME gui app that I can run this file with?  :?

You can use com.jme.util.export.binary.BinaryImporter to load JME models (.jbin).



Sample:


package test.model;

import com.jme.scene.Node;
import com.jme.util.export.binary.*;
import java.io.IOException;
import java.net.URL;

public class TModelLoader {

   public static Node loadModel(String modelFile) throws IOException {
      Node loadedModel = null;   
      URL modelURL = new URL("file:"+modelFile);
      // load the jbin format
      loadedModel = (Node)BinaryImporter.getInstance().load(
         modelURL.openStream()
      );
      return loadedModel;
   }

}


Even better, in the JME source you can find some useful examples (./src/jmetest/TutorialGuide/HelloModelLoading.java)

You should be able to rename it to .jme and load it with com.jmex.model.util.ModelLoader - which can also convert to .jme

I've got the plugin already that converts my wavefront format .obj into a jme file. I guess I don't see what the point is doing the conversion. Is there an application that will render the newly converted jme file?

The .jme file is a binary file which can be loaded extremely fast in comparison to other XML or text based formats.  It is also smaller.



You can import any model directly into your game but .jme is recommended for the above stated reasons.  Take a look at the code in ModelLoader for information about how to load a .jme file into your game.

uwtcssundergrad said:
Is there an application that will render the newly converted jme file?

yes: com.jmex.model.util.ModelLoader :)

So I've gotten my object to load. This time, I don't know how to get the textures imported as well. jME loads the object fine, just without the textures.



AOI has the option to export to a obj with a mtl. Not sure if this helps answer the question.

Typically the textures are exported as images and ModelLoader can pick that up dynamically if you just have those in the same directory as the model you're loading.

Thanks darkfrog! I put the mtl file in the same directory as the object file and it loaded. The glass texture didn't work however (object is an hourglass), and it shows as a black.

If you post the files perhaps someone with more knowledge about model loading could give you some idea what's wrong.