How to directly load a jme model?

All tutorials explain how to load a model from a converter object. But how I can load it direclty from a jme model (already converted) ?



This engine look very good but lack of a good and complete documentation :slight_smile:

Here is my Util-function for loading a jME-Model:


public static Node loadJMEModel(String modelPath, String texturePath){
      // URL of the model
      URL model=ModelLoader.class.getClassLoader().getResource(modelPath);
        // URL of the texture
      URL tex=ModelLoader.class.getClassLoader().getResource(texturePath);

        JmeBinaryReader jbr=new JmeBinaryReader();
       
        try{
            // Tell the binary reader to use bounding boxes instead of bounding spheres
            jbr.setProperty("bound","box");
           
            // Load the binary .jme format into a scene graph
            Node modelNode=jbr.loadBinaryFormat(model.openStream());
           
            TextureState ts=DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
            ts.setTexture(TextureManager.loadTexture(tex,Texture.MM_LINEAR,Texture.FM_LINEAR));
            ts.setEnabled(true);
            modelNode.setRenderState(ts);
                       
            return modelNode;           
        }
        catch (IOException e) {   // Just in case anything happens
            System.out.println("Damn exceptions!" + e);
            e.printStackTrace();
           
            return null;
        }
    }

thank you :slight_smile: