Skip to content

Commit

Permalink
Editor: Added vox files support.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Dec 24, 2020
1 parent b6f343b commit 6e0c0b0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions editor/js/Loader.js
Expand Up @@ -520,6 +520,35 @@ function Loader( editor ) {

break;

case 'vox':

reader.addEventListener( 'load', async function ( event ) {

var contents = event.target.result;

var { VOXLoader, VOXMesh } = await import( '../../examples/jsm/loaders/VOXLoader.js' );

var chunks = new VOXLoader().parse( contents );

var group = new THREE.Group();
group.name = filename;

for ( let i = 0; i < chunks.length; i ++ ) {

const chunk = chunks[ i ];

const mesh = new VOXMesh( chunk );
group.add( mesh );

}

editor.execute( new AddObjectCommand( editor, group ) );

}, false );
reader.readAsArrayBuffer( file );

break;

case 'vtk':

reader.addEventListener( 'load', async function ( event ) {
Expand Down

0 comments on commit 6e0c0b0

Please sign in to comment.