0.0.0 • Published 12 years ago
parse-obj v0.0.0
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
streamis a read streamcbis a callback that gets executed once the stream is parsed. Theresultobject is a structure with the following data:vertexPositionsan array of vertex position datavertexNormalsan array of vertex normal datavertexUVsan array of vertex UV coordinatesfacePositionsan array of indices for face positionsfaceNormalsan array of indices for face normalsfaceUVsan array of indices for face texture coordinates
Credits
(c) 2013 Mikola Lysenko. MIT License
0.0.0
12 years ago