com.jmex.model.collada
Class ColladaImporter

java.lang.Object
  extended by com.jmex.model.collada.ColladaImporter

public class ColladaImporter
extends java.lang.Object

ColladaNode provides a mechanism to parse and load a COLLADA (COLLAborative Design Activity) model. Making use of a DOM parse, the XML formatted COLLADA file is parsed into Java Type classes and then processed by jME. This processing is currently aimed at the 1.4.1 release of the COLLADA Specification, and will, in most likelihood, require updating with a new release of COLLADA.

Author:
Mark Powell, Rikard Herlitz, and others

Field Summary
static boolean OPTIMIZE_GEOMETRY
           
static OptimizeCallback optimizeCallBack
           
 
Method Summary
static void addUserInformation(java.lang.String key, java.lang.Object value)
           
static void addUVControllerName(java.lang.String name)
           
static void cleanUp()
           
 StencilState.StencilOperation evaluateStencilOp(java.lang.String value)
           
static java.lang.Object get(java.lang.Object id)
           
static BoneAnimation getAnimationController(java.lang.String id)
           
 java.lang.String getAssetInformation()
          getAssetInformation returns a string of the collected asset information of this COLLADA model.
static CameraNode getCameraNode(java.lang.String id)
           
static java.util.ArrayList<java.lang.String> getCameraNodeNames()
          Returns the camera node names associated with this model.
static java.util.ArrayList<java.lang.String> getControllerNames()
          returns the names of the controllers that affect this imported model.
static Geometry getGeometry(java.lang.String id)
           
static java.util.ArrayList<java.lang.String> getGeometryNames()
           
static ColladaImporter getInstance()
           
static LightNode getLightNode(java.lang.String id)
           
static java.util.ArrayList<java.lang.String> getLightNodeNames()
           
static Node getModel()
           
 java.lang.String getModelAuthor()
          Author of the last loaded collada model.
 java.lang.String getRevision()
          Revision number of the last loaded collada model.
static Bone getSkeleton(java.lang.String id)
           
static java.util.ArrayList<java.lang.String> getSkeletonNames()
           
static SkinNode getSkinNode(java.lang.String id)
           
static java.util.ArrayList<java.lang.String> getSkinNodeNames()
          returns the names of the skin nodes that are associated with this imported model.
 java.lang.String getTool()
          the tool used to build the last collada model.
 float getUnitMeter()
          the unit scale of the last collada model.
 java.lang.String getUnitName()
          the unit name of the last collada model.
static java.lang.Object getUserInformation(java.lang.String key)
           
static TextureKeyframeController getUVAnimationController(java.lang.String id)
           
static java.util.ArrayList<java.lang.String> getUVControllerNames()
           
static boolean hasUserInformation(java.lang.String key)
           
static void load(java.io.InputStream source, java.lang.String name)
          load takes the model path as a string object and uses the COLLADASchemaDoc object to load it.
 void processCollada(COLLADAType root)
          processCollada takes a COLLADAType object that contains the heirarchical information obtained from the XML structure of a COLLADA model.
 void processScene(sceneType scene)
          processScene finalizes the model node to be returned as the COLLADA model.
 TextureState processTexture(java.lang.String key, ColladaMaterial mat, int index)
           
 TextureState processTexture(textureType texture, ColladaMaterial mat)
          processTexture generates a texture state that contains the image and texture coordinate unit information.
static void put(java.lang.String key, java.lang.Object value)
          places an object into the resource library with a given key.
 void shutdown()
           
static void squelchErrors(boolean b)
          squelchErrors sets if the ColladaImporter should spit out errors or not
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIMIZE_GEOMETRY

public static boolean OPTIMIZE_GEOMETRY

optimizeCallBack

public static OptimizeCallback optimizeCallBack
Method Detail

hasUserInformation

public static boolean hasUserInformation(java.lang.String key)

addUserInformation

public static void addUserInformation(java.lang.String key,
                                      java.lang.Object value)

getUserInformation

public static java.lang.Object getUserInformation(java.lang.String key)

load

public static void load(java.io.InputStream source,
                        java.lang.String name)
load takes the model path as a string object and uses the COLLADASchemaDoc object to load it. This is then stored as a hierarchy of data objects. This hierarchy is passed to the processCollada method to build the jME data structures necessary to view the model.

Parameters:
source - the source to import.
textureDirectory - the location of the textures.
name - the name of the node.

getControllerNames

public static java.util.ArrayList<java.lang.String> getControllerNames()
returns the names of the controllers that affect this imported model.

Returns:
the list of string values for each controller name.

getUVControllerNames

public static java.util.ArrayList<java.lang.String> getUVControllerNames()
Returns:

addUVControllerName

public static void addUVControllerName(java.lang.String name)

getSkinNodeNames

public static java.util.ArrayList<java.lang.String> getSkinNodeNames()
returns the names of the skin nodes that are associated with this imported model.

Returns:
the names of the skin nodes associated with this model.

getCameraNodeNames

public static java.util.ArrayList<java.lang.String> getCameraNodeNames()
Returns the camera node names associated with this model.

Returns:
the list of camera names that are referenced in this file.

getLightNodeNames

public static java.util.ArrayList<java.lang.String> getLightNodeNames()

getSkeletonNames

public static java.util.ArrayList<java.lang.String> getSkeletonNames()

getGeometryNames

public static java.util.ArrayList<java.lang.String> getGeometryNames()

getModel

public static Node getModel()

getSkinNode

public static SkinNode getSkinNode(java.lang.String id)

getCameraNode

public static CameraNode getCameraNode(java.lang.String id)

getLightNode

public static LightNode getLightNode(java.lang.String id)

get

public static java.lang.Object get(java.lang.Object id)

put

public static void put(java.lang.String key,
                       java.lang.Object value)
places an object into the resource library with a given key. If there is an object referenced by this key and it is not the same object that is to be added to the library, a warning is issued. If this object already exists in the library we do not readd it.

Parameters:
key - the key to obtain the object from the library.
value - the object to store in the library.

getAnimationController

public static BoneAnimation getAnimationController(java.lang.String id)

getUVAnimationController

public static TextureKeyframeController getUVAnimationController(java.lang.String id)

getSkeleton

public static Bone getSkeleton(java.lang.String id)

getGeometry

public static Geometry getGeometry(java.lang.String id)

cleanUp

public static void cleanUp()

shutdown

public void shutdown()

getModelAuthor

public java.lang.String getModelAuthor()
Author of the last loaded collada model.

Returns:
the modelAuthor the author of the last loaded model.

getRevision

public java.lang.String getRevision()
Revision number of the last loaded collada model.

Returns:
the revision revision number of the last loaded collada model.

getTool

public java.lang.String getTool()
the tool used to build the last collada model.

Returns:
the tool

getUnitMeter

public float getUnitMeter()
the unit scale of the last collada model.

Returns:
the unitMeter

getUnitName

public java.lang.String getUnitName()
the unit name of the last collada model.

Returns:
the unitName

getAssetInformation

public java.lang.String getAssetInformation()
getAssetInformation returns a string of the collected asset information of this COLLADA model. The format is such:
AUTHOR REVISION
TOOL
UNITNAME UNITMETER
UPAXIS

Returns:
the string representation of the asset information of this file.

processCollada

public void processCollada(COLLADAType root)
processCollada takes a COLLADAType object that contains the heirarchical information obtained from the XML structure of a COLLADA model. This root object is processed and sets the data structures for jME to render the model to *this* object.

Parameters:
root - the COLLADAType data structure that contains the COLLADA model information.

processScene

public void processScene(sceneType scene)
                  throws java.lang.Exception
processScene finalizes the model node to be returned as the COLLADA model. This looks up visual scene instances that were placed in the resource library previously.

Parameters:
scene - the scene to process
Throws:
java.lang.Exception - thrown if there is an error processing the xml.

evaluateStencilOp

public StencilState.StencilOperation evaluateStencilOp(java.lang.String value)

processTexture

public TextureState processTexture(textureType texture,
                                   ColladaMaterial mat)
                            throws java.lang.Exception
processTexture generates a texture state that contains the image and texture coordinate unit information. This texture state is returned to be placed in the Collada material.

Parameters:
texture - the texture type to process.
Returns:
the generated TextureState that handles this texture tag.
Throws:
java.lang.Exception - thrown if there is a problem processing the xml.

processTexture

public TextureState processTexture(java.lang.String key,
                                   ColladaMaterial mat,
                                   int index)
                            throws java.lang.Exception
Throws:
java.lang.Exception

squelchErrors

public static void squelchErrors(boolean b)
squelchErrors sets if the ColladaImporter should spit out errors or not

Parameters:
b -

getInstance

public static ColladaImporter getInstance()


Copyright 2003-2009 jMonkeyEngine