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

Parse collada .dae file vertex positions, textures, normals and animations
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-parserMaking 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 demoCLI
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.jsonAPI
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
- waZim. (2010) "Step by Step Skeletal Animation in C++ and OpenGL, Using COLLADA Part 1 & Part 2"
- Heavily informed the initial parser
- Markus Ruh. (2012) Vertex Skinning
- Heavily informed the vertex skinning in the initial demo vertex shader
- Jerimiah van Oosten. (2011) "GPU Skinning of MD5 Models in OpenGL and Cg"
- Heavily informed the vertex skinning in the initial demo vertex shader
See Also
License
MIT