parse-wavefront-obj
Wavefront OBJ parser
Last updated 5 years ago by thibauts .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install parse-wavefront-obj 
SYNC missed versions from official npm registry.

parse-wavefront-obj

Wavefront OBJ parser

Parses a Wavefront OBJ string or buffer. If you're looking for a stream parser check this.

Supports vertex normals and UV coordinates. Doesn't support material libraries (though I'm open to PRs), nor multiple meshes embedded in the same file.

Install

$ npm install parse-wavefront-obj

Usage

var parseOBJ = require('parse-wavefront-obj');
var fs = require('fs');

var buf = fs.readFileSync('mesh.obj');
var mesh = parseOBJ(buf);

console.log(mesh);
/*
{
  positions: [...],
  cells: [...],

  // The following attributes are available when defined 
  // in the original file

  vertexUVs: [...],     // array of UV coordinates
  faceUVs: [...],       // array of UV indices
  vertexNormals: [...], // array of vertex normals
  faceNormals: [...],   // array of normal indices
  name: 'foo'           // mesh name
}
*/

Current Tags

  • 1.0.3                                ...           latest (5 years ago)

4 Versions

  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 7
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |