vendor/GLTFExporter.js
function processNode(object) {
      if (object.isLight) {
        console.warn(
          'GLTFExporter: Unsupported node type:',
          object.constructor.name
        );
        return null;
      }

      if (!outputJSON.nodes) {
        outputJSON.nodes = [];
      }

      var gltfNode = {};

      if (options.trs) {
        var rotation = object.quaternion.toArray();
        var position = object.position.toArray();
        var scale = object.scale.toArray();

        if (!equalArray(rotation, [0, 0, 0, 1])) {
          gltfNode.rotation = rotation;
        }

        if (!equalArray(position, [0, 0, 0])) {
          gltfNode.translation = position;
        }

        if (!equalArray(scale, [1, 1, 1])) {
          gltfNode.scale = scale;
        }
      } else {
        object.updateMatrix();
        if (
          !equalArray(object.matrix.elements, [
            1,
            0,
            0,
            0,
            0,
            1,
            0,
            0,
            0,
            0,
            1,
            0,
            0,
            0,
            0,
            1
          ])
        ) {
          gltfNode.matrix = object.matrix.elements;
        }
      }

      // We don't export empty strings name because it represents no-name in Three.js.
      if (object.name !== '') {
        gltfNode.name = String(object.name);
      }

      if (object.userData && Object.keys(object.userData).length > 0) {
        gltfNode.extras = serializeUserData(object);
      }

      if (object.isMesh || object.isLine || object.isPoints) {
        var mesh = processMesh(object);

        if (mesh !== null) {
          gltfNode.mesh = mesh;
        }
      } else if (object.isCamera) {
        gltfNode.camera = processCamera(object);
      }

      if (object.isSkinnedMesh) {
        skins.push(object);
      }

      if (object.children.length > 0) {
        var children = [];

        for (var i = 0, l = object.children.length; i < l; i++) {
          var child = object.children[i];

          if (child.visible || options.onlyVisible === false) {
            var node = processNode(child);

            if (node !== null) {
              children.push(node);
            }
          }
        }

        if (children.length > 0) {
          gltfNode.children = children;
        }
      }

      outputJSON.nodes.push(gltfNode);

      var nodeIndex = outputJSON.nodes.length - 1;
      nodeMap.set(object, nodeIndex);

      return nodeIndex;
    }
function processNode(object) {
      if (object.isLight) {
        console.warn(
          'GLTFExporter: Unsupported node type:',
          object.constructor.name
        );
        return null;
      }

      if (!outputJSON.nodes) {
        outputJSON.nodes = [];
      }

      var gltfNode = {};

      if (options.trs) {
        var rotation = object.quaternion.toArray();
        var position = object.position.toArray();
        var scale = object.scale.toArray();

        if (!equalArray(rotation, [0, 0, 0, 1])) {
          gltfNode.rotation = rotation;
        }

        if (!equalArray(position, [0, 0, 0])) {
          gltfNode.translation = position;
        }

        if (!equalArray(scale, [1, 1, 1])) {
          gltfNode.scale = scale;
        }
      } else {
        object.updateMatrix();
        if (
          !equalArray(object.matrix.elements, [
            1,
            0,
            0,
            0,
            0,
            1,
            0,
            0,
            0,
            0,
            1,
            0,
            0,
            0,
            0,
            1
          ])
        ) {
          gltfNode.matrix = object.matrix.elements;
        }
      }

      // We don't export empty strings name because it represents no-name in Three.js.
      if (object.name !== '') {
        gltfNode.name = String(object.name);
      }

      if (object.userData && Object.keys(object.userData).length > 0) {
        gltfNode.extras = serializeUserData(object);
      }

      if (object.isMesh || object.isLine || object.isPoints) {
        var mesh = processMesh(object);

        if (mesh !== null) {
          gltfNode.mesh = mesh;
        }
      } else if (object.isCamera) {
        gltfNode.camera = processCamera(object);
      }

      if (object.isSkinnedMesh) {
        skins.push(object);
      }

      if (object.children.length > 0) {
        var children = [];

        for (var i = 0, l = object.children.length; i < l; i++) {
          var child = object.children[i];

          if (child.visible || options.onlyVisible === false) {
            var node = processNode(child);

            if (node !== null) {
              children.push(node);
            }
          }
        }

        if (children.length > 0) {
          gltfNode.children = children;
        }
      }

      outputJSON.nodes.push(gltfNode);

      var nodeIndex = outputJSON.nodes.length - 1;
      nodeMap.set(object, nodeIndex);

      return nodeIndex;
    }
function processNode ( object ) { if ( object . isLight ) { console . warn ( 'GLTFExporter: Unsupported node type:' , object . constructor . name ) ; return null ; } if ( ! outputJSON . nodes ) { outputJSON . nodes = [ ] ; } var gltfNode = { } ; if ( options . trs ) { var rotation = object . quaternion . toArray ( ) ; var position = object . position . toArray ( ) ; var scale = object . scale . toArray ( ) ; if ( ! equalArray ( rotation , [ 0 , 0 , 0 , 1 ] ) ) { gltfNode . rotation = rotation ; } if ( ! equalArray ( position , [ 0 , 0 , 0 ] ) ) { gltfNode . translation = position ; } if ( ! equalArray ( scale , [ 1 , 1 , 1 ] ) ) { gltfNode . scale = scale ; } } else { object . updateMatrix ( ) ; if ( ! equalArray ( object . matrix . elements , [ 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ] ) ) { gltfNode . matrix = object . matrix . elements ; } } // We don't export empty strings name because it represents no-name in Three.js. if ( object . name !== '' ) { gltfNode . name = String ( object . name ) ; } if ( object . userData && Object . keys ( object . userData ) . length > 0 ) { gltfNode . extras = serializeUserData ( object ) ; } if ( object . isMesh || object . isLine || object . isPoints ) { var mesh = processMesh ( object ) ; if ( mesh !== null ) { gltfNode . mesh = mesh ; } } else if ( object . isCamera ) { gltfNode . camera = processCamera ( object ) ; } if ( object . isSkinnedMesh ) { skins . push ( object ) ; } if ( object . children . length > 0 ) { var children = [ ] ; for ( var i = 0 , l = object . children . length ; i < l ; i ++ ) { var child = object . children [ i ] ; if ( child . visible || options . onlyVisible === false ) { var node = processNode ( child ) ; if ( node !== null ) { children . push ( node ) ; } } } if ( children . length > 0 ) { gltfNode . children = children ; } } outputJSON . nodes . push ( gltfNode ) ; var nodeIndex = outputJSON . nodes . length - 1 ; nodeMap . set ( object , nodeIndex ) ; return nodeIndex ; }
Process Object3D node
@param  {THREE.Object3D} node Object3D to processNode
@return {Integer}      Index of the node in the nodes list
Process Object3D node