libgdx API

com.badlogic.gdx.graphics.g3d.loaders
Class ModelLoaderRegistry

java.lang.Object
  extended by com.badlogic.gdx.graphics.g3d.loaders.ModelLoaderRegistry

public class ModelLoaderRegistry
extends java.lang.Object

Simple "pluggable" class for loading models. Keeps a list of ModelLoader instances on a per file suffix basis. Use one of the static methods to load a Model. The registry will then try out all the registered loaders for that extension and eventually return a Model or throw a GdxRuntimeException.

Author:
mzechner

Constructor Summary
ModelLoaderRegistry()
           
 
Method Summary
static Model load(FileHandle file)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static Model load(FileHandle file, ModelLoaderHints hints)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static KeyframedModel loadKeyframedModel(FileHandle file)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static KeyframedModel loadKeyframedModel(FileHandle file, ModelLoaderHints hints)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static SkeletonModel loadSkeletonModel(FileHandle file)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static SkeletonModel loadSkeletonModel(FileHandle file, ModelLoaderHints hints)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static StillModel loadStillModel(FileHandle file)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static StillModel loadStillModel(FileHandle file, ModelLoaderHints hints)
          Loads the specified file with one of the loaders registered with this ModelLoaderRegistry.
static void registerLoader(java.lang.String extension, ModelLoader loader, ModelLoaderHints defaultHints)
          Registers a new loader with the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelLoaderRegistry

public ModelLoaderRegistry()
Method Detail

registerLoader

public static void registerLoader(java.lang.String extension,
                                  ModelLoader loader,
                                  ModelLoaderHints defaultHints)
Registers a new loader with the registry. The extension will be used to match the loader against a file to be loaded. The extension will be compared case insensitive. If multiple loaders are registered per extension they will be tried on a file in the sequence they have been registered until one succeeds or none succeed.

Parameters:
extension - the extension string, e.g. "dae" or "obj"
loader - the ModelLoader
defaultHints - the default ModelLoaderHints to be used with this loader.

load

public static Model load(FileHandle file)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive.

Parameters:
file - the file to be loaded
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

load

public static Model load(FileHandle file,
                         ModelLoaderHints hints)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive.

Parameters:
file - the file to be loaded
hints - the ModelLoaderHints to use
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

loadStillModel

public static StillModel loadStillModel(FileHandle file)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive. Uses only StillModelLoader instances.

Parameters:
file - the file to be loaded
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

loadStillModel

public static StillModel loadStillModel(FileHandle file,
                                        ModelLoaderHints hints)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive. Uses only StillModelLoader instances.

Parameters:
file - the file to be loaded
hints - the ModelLoaderHints to be used.
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

loadKeyframedModel

public static KeyframedModel loadKeyframedModel(FileHandle file)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive. Uses only KeyframedModelLoader instances.

Parameters:
file - the file to be loaded
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

loadKeyframedModel

public static KeyframedModel loadKeyframedModel(FileHandle file,
                                                ModelLoaderHints hints)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive. Uses only KeyframedModelLoader instances.

Parameters:
file - the file to be loaded
hints - the Model
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

loadSkeletonModel

public static SkeletonModel loadSkeletonModel(FileHandle file)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive. Uses only SkeletonModelLoader instances.

Parameters:
file - the file to be loaded
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

loadSkeletonModel

public static SkeletonModel loadSkeletonModel(FileHandle file,
                                              ModelLoaderHints hints)
Loads the specified file with one of the loaders registered with this ModelLoaderRegistry. Uses the extension to determine which loader to use. The comparison of extensions is done case insensitive. Uses only SkeletonModelLoader instances.

Parameters:
file - the file to be loaded
hints - the ModelLoaderHints to use
Returns:
the Model
Throws:
GdxRuntimeException - in case the model could not be loaded.

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)