Skip to content

Commit

Permalink
Merge pull request #15657 from Mugen87/dev26
Browse files Browse the repository at this point in the history
Examples: Clean up
  • Loading branch information
mrdoob committed Jan 28, 2019
2 parents bc0c566 + 162c986 commit e3bc361
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
15 changes: 10 additions & 5 deletions examples/js/exporters/ColladaExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,20 +413,20 @@ THREE.ColladaExporter.prototype = {

(
type !== 'constant' ?
'<diffuse>' +
'<diffuse>' +

(
m.map ?
'<texture texture="diffuse-sampler" texcoord="TEXCOORD" />' :
`<color sid="diffuse">${ diffuse.r } ${ diffuse.g } ${ diffuse.b } 1</color>`
) +
'</diffuse>'
: ''
: ''
) +

(
type === 'phong' ?
`<specular><color sid="specular">${ specular.r } ${ specular.g } ${ specular.b } 1</color></specular>` +
`<specular><color sid="specular">${ specular.r } ${ specular.g } ${ specular.b } 1</color></specular>` +

'<shininess>' +

Expand All @@ -437,7 +437,7 @@ THREE.ColladaExporter.prototype = {
) +

'</shininess>'
: ''
: ''
) +

`<reflective><color>${ diffuse.r } ${ diffuse.g } ${ diffuse.b } 1</color></reflective>` +
Expand Down Expand Up @@ -525,10 +525,15 @@ THREE.ColladaExporter.prototype = {
// the materials.
var mat = o.material || new THREE.MeshBasicMaterial();
var materials = Array.isArray( mat ) ? mat : [ mat ];

if ( geometry.groups.length > materials.length ) {

matidsArray = new Array( geometry.groups.length );

} else {
matidsArray = new Array( materials.length )

matidsArray = new Array( materials.length );

}
matids = matidsArray.fill()
.map( ( v, i ) => processMaterial( materials[ i % materials.length ] ) );
Expand Down
8 changes: 4 additions & 4 deletions examples/js/exporters/GLTFExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ THREE.GLTFExporter.prototype = {
*/
function applyTextureTransform( mapDef, texture ) {

var didTransform = false
var didTransform = false;
var transformDef = {};

if ( texture.offset.x !== 0 || texture.offset.y !== 0 ) {
Expand Down Expand Up @@ -981,7 +981,7 @@ THREE.GLTFExporter.prototype = {
// occlusionTexture
if ( material.aoMap ) {

var occlusionMapDef = {
var occlusionMapDef = {
index: processTexture( material.aoMap ),
texCoord: 1
};
Expand Down Expand Up @@ -1611,7 +1611,7 @@ THREE.GLTFExporter.prototype = {
lightDef.type = 'spot';
if ( light.distance > 0 ) lightDef.range = light.distance;
lightDef.spot = {};
lightDef.spot.innerConeAngle = ( light.penumbra - 1.0 ) * light.angle * -1.0;
lightDef.spot.innerConeAngle = ( light.penumbra - 1.0 ) * light.angle * - 1.0;
lightDef.spot.outerConeAngle = light.angle;

}
Expand All @@ -1627,7 +1627,7 @@ THREE.GLTFExporter.prototype = {
&& ( light.target.parent !== light
|| light.target.position.x !== 0
|| light.target.position.y !== 0
|| light.target.position.z !== -1 ) ) {
|| light.target.position.z !== - 1 ) ) {

console.warn( 'THREE.GLTFExporter: Light direction may be lost. For best results, '
+ 'make light.target a child of the light with position 0,0,-1.' );
Expand Down
2 changes: 1 addition & 1 deletion examples/js/loaders/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2825,7 +2825,7 @@ THREE.ColladaLoader.prototype = {
break;

case 'mass':
data.mass = parseFloats( child.textContent )[0];
data.mass = parseFloats( child.textContent )[ 0 ];
break;

}
Expand Down
9 changes: 5 additions & 4 deletions examples/js/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ THREE.GLTFLoader = ( function () {

case 'directional':
lightNode = new THREE.DirectionalLight( color );
lightNode.target.position.set( 0, 0, -1 );
lightNode.target.position.set( 0, 0, - 1 );
lightNode.add( lightNode.target );
break;

Expand All @@ -356,7 +356,7 @@ THREE.GLTFLoader = ( function () {
lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
lightNode.angle = lightDef.spot.outerConeAngle;
lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
lightNode.target.position.set( 0, 0, -1 );
lightNode.target.position.set( 0, 0, - 1 );
lightNode.add( lightNode.target );
break;

Expand Down Expand Up @@ -968,6 +968,7 @@ THREE.GLTFLoader = ( function () {
uniforms.refractionRatio.value = material.refractionRatio;

uniforms.maxMipLevel.value = renderer.properties.get( material.envMap ).__maxMipLevel;

}

uniforms.specular.value.copy( material.specular );
Expand Down Expand Up @@ -1852,7 +1853,7 @@ THREE.GLTFLoader = ( function () {

case 'light':
dependency = this.extensions[ EXTENSIONS.KHR_LIGHTS_PUNCTUAL ].loadLight( index );
break
break;

default:
throw new Error( 'Unknown type: ' + type );
Expand Down Expand Up @@ -3133,7 +3134,7 @@ THREE.GLTFLoader = ( function () {

var nodeDef = json.nodes[ nodeIndex ];

return ( function() {
return ( function () {

// .isBone isn't in glTF spec. See .markDefs
if ( nodeDef.isBone === true ) {
Expand Down

0 comments on commit e3bc361

Please sign in to comment.