Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/parse-obj
Parses a .OBJ file
https://github.com/mikolalysenko/parse-obj
Last synced: about 2 months ago
JSON representation
Parses a .OBJ file
- Host: GitHub
- URL: https://github.com/mikolalysenko/parse-obj
- Owner: mikolalysenko
- License: mit
- Created: 2013-10-18T04:38:56.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-12-01T01:14:44.000Z (about 2 years ago)
- Last Synced: 2024-10-20T14:28:20.011Z (2 months ago)
- Language: JavaScript
- Size: 123 KB
- Stars: 23
- Watchers: 3
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
parse-obj
=========
A simple parser for .OBJ mesh files.## Example
```javascript
var fs = require("fs")
var parseOBJ = require("parse-obj")parseOBJ(fs.createReadStream("mesh.obj"), function(err, result) {
if(err) {
throw new Error("Error parsing OBJ file: " + err)
}
console.log("Got mesh: ", result)
})
```### `require("parse-obj")(stream, cb(err, result))`
Parses a read stream into a .OBJ format mesh* `stream` is a read stream
* `cb` is a callback that gets executed once the stream is parsed. The `result` object is a structure with the following data:+ `vertexPositions` an array of vertex position data
+ `vertexNormals` an array of vertex normal data
+ `vertexUVs` an array of vertex UV coordinates
+ `facePositions` an array of indices for face positions
+ `faceNormals` an array of indices for face normals
+ `faceUVs` an array of indices for face texture coordinates## Credits
(c) 2013 Mikola Lysenko. MIT License