JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 465
  • Score
    100M100P100Q119440F
  • License MIT

Parse collada .dae 3d animation files into json

Package Exports

  • collada-dae-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (collada-dae-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

collada-dae-parser npm version Build Status

Parse collada .dae file vertex positions, textures, normals and animations

View live animated model

View demo source

Notice

This package is still a work in progress (hence no major bump)

I won't need skeletal animations until around September. Commits will be few and far between until then.

But.. I'm still around. If you have a question, ideas or use cases that aren't covered open an issue!

What does it do?

collada-dae-parser parses a collada file and outputs JSON. This is useful for displaying skeletal animations in the browser.

collada-dae-parser is only concerned with giving you JSON. An animation system is outside of this modules scope.

To Install

# API
$ npm install --save collada-dae-parser
# CLI
$ npm install -g collada-dae-parser

Making use of the parser

If you're unfamiliar with skeletal animation, the demo is a good starting point. Here's where we're parsing our collada file and buffering our graphics data. We're parsing at runtime in the demo, but in a real application you'd want to parse your collada files during a build step.

# Run the demo locally. Changes to the `demo` directory will live reload in your browser
# PRs and issues are welcome!
git clone https://github.com/chinedufn/collada-dae-parser && cd collada-dae-parser && npm install && npm run demo

CLI

Output stringified JSON to stdout

# parse from stdin
cat my-3d-model.dae | dae2json > parsed-model.json

# parse from file
dae2json my-3d-modal.dae > parsed-model.json

API

parseDae(xmlFile, callback) -> object

xmlFile

Required

Type: string or Buffer

Your collada file data. Not the filename, the file contents.

callback

Required

Type: function

function (err, parsedDaeObject) {
  console.log(parsedDaeObject)
  /*
  {
    keyframes: {...},
    vertexNormalIndices: [...],
    vertexNormals: [...],
    vertexPositionIndices: [...],
    vertexPositions: [...],
    vertexUVIndices: [...],
    vertexUVs: [...]
  }
  */
}

TODO:

  • src: basic cli (potentially pull into own repo, but start here)

  • src: Allow file buffer to be passed in

  • src: Factor in bind shape matrix

  • src: Stop exporting bind shape matrix

  • demo: fix normals in demo lighting

  • src / demo: add a textured demo model

  • src: rounding values. Currently lots of .999999 and 1.000001

  • src: All of the TODO: statements in code

  • demo: full screen demo with controls overlay

  • demo: toggle between 2 animations

  • demo: Support mobile touch events

  • demo: allow zoom in, zoom out in demo

  • doc: Add a GIF of every test fixture animation and demo

  • doc: Documentation

  • A separate package that uses collada-dae-parser to implement a stateless skeletal animation system

References

See Also

License

MIT