com.jmex.model.converters
Class ObjToJme

java.lang.Object
  extended by com.jmex.model.converters.FormatConverter
      extended by com.jmex.model.converters.ObjToJme

public class ObjToJme
extends FormatConverter

Started Date: Jul 17, 2004

Converts .obj files into .jme binary format. In order for ObjToJme to find the .mtl library, you must specify the "mtllib" tag to the baseURL where the mtl libraries are to be found: eg. setProperty("mtllib",new File("c:/my material dir/").toURL()); Textures will be loaded from the directory indicated in the model unless you specify a directory to load them from via setting a property: eg. setProperty("texdir", new File("c:/my texdir/").toURL());

Author:
Jack Lindamood, Joshua Slack - revamped to improve speed

Field Summary
 
Fields inherited from class com.jmex.model.converters.FormatConverter
properties
 
Constructor Summary
ObjToJme()
           
 
Method Summary
 void convert(java.io.InputStream format, java.io.OutputStream jMEFormat)
          Converts an .obj file to .jme format.
 boolean isGenerateMissingNormals()
           
static void main(java.lang.String[] args)
          Converts an Obj file to jME format.
 void setGenerateMissingNormals(boolean generateMissingNormals)
          Set whether to generate missing face normals.
 
Methods inherited from class com.jmex.model.converters.FormatConverter
attemptFileConvert, clearProperty, getProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjToJme

public ObjToJme()
Method Detail

main

public static void main(java.lang.String[] args)
Converts an Obj file to jME format. The syntax is: "ObjToJme file.obj outfile.jme".

Parameters:
args - The array of parameters

convert

public void convert(java.io.InputStream format,
                    java.io.OutputStream jMEFormat)
             throws java.io.IOException
Converts an .obj file to .jme format. If you wish to use a .mtl to load the obj's material information please specify the base url where the .mtl is located with setProperty("mtllib",new URL(baseURL))

Specified by:
convert in class FormatConverter
Parameters:
format - The .obj file's stream.
jMEFormat - The .jme file's stream.
Throws:
java.io.IOException - If anything bad happens.

isGenerateMissingNormals

public boolean isGenerateMissingNormals()
Returns:
true if the loader will generate missing face normals (default is true)

setGenerateMissingNormals

public void setGenerateMissingNormals(boolean generateMissingNormals)
Set whether to generate missing face normals.

Parameters:
generateMissingNormals - the generateMissingNormals to set