Class ObjLoader
- java.lang.Object
-
- com.badlogic.gdx.assets.loaders.AssetLoader<T,P>
-
- com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<IntModel,P>
-
- gaia.cu9.ari.gaiaorbit.util.gdx.loader.IntModelLoader<ObjLoader.ObjLoaderParameters>
-
- gaia.cu9.ari.gaiaorbit.util.gdx.loader.ObjLoader
-
public class ObjLoader extends IntModelLoader<ObjLoader.ObjLoaderParameters>
ModelLoader
to load Wavefront OBJ files. Only intended for testing basic models/meshes and educational usage. The Wavefront specification is NOT fully implemented, only a subset of the specification is supported. Especially theMaterial
(Attributes
), e.g. the color or texture applied, might not or not correctly be loaded.This
ModelLoader
can be used to load very basic models without having to convert them to a more suitable format. Therefore it can be used for educational purposes and to quickly test a basic model, but should not be used in production. Instead useG3dModelLoader
.Because of above reasons, when an OBJ file is loaded using this loader, it will log and error. To prevent this error from being logged, set the
logWarning
flag to false. However, it is advised not to do so.An OBJ file only contains the mesh (shape). It may link to a separate MTL file, which is used to describe one or more materials. In that case the MTL filename (might be case-sensitive) is expected to be located relative to the OBJ file. The MTL file might reference one or more texture files, in which case those filename(s) are expected to be located relative to the MTL file.
20171024 - Added support for emissive textures and colors
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ObjLoader.ObjLoaderParameters
-
Nested classes/interfaces inherited from class gaia.cu9.ari.gaiaorbit.util.gdx.loader.IntModelLoader
IntModelLoader.IntModelParameters
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
logWarning
Set to false to prevent a warning from being logged when this class is used.-
Fields inherited from class gaia.cu9.ari.gaiaorbit.util.gdx.loader.IntModelLoader
defaultParameters, items
-
-
Constructor Summary
Constructors Constructor Description ObjLoader()
ObjLoader(InputStreamProvider isp, com.badlogic.gdx.assets.loaders.FileHandleResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntModel
loadModel(com.badlogic.gdx.files.FileHandle fileHandle, boolean flipV)
Directly load the model on the calling thread.protected IntModelData
loadModelData(com.badlogic.gdx.files.FileHandle file, boolean flipV)
IntModelData
loadModelData(com.badlogic.gdx.files.FileHandle file, ObjLoader.ObjLoaderParameters parameters)
Directly load the raw model data on the calling thread.-
Methods inherited from class gaia.cu9.ari.gaiaorbit.util.gdx.loader.IntModelLoader
getDependencies, loadAsync, loadModel, loadModel, loadModel, loadModel, loadModelData, loadSync
-
-
-
-
Constructor Detail
-
ObjLoader
public ObjLoader()
-
ObjLoader
public ObjLoader(InputStreamProvider isp, com.badlogic.gdx.assets.loaders.FileHandleResolver resolver)
-
-
Method Detail
-
loadModel
public IntModel loadModel(com.badlogic.gdx.files.FileHandle fileHandle, boolean flipV)
Directly load the model on the calling thread. The model with not be managed by anAssetManager
.
-
loadModelData
public IntModelData loadModelData(com.badlogic.gdx.files.FileHandle file, ObjLoader.ObjLoaderParameters parameters)
Description copied from class:IntModelLoader
Directly load the raw model data on the calling thread.- Specified by:
loadModelData
in classIntModelLoader<ObjLoader.ObjLoaderParameters>
-
loadModelData
protected IntModelData loadModelData(com.badlogic.gdx.files.FileHandle file, boolean flipV)
-
-