0.1.3 • Published 8 years ago

objparse v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

objParse

Node Wavefront OBJ parsing for multi-object files

Example Usage

fs          = require('fs'),
parseObj    = require('parseObj');

parseObj(fs.createReadStream('myObject.obj'), function(err, res) {
    if(err) throw new Error("Error parsing OBJ file: " + err)
    else
    {
      console.log(res.length + ' objects in file');
      for(var i=0; i<res.length; i++)
      {
        console.log('Obj ' + (i+1) + ', vertex 1: ' + res[i].v[0]);
      }
    }
});

Data

Pass in a read stream, on finish event, callback is returned with an object array. Each object in the object array has an array of:

  • v vertex positions
  • vn vertex normals
  • vt vertex UVs
  • f face position indices
  • fn face normal indices
  • ft face texture coordinate indices obj[n].v[m] will get the mth vertex of the nth object as a vector of x, y, and z coordinates.
0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago