Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vssekorin/parser-obj
Wavefront 3D object file (.obj) parser
https://github.com/vssekorin/parser-obj
clojure jvm wavefront-obj
Last synced: about 1 month ago
JSON representation
Wavefront 3D object file (.obj) parser
- Host: GitHub
- URL: https://github.com/vssekorin/parser-obj
- Owner: vssekorin
- Created: 2018-09-08T10:47:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-18T08:37:25.000Z (about 6 years ago)
- Last Synced: 2024-12-15T22:49:51.985Z (about 1 month ago)
- Topics: clojure, jvm, wavefront-obj
- Language: Clojure
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# parser-obj
[![Clojars Project](https://img.shields.io/clojars/v/com.vssekorin/parser-obj.svg)](https://clojars.org/com.vssekorin/parser-obj)
Just one function: `parse`.
`(parse "model.obj")`
### Example
File:
```text
v -0.000581696 -0.734665 -0.623267
v 0.000283538 -1 0.286843
v -0.117277 -0.973564 0.306907vt 0.532 0.923 0.000
vt 0.535 0.917 0.000
vt 0.542 0.923 0.000
vt 0.541 0.929 0.000# comment
vn 0.001 0.482 -0.876
vn -0.001 0.661 0.751f 24/1/24 25/2/25 26/3/26
f 24/1/24 26/3/26 23/4/23
f 28/5/28 29/6/29 30/7/30
f 28/5/28 30/7/30 27/8/27
f 32/9/32 33/10/33 34/11/34
f 32/9/32 34/11/34 31/12/31
```Result:
```clojure
{:v [{:x -5.81696E-4, :y -0.734665, :z -0.623267}
{:x 2.83538E-4, :y -1.0, :z 0.286843}
{:x -0.117277, :y -0.973564, :z 0.306907}],
:f [({:v 24, :vt 1, :vn 24} {:v 25, :vt 2, :vn 25} {:v 26, :vt 3, :vn 26})
({:v 24, :vt 1, :vn 24} {:v 26, :vt 3, :vn 26} {:v 23, :vt 4, :vn 23})
({:v 28, :vt 5, :vn 28} {:v 29, :vt 6, :vn 29} {:v 30, :vt 7, :vn 30})
({:v 28, :vt 5, :vn 28} {:v 30, :vt 7, :vn 30} {:v 27, :vt 8, :vn 27})
({:v 32, :vt 9, :vn 32} {:v 33, :vt 10, :vn 33} {:v 34, :vt 11, :vn 34})
({:v 32, :vt 9, :vn 32} {:v 34, :vt 11, :vn 34} {:v 31, :vt 12, :vn 31})],
:vt [{:u 0.532, :v 0.923, :w 0.0}
{:u 0.535, :v 0.917, :w 0.0}
{:u 0.542, :v 0.923, :w 0.0}
{:u 0.541, :v 0.929, :w 0.0}],
:vn [{:x 0.001, :y 0.482, :z -0.876}
{:x -0.001, :y 0.661, :z 0.751}],
:vp []}
```