Skip to content

Commit 6646710

Browse files
committed
Re-generated examples/jsm files.
1 parent ec73e0c commit 6646710

File tree

3 files changed

+74
-11
lines changed

3 files changed

+74
-11
lines changed

examples/jsm/exporters/GLTFExporter.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,9 +1186,22 @@ GLTFExporter.prototype = {
11861186
var modifiedAttribute = null;
11871187
for ( var attributeName in geometry.attributes ) {
11881188

1189+
// Ignore morph target attributes, which are exported later.
1190+
if ( attributeName.substr( 0, 5 ) === 'morph' ) continue;
1191+
11891192
var attribute = geometry.attributes[ attributeName ];
11901193
attributeName = nameConversion[ attributeName ] || attributeName.toUpperCase();
11911194

1195+
// Prefix all geometry attributes except the ones specifically
1196+
// listed in the spec; non-spec attributes are considered custom.
1197+
var validVertexAttributes =
1198+
/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;
1199+
if ( ! validVertexAttributes.test( attributeName ) ) {
1200+
1201+
attributeName = '_' + attributeName;
1202+
1203+
}
1204+
11921205
if ( cachedData.attributes.has( attribute ) ) {
11931206

11941207
attributes[ attributeName ] = cachedData.attributes.get( attribute );
@@ -1208,15 +1221,11 @@ GLTFExporter.prototype = {
12081221

12091222
}
12101223

1211-
if ( attributeName.substr( 0, 5 ) !== 'MORPH' ) {
1224+
var accessor = processAccessor( modifiedAttribute || attribute, geometry );
1225+
if ( accessor !== null ) {
12121226

1213-
var accessor = processAccessor( modifiedAttribute || attribute, geometry );
1214-
if ( accessor !== null ) {
1215-
1216-
attributes[ attributeName ] = accessor;
1217-
cachedData.attributes.set( attribute, accessor );
1218-
1219-
}
1227+
attributes[ attributeName ] = accessor;
1228+
cachedData.attributes.set( attribute, accessor );
12201229

12211230
}
12221231

@@ -1384,6 +1393,8 @@ GLTFExporter.prototype = {
13841393

13851394
}
13861395

1396+
if ( primitive.indices === null ) delete primitive.indices;
1397+
13871398
}
13881399

13891400
var material = processMaterial( materials[ groups[ i ].materialIndex ] );
@@ -1778,7 +1789,7 @@ GLTFExporter.prototype = {
17781789

17791790
} else if ( object.isLight ) {
17801791

1781-
console.warn( 'THREE.GLTFExporter: Only directional, point, and spot lights are supported.' );
1792+
console.warn( 'THREE.GLTFExporter: Only directional, point, and spot lights are supported.', object );
17821793
return null;
17831794

17841795
}

examples/jsm/utils/SkeletonUtils.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,60 @@ var SkeletonUtils = {
541541

542542
return bones;
543543

544+
},
545+
546+
clone: function ( source ) {
547+
548+
var sourceLookup = new Map();
549+
var cloneLookup = new Map();
550+
551+
var clone = source.clone();
552+
553+
parallelTraverse( source, clone, function ( sourceNode, clonedNode ) {
554+
555+
sourceLookup.set( clonedNode, sourceNode );
556+
cloneLookup.set( sourceNode, clonedNode );
557+
558+
} );
559+
560+
clone.traverse( function ( node ) {
561+
562+
if ( ! node.isSkinnedMesh ) return;
563+
564+
var clonedMesh = node;
565+
var sourceMesh = sourceLookup.get( node );
566+
var sourceBones = sourceMesh.skeleton.bones;
567+
568+
clonedMesh.skeleton = sourceMesh.skeleton.clone();
569+
clonedMesh.bindMatrix.copy( sourceMesh.bindMatrix );
570+
571+
clonedMesh.skeleton.bones = sourceBones.map( function ( bone ) {
572+
573+
return cloneLookup.get( bone );
574+
575+
} );
576+
577+
clonedMesh.bind( clonedMesh.skeleton, clonedMesh.bindMatrix );
578+
579+
} );
580+
581+
return clone;
582+
544583
}
545584

546585
};
547586

587+
588+
function parallelTraverse ( a, b, callback ) {
589+
590+
callback( a, b );
591+
592+
for ( var i = 0; i < a.children.length; i ++ ) {
593+
594+
parallelTraverse( a.children[ i ], b.children[ i ], callback );
595+
596+
}
597+
598+
}
599+
548600
export { SkeletonUtils };

examples/jsm/utils/UVsDebug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ var UVsDebug = function ( geometry, size ) {
8787
uvs[ 1 ].fromBufferAttribute( uvAttribute, face[ 1 ] );
8888
uvs[ 2 ].fromBufferAttribute( uvAttribute, face[ 2 ] );
8989

90-
processFace( face, uvs, i );
90+
processFace( face, uvs, i / 3 );
9191

9292
}
9393

@@ -105,7 +105,7 @@ var UVsDebug = function ( geometry, size ) {
105105
uvs[ 1 ].fromBufferAttribute( uvAttribute, face[ 1 ] );
106106
uvs[ 2 ].fromBufferAttribute( uvAttribute, face[ 2 ] );
107107

108-
processFace( face, uvs, i );
108+
processFace( face, uvs, i / 3 );
109109

110110
}
111111

0 commit comments

Comments
 (0)