@jpweeks/parse-obj
v0.1.0
Published
Parses .OBJ formatted meshes
Downloads
1
Readme
parse-obj
A simple parser for .OBJ mesh files.
Example
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 streamcb
is a callback that gets executed once the stream is parsed. Theresult
object is a structure with the following data:vertexPositions
an array of vertex position datavertexNormals
an array of vertex normal datavertexUVs
an array of vertex UV coordinatesfacePositions
an array of indices for face positionsfaceNormals
an array of indices for face normalsfaceUVs
an array of indices for face texture coordinateslinePositions
an array of indices for line positions
Credits
(c) 2013 Mikola Lysenko. MIT License