Additional top-level class in compilation unit: MtlLoader.
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 the
Material (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 use G3dModelLoader.
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.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Array | |
| public static boolean | logWarning
Set to false to prevent a warning from being logged when this class is used. |
| pack-priv final FloatArray | |
| pack-priv final FloatArray | |
| pack-priv final FloatArray |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public Model | loadModel(final FileHandle fileHandle, boolean flipV)
Overrides com. Directly load the model on the calling thread. |
| public ModelData | loadModelData(FileHandle file, ObjLoader.
Implements abstract com. Directly load the raw model data on the calling thread. |
| protected ModelData | loadModelData(FileHandle file, boolean flipV)
Implements abstract com. Directly load the raw model data on the calling thread. |
| private ObjLoader. |
| groups | back to summary |
|---|---|
| pack-priv final Array<ObjLoader. | |
| logWarning | back to summary |
|---|---|
| public static boolean logWarning Set to false to prevent a warning from being logged when this class is used. Do not change this value, unless you are absolutely sure what you are doing. Consult the documentation for more information. | |
| norms | back to summary |
|---|---|
| pack-priv final FloatArray norms | |
| uvs | back to summary |
|---|---|
| pack-priv final FloatArray uvs | |
| verts | back to summary |
|---|---|
| pack-priv final FloatArray verts | |
| ObjLoader | back to summary |
|---|---|
| public ObjLoader() | |
| ObjLoader | back to summary |
|---|---|
| public ObjLoader(FileHandleResolver resolver) | |
| getIndex | back to summary |
|---|---|
| private int getIndex(String index, int size) | |
| loadModel | back to summary |
|---|---|
| public Model loadModel(final FileHandle fileHandle, boolean flipV) Overrides com. Directly load the model on the calling thread. The model with not be managed by an | |
| loadModelData | back to summary |
|---|---|
| public ModelData loadModelData(FileHandle file, ObjLoader. Implements abstract com. Doc from com. Directly load the raw model data on the calling thread.
| |
| loadModelData | back to summary |
|---|---|
| protected ModelData loadModelData(FileHandle file, boolean flipV) Implements abstract com. Doc from com. Directly load the raw model data on the calling thread. | |
| setActiveGroup | back to summary |
|---|---|
| private ObjLoader. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Array | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv Material | |
| pack-priv String | |
| pack-priv final String | |
| pack-priv int |
| faces | back to summary |
|---|---|
| pack-priv Array<Integer> faces | |
| hasNorms | back to summary |
|---|---|
| pack-priv boolean hasNorms | |
| hasUVs | back to summary |
|---|---|
| pack-priv boolean hasUVs | |
| mat | back to summary |
|---|---|
| pack-priv Material mat | |
| materialName | back to summary |
|---|---|
| pack-priv String materialName | |
| name | back to summary |
|---|---|
| pack-priv final String name | |
| numFaces | back to summary |
|---|---|
| pack-priv int numFaces | |
| Group | back to summary |
|---|---|
| pack-priv Group(String name) | |
| Modifier and Type | Field and Description |
|---|---|
| public boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| flipV | back to summary |
|---|---|
| public boolean flipV | |
| ObjLoaderParameters | back to summary |
|---|---|
| public ObjLoaderParameters() | |
| ObjLoaderParameters | back to summary |
|---|---|
| public ObjLoaderParameters(boolean flipV) | |