-
-
Notifications
You must be signed in to change notification settings - Fork 0
A library for the Wavefront OBJ/MTL file format
License
Shirakumo/cl-wavefront
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# About cl-wavefront This library implements the Wavefront OBJ 3D model format. ## How To Load the library, and parse a file: :: common lisp (org.shirakumo.fraf.wavefront:parse #p"my-file.obj") :: It'll return a ``context`` which holds the ``vertices``, ``uvs``, ``normals``, ``materials``, ``groups``, and ``objects`` defined by the file. You can parse either ``obj`` or ``mtl`` files. If the ``obj`` references an ``mtl`` file, it is automatically parsed as well. The format defines mesh data rather loosely, allowing different materials per face, different face referencing mechanisms, varying indices per vertex attributes, and so on, which makes it rather hard to directly use for rendering. To convert an entire file, specific object, or specific face group, you can call ``extract-meshes``. This will instead return a list of ``mesh`` instances, which have the ``vertex-data`` normalised and packed into a single vector, and deduplicated indices into an ``index-data`` vector. Each mesh also has only a single ``material``, vertex ``attributes`` set, and ``face-length``, which should simplify rendering a lot. Note that meshes still do not guarantee triangular meshes. If the source data contains quads or other polygons, you must tessellate the mesh yourself. You can also serialize a ``context`` or ``mesh`` back out: :: common lisp (org.shirakumo.fraf.wavefront:serialize context/mesh #p"my-file.obj") :: You can also choose whether to export the material library file. By default it'll create a file with the same name and the extension ``.mtl`` if any materials are used in the context. ## To Do This library currently only supports polygonal meshes. Other features such as points, curves, surfaces, and more are not included, but should be easy to add into the existing parser framework if needed.
About
A library for the Wavefront OBJ/MTL file format
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published