Just one function: parse
.
(parse "model.obj")
File:
v -0.000581696 -0.734665 -0.623267
v 0.000283538 -1 0.286843
v -0.117277 -0.973564 0.306907
vt 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.751
f 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:
{: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 []}
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close