com.jme3.scene.plugins.blender
Class BlenderLoader

java.lang.Object
  extended by com.jme3.scene.plugins.blender.BlenderLoader
All Implemented Interfaces:
AssetLoader
Direct Known Subclasses:
BlenderModelLoader

public class BlenderLoader
extends java.lang.Object

This is the main loading class. Have in notice that asset manager needs to have loaders for resources like textures.


Field Summary
protected  BlenderContext blenderContext
           
protected  java.util.List<FileBlockHeader> blocks
          The blocks read from the file.
 
Constructor Summary
BlenderLoader()
           
 
Method Summary
protected  boolean isRootObject(BlenderKey.LoadingResults loadingResults, Spatial spatial)
          This method indicates if the given spatial is a root object.
 Spatial load(AssetInfo assetInfo)
          Loads asset from the given input stream, parsing it into an application-usable object.
protected  void setup(AssetInfo assetInfo)
          This method sets up the loader.
 Camera toCamera(Structure structure)
          This method converts the given structure to a camera.
 Light toLight(Structure structure)
          This method converts the given structure to a light.
 java.util.List<Geometry> toMesh(Structure structure)
          This method converts the given structure to a list of geometries.
 java.lang.Object toObject(Structure structure)
          This method converts the given structure to a node.
 Node toScene(Structure structure)
          This method converts the given structure to a scene node.
 BlenderKey.WorldData toWorldData(Structure structure)
          This method returns the data read from the WORLD file block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blocks

protected java.util.List<FileBlockHeader> blocks
The blocks read from the file.


blenderContext

protected BlenderContext blenderContext
Constructor Detail

BlenderLoader

public BlenderLoader()
Method Detail

load

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

Returns:
An object representing the resource.
Throws:
java.io.IOException - If an I/O error occurs while loading

isRootObject

protected boolean isRootObject(BlenderKey.LoadingResults loadingResults,
                               Spatial spatial)
This method indicates if the given spatial is a root object. It means it has no parent or is directly attached to one of the already loaded scene nodes.

Parameters:
loadingResults - loading results containing the scene nodes
spatial - spatial object
Returns:
true if the given spatial is a root object and false otherwise

setup

protected void setup(AssetInfo assetInfo)
              throws BlenderFileException
This method sets up the loader.

Parameters:
assetInfo - the asset info
Throws:
BlenderFileException - an exception is throw when something wrong happens with blender file

toScene

public Node toScene(Structure structure)
This method converts the given structure to a scene node.

Parameters:
structure - structure of a scene
Returns:
scene's node

toCamera

public Camera toCamera(Structure structure)
                throws BlenderFileException
This method converts the given structure to a camera.

Parameters:
structure - structure of a camera
Returns:
camera's node
Throws:
BlenderFileException

toLight

public Light toLight(Structure structure)
              throws BlenderFileException
This method converts the given structure to a light.

Parameters:
structure - structure of a light
Returns:
light's node
Throws:
BlenderFileException

toObject

public java.lang.Object toObject(Structure structure)
                          throws BlenderFileException
This method converts the given structure to a node.

Parameters:
structure - structure of an object
Returns:
object's node
Throws:
BlenderFileException

toMesh

public java.util.List<Geometry> toMesh(Structure structure)
                                throws BlenderFileException
This method converts the given structure to a list of geometries.

Parameters:
structure - structure of a mesh
Returns:
list of geometries
Throws:
BlenderFileException

toWorldData

public BlenderKey.WorldData toWorldData(Structure structure)
This method returns the data read from the WORLD file block. The block contains data that can be stored as separate jme features and therefore cannot be returned as a single jME scene feature.

Parameters:
structure - the structure with WORLD block data
Returns:
data read from the WORLD block that can be added to the scene