Parses a .OBJ file
JavaScript
Switch branches/tags
Nothing to show
Latest commit c08ac7a Oct 18, 2013
Permalink
Failed to load latest commit information.
.gitignore adding files Oct 18, 2013
LICENSE adding files Oct 18, 2013
README.md adding files Oct 18, 2013
package.json adding package.json Oct 18, 2013
parse-obj.js adding files Oct 18, 2013

README.md

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 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