Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thibauts/parse-wavefront-obj
Wavefront OBJ parser
https://github.com/thibauts/parse-wavefront-obj
Last synced: 2 months ago
JSON representation
Wavefront OBJ parser
- Host: GitHub
- URL: https://github.com/thibauts/parse-wavefront-obj
- Owner: thibauts
- License: mit
- Created: 2015-05-08T12:55:22.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-22T19:04:53.000Z (almost 9 years ago)
- Last Synced: 2024-09-19T04:48:22.711Z (3 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 18
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
parse-wavefront-obj
===================
### Wavefront OBJ parserParses a [Wavefront OBJ](http://en.wikipedia.org/wiki/Wavefront_.obj_file) string or buffer. If you're looking for a stream parser check [this](https://github.com/mikolalysenko/parse-obj).
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
-------```bash
$ npm install parse-wavefront-obj
```Usage
-----```javascript
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 filevertexUVs: [...], // array of UV coordinates
faceUVs: [...], // array of UV indices
vertexNormals: [...], // array of vertex normals
faceNormals: [...], // array of normal indices
name: 'foo' // mesh name
}
*/
```