Package com.jmex.model.converters

Examples of com.jmex.model.converters.FormatConverter


  public static void convertObjToJme(URL url) throws IOException {
    if(url == null) {
      System.err.println("url is null");
      return;
    }
    FormatConverter converter = new ObjToJme();
    converter.setProperty("mtllib", url); //tell the converter where to find mtl files
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
   
    converter.convert(url.openStream(), outStream);
   
    URL newFile = new URL(url.toString().replaceAll(".obj", ".jme"));
   
    FileOutputStream fileStream = new FileOutputStream(newFile.toString());
    outStream.writeTo(fileStream);
View Full Code Here


   *       it cannot load the specified model
   */
  public static Spatial loadModel(URL name) {
    Spatial model;
   
    FormatConverter converter = new ObjToJme();
    converter.setProperty("mtllib", name); //tell converter where to find the mtl file
   
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
   
    try {
      converter.convert(name.openStream(), outStream);
     
      //now that it's converted, load the model
      model = (Spatial)BinaryImporter.getInstance().load(new ByteArrayInputStream(outStream.toByteArray()));
    } catch (IOException e) {
      System.err.println("Error while converting or loading the model");
View Full Code Here

TOP

Related Classes of com.jmex.model.converters.FormatConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.