Parser for OBJ files. This parser is not completed. I'v written this for my own purpose.
NB You can find and read full specification by Paul Bourke
The following types of data may be included in an .obj file. In this
list, the keyword (in parentheses) follows the data type.
Vertex data
o geometric vertices (v)
o texture vertices (vt)
o vertex normals (vn)
o parameter space vertices (vp)
Free-form curve/surface attributes
o rational or non-rational forms of curve or surface type:
basis matrix, Bezier, B-spline, Cardinal, Taylor (cstype)
o degree (deg)
o basis matrix (bmat)
o step size (step)
Elements
o point (p)
o line (l)
o face (f)
o curve (curv)
o 2D curve (curv2)
o surface (surf)
Free-form curve/surface body statements
o parameter values (parm)
o outer trimming loop (trim)
o inner trimming loop (hole)
o special curve (scrv)
o special point (sp)
o end statement (end)
Connectivity between free-form surfaces
o connect (con)
Grouping
o group name (g)
o smoothing group (s)
o merging group (mg)
o object name (o)
Display/render attributes
o bevel interpolation (bevel)
o color interpolation (c_interp)
o dissolve interpolation (d_interp)
o level of detail (lod)
o material name (usemtl)
o material library (mtllib)
o shadow casting (shadow_obj)
o ray tracing (trace_obj)
o curve approximation technique (ctech)
o surface approximation technique (stech)
- Clone or download repo
- Execute this line in terminal: node ./startNode.js to start Node server
- Put it in the browser line: http://localhost:3001/examples/obj/index.html NB! after /examples/ you can write obj or stl. All examples are placed in examples folder.
Chekout package.json for additional information.
npm run test:parser