Skip to content

AntonOnyshch/obj-parser

Repository files navigation

3d-files-parser

Parser for OBJ files. This parser is not completed. I'v written this for my own purpose.

Table of Contents

Basic structure

OBJ structure

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)

How to reproduce?

  1. Clone or download repo
  2. Execute this line in terminal: node ./startNode.js to start Node server
  3. 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.

Tests

Chekout package.json for additional information.

Parser

npm run test:parser

How it works?

OBJ parser

About

Parser for OBJ files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published