未验证 提交 fcff7a4c 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15740 from linbingquan/clean-up

GLTFEXporter: Clean up
......@@ -1078,7 +1078,7 @@ THREE.GLTFExporter.prototype = {
} else {
if ( ! geometry.isBufferGeometry ) {
console.warn( 'GLTFExporter: Exporting THREE.Geometry will increase file size. Use THREE.BufferGeometry instead.' );
var geometryTemp = new THREE.BufferGeometry();
......
......@@ -491,8 +491,8 @@ THREE.LegacyGLTFLoader = ( function () {
};
var WEBGL_SIDES = {
1028: THREE.BackSide, // Culling front
1029: THREE.FrontSide // Culling back
1028: THREE.BackSide, // Culling front
1029: THREE.FrontSide // Culling back
//1032: THREE.NoSide // Culling front and back, what to do?
};
......@@ -566,8 +566,10 @@ THREE.LegacyGLTFLoader = ( function () {
function _each( object, callback, thisObj ) {
if ( !object ) {
if ( ! object ) {
return Promise.resolve();
}
var results;
......@@ -589,11 +591,11 @@ THREE.LegacyGLTFLoader = ( function () {
if ( value instanceof Promise ) {
value.then( function( key, value ) {
value.then( function ( key, value ) {
results[ key ] = value;
}.bind( this, idx ));
}.bind( this, idx ) );
} else {
......@@ -621,11 +623,11 @@ THREE.LegacyGLTFLoader = ( function () {
if ( value instanceof Promise ) {
value.then( function( key, value ) {
value.then( function ( key, value ) {
results[ key ] = value;
}.bind( this, key ));
}.bind( this, key ) );
} else {
......@@ -641,11 +643,11 @@ THREE.LegacyGLTFLoader = ( function () {
}
return Promise.all( fns ).then( function() {
return Promise.all( fns ).then( function () {
return results;
});
} );
}
......@@ -1210,7 +1212,7 @@ THREE.LegacyGLTFLoader = ( function () {
}
keys.forEach( function( v ) {
keys.forEach( function ( v ) {
if ( khr_material.values[ v ] !== undefined ) materialValues[ v ] = khr_material.values[ v ];
......@@ -1515,7 +1517,7 @@ THREE.LegacyGLTFLoader = ( function () {
materialParams.color = new THREE.Color().fromArray( materialValues.diffuse );
} else if ( typeof( materialValues.diffuse ) === 'string' ) {
} else if ( typeof ( materialValues.diffuse ) === 'string' ) {
materialParams.map = dependencies.textures[ materialValues.diffuse ];
......@@ -1523,13 +1525,13 @@ THREE.LegacyGLTFLoader = ( function () {
delete materialParams.diffuse;
if ( typeof( materialValues.reflective ) === 'string' ) {
if ( typeof ( materialValues.reflective ) === 'string' ) {
materialParams.envMap = dependencies.textures[ materialValues.reflective ];
}
if ( typeof( materialValues.bump ) === 'string' ) {
if ( typeof ( materialValues.bump ) === 'string' ) {
materialParams.bumpMap = dependencies.textures[ materialValues.bump ];
......@@ -1547,7 +1549,7 @@ THREE.LegacyGLTFLoader = ( function () {
}
} else if ( typeof( materialValues.emission ) === 'string' ) {
} else if ( typeof ( materialValues.emission ) === 'string' ) {
if ( materialType === THREE.MeshBasicMaterial ) {
......@@ -1565,7 +1567,7 @@ THREE.LegacyGLTFLoader = ( function () {
materialParams.specular = new THREE.Color().fromArray( materialValues.specular );
} else if ( typeof( materialValues.specular ) === 'string' ) {
} else if ( typeof ( materialValues.specular ) === 'string' ) {
materialParams.specularMap = dependencies.textures[ materialValues.specular ];
......@@ -1670,9 +1672,9 @@ THREE.LegacyGLTFLoader = ( function () {
var parameters = json.techniques[ material.technique ].parameters || {};
for( var attributeName in parameters ) {
for ( var attributeName in parameters ) {
if ( parameters [ attributeName ][ 'semantic' ] === attributeId ) {
if ( parameters[ attributeName ][ 'semantic' ] === attributeId ) {
geometry.addAttribute( attributeName, bufferAttribute );
......@@ -2217,8 +2219,10 @@ THREE.LegacyGLTFLoader = ( function () {
if ( child.material && child.material.isRawShaderMaterial ) {
child.gltfShader = new GLTFShader( child, dependencies.nodes );
child.onBeforeRender = function(renderer, scene, camera){
this.gltfShader.update(scene, camera);
child.onBeforeRender = function ( renderer, scene, camera ) {
this.gltfShader.update( scene, camera );
};
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册