提交 54b6db53 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #12037 from fernandojsg/nodes

GLTFExporter: fix nodes filter
...@@ -756,6 +756,13 @@ THREE.GLTFExporter.prototype = { ...@@ -756,6 +756,13 @@ THREE.GLTFExporter.prototype = {
*/ */
function processNode ( object ) { function processNode ( object ) {
if ( object instanceof THREE.Light ) {
console.warn( 'GLTFExporter: Unsupported node type:', object.constructor.name );
return false;
}
if ( !outputJSON.nodes ) { if ( !outputJSON.nodes ) {
outputJSON.nodes = []; outputJSON.nodes = [];
...@@ -841,13 +848,11 @@ THREE.GLTFExporter.prototype = { ...@@ -841,13 +848,11 @@ THREE.GLTFExporter.prototype = {
if ( child.visible || options.onlyVisible === false ) { if ( child.visible || options.onlyVisible === false ) {
if ( child instanceof THREE.Mesh || var node = processNode( child );
child instanceof THREE.Camera ||
child instanceof THREE.Group || if ( node !== false ) {
child instanceof THREE.Line ||
child instanceof THREE.Points) {
children.push( processNode( child ) ); children.push( node );
} }
...@@ -905,14 +910,11 @@ THREE.GLTFExporter.prototype = { ...@@ -905,14 +910,11 @@ THREE.GLTFExporter.prototype = {
if ( child.visible || options.onlyVisible === false ) { if ( child.visible || options.onlyVisible === false ) {
// @TODO We don't process lights yet var node = processNode( child );
if ( child instanceof THREE.Mesh ||
child instanceof THREE.Camera || if ( node !== false ) {
child instanceof THREE.Group ||
child instanceof THREE.Line ||
child instanceof THREE.Points) {
nodes.push( processNode( child ) ); nodes.push( node );
} }
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
var container; var container;
var camera, scene1, scene2, renderer; var camera, object, scene1, scene2, renderer;
var gridHelper, sphere; var gridHelper, sphere;
init(); init();
...@@ -141,13 +141,16 @@ ...@@ -141,13 +141,16 @@
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Ambient light // Ambient light
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
scene1.add( new THREE.AmbientLight( 0xffffff, 0.2 ) ); var light = new THREE.AmbientLight( 0xffffff, 0.2 );
light.name = 'AmbientLight';
scene1.add( light );
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// DirectLight // DirectLight
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
var light = new THREE.DirectionalLight( 0xffffff, 1 ); light = new THREE.DirectionalLight( 0xffffff, 1 );
light.position.set( 1, 1, 0 ); light.position.set( 1, 1, 0 );
light.name = 'DirectionalLight';
scene1.add( light ); scene1.add( light );
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册