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

Merge pull request #12037 from fernandojsg/nodes

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