com.jme3.scene.plugins
Class OBJLoader

java.lang.Object
  extended by com.jme3.scene.plugins.OBJLoader
All Implemented Interfaces:
AssetLoader

public final class OBJLoader
extends java.lang.Object
implements AssetLoader

Reads OBJ format models.


Nested Class Summary
protected static class OBJLoader.Face
           
protected  class OBJLoader.ObjectGroup
           
protected static class OBJLoader.Vertex
           
 
Field Summary
protected  AssetManager assetManager
           
protected  int curIndex
           
protected  java.lang.String currentMatName
           
protected  java.lang.String currentObjectName
           
protected  java.util.ArrayList<OBJLoader.Face> faces
           
protected  int geomIndex
           
protected  IntMap<OBJLoader.Vertex> indexVertMap
           
protected  ModelKey key
           
protected  java.util.HashMap<java.lang.String,java.util.ArrayList<OBJLoader.Face>> matFaces
           
protected  MaterialList matList
           
protected  java.util.ArrayList<Vector3f> norms
           
protected  int objectIndex
           
protected  java.lang.String objName
           
protected  Node objNode
           
protected  java.util.Scanner scan
           
protected  java.util.ArrayList<Vector2f> texCoords
           
protected  java.util.HashMap<OBJLoader.Vertex,java.lang.Integer> vertIndexMap
           
protected  java.util.ArrayList<Vector3f> verts
           
 
Constructor Summary
OBJLoader()
           
 
Method Summary
protected  Mesh constructMesh(java.util.ArrayList<OBJLoader.Face> faceList)
           
protected  Geometry createGeometry(java.util.ArrayList<OBJLoader.Face> faceList, java.lang.String matName)
           
protected  void findVertexIndex(OBJLoader.Vertex vert)
           
 java.lang.Object load(AssetInfo info)
          Loads asset from the given input stream, parsing it into an application-usable object.
protected  void loadMtlLib(java.lang.String name)
           
protected  boolean nextStatement()
           
protected  OBJLoader.Face[] quadToTriangle(OBJLoader.Face f)
           
protected  void readFace()
           
protected  boolean readLine()
           
protected  Vector2f readVector2()
           
protected  Vector3f readVector3()
           
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verts

protected final java.util.ArrayList<Vector3f> verts

texCoords

protected final java.util.ArrayList<Vector2f> texCoords

norms

protected final java.util.ArrayList<Vector3f> norms

faces

protected final java.util.ArrayList<OBJLoader.Face> faces

matFaces

protected final java.util.HashMap<java.lang.String,java.util.ArrayList<OBJLoader.Face>> matFaces

currentMatName

protected java.lang.String currentMatName

currentObjectName

protected java.lang.String currentObjectName

vertIndexMap

protected final java.util.HashMap<OBJLoader.Vertex,java.lang.Integer> vertIndexMap

indexVertMap

protected final IntMap<OBJLoader.Vertex> indexVertMap

curIndex

protected int curIndex

objectIndex

protected int objectIndex

geomIndex

protected int geomIndex

scan

protected java.util.Scanner scan

key

protected ModelKey key

assetManager

protected AssetManager assetManager

matList

protected MaterialList matList

objName

protected java.lang.String objName

objNode

protected Node objNode
Constructor Detail

OBJLoader

public OBJLoader()
Method Detail

reset

public void reset()

findVertexIndex

protected void findVertexIndex(OBJLoader.Vertex vert)

quadToTriangle

protected OBJLoader.Face[] quadToTriangle(OBJLoader.Face f)

readFace

protected void readFace()

readVector3

protected Vector3f readVector3()

readVector2

protected Vector2f readVector2()

loadMtlLib

protected void loadMtlLib(java.lang.String name)
                   throws java.io.IOException
Throws:
java.io.IOException

nextStatement

protected boolean nextStatement()

readLine

protected boolean readLine()
                    throws java.io.IOException
Throws:
java.io.IOException

createGeometry

protected Geometry createGeometry(java.util.ArrayList<OBJLoader.Face> faceList,
                                  java.lang.String matName)
                           throws java.io.IOException
Throws:
java.io.IOException

constructMesh

protected Mesh constructMesh(java.util.ArrayList<OBJLoader.Face> faceList)

load

public java.lang.Object load(AssetInfo info)
                      throws java.io.IOException
Description copied from interface: AssetLoader
Loads asset from the given input stream, parsing it into an application-usable object.

Specified by:
load in interface AssetLoader
Returns:
An object representing the resource.
Throws:
java.io.IOException - If an I/O error occurs while loading