Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vox-to-gltf

florianfe11MITdeprecated0.6.2

it's not so useful to have a library for that which only works in the web browser

converts .vox files which can be exported in MagickaVoxel to [.gltf](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0

voxel, magickavoxel, vox, gltf, model, conversion

readme

vox-to-gltf.js

converts .vox files which can be exported in MagickaVoxel to .gltf files. It is using three.js, vox-reader.js and voxel-triangulation.js.

💾 Installation

npm install --save vox-to-gltf

🚀 Usage

To include it in your project while using a bundling system like webpack use

const voxToGLTF = require('vox-to-gltf');

otherwise use

const voxToGLTF = require('vox-to-gltf/dist/vox-to-gltf.min.js');

To read a .vox file and make a .gltf file out of it you can do something like this

const fs = require('fs');
const voxToGLTF = require('vox-to-gltf');

fs.readFile('my-voxel-art.vox', (error, buffer) =>
{
  if(error) throw error;

  let gltfData = voxToGLTF(buffer);

  fs.writeFile('my-voxel-art.gltf', gltfData, (error) => 
  {
    if(error) throw err;

    console.log('The file has been saved!');
  });
});

📖 License

(c) 2019 Florian Fechner. MIT License