A Java library for reading MDL model files. This library provides an immutable object model for working with MDL files, making it easy to load and access 3D model data including geometry, textures, animations, and transformations.
Note: the library depends on the bin-processor library for low-level binary file reading.
The library supports files with:
- File identifier: IDPO
- Version: 6
- Little-endian byte order
try (InputStream input = new FileInputStream("model.mdl")) {
MdlModel model = new MdlModel(input);
// Work with the model...
}
// Get basic model properties
MdlVector scale = model.getScale();
MdlVector translation = model.getTranslation();
float boundingRadius = model.getBoundingRadius();
// Access geometry
MdlTriangle[] triangles = model.getTriangles();
MdlVertex[] vertices = model.getFrameGroups()[0].getFrames()[0].getVertices();
// Work with textures
MdlTextureGroup[] textureGroups = model.getTextureGroups();
MdlTextureCoord[] textureCoords = model.getTextureCoords();
// Access animations
MdlFrameGroup[] frameGroups = model.getFrameGroups();
MdlModel
: root class representing the complete model fileMdlFrame
: single frame of animation with vertex dataMdlFrameGroup
: collection of animation frames with timingMdlTexture
: individual texture with indexed color dataMdlTextureGroup
: collection of textures with animation timingMdlTextureCoord
: UV coordinates for texture mappingMdlTriangle
: three vertex indices forming a triangle faceMdlVertex
: 3D vertex with position and normal indexMdlVector
: 3D vector for transforms and coordinatesMdlNormals
: static collection of predefined normal vectors from Quake I
IOException
for I/O errorsIllegalArgumentException
for unsupported file versions or identifiers
This project is licensed under the MIT License - see the LICENSE file for details.