Skip to content

Commit

Permalink
Merge pull request #10833 from donmccurdy/feat-gltf-2.0-meshes
Browse files Browse the repository at this point in the history
[glTF] Update node and mesh loading for glTF 2.0.
  • Loading branch information
mrdoob committed Feb 20, 2017
2 parents 4650043 + 0fa4533 commit 2698f7f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions examples/js/loaders/GLTF2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ THREE.GLTF2Loader = ( function () {

var attributeEntry = attributes[ attributeId ];

if ( ! attributeEntry ) return;
if ( attributeEntry === undefined ) return;

var bufferAttribute = dependencies.accessors[ attributeEntry ];

Expand Down Expand Up @@ -1923,11 +1923,25 @@ THREE.GLTF2Loader = ( function () {

var node = json.nodes[ nodeId ];

if ( node.meshes !== undefined ) {
var meshes;

if ( node.mesh !== undefined) {

meshes = [ node.mesh ];

} else if ( node.meshes !== undefined ) {

console.warn( 'GLTF2Loader: Legacy glTF file detected. Nodes may have no more than 1 mesh.' );

meshes = node.meshes;

}

if ( meshes !== undefined ) {

for ( var meshId in node.meshes ) {
for ( var meshId in meshes ) {

var mesh = node.meshes[ meshId ];
var mesh = meshes[ meshId ];
var group = dependencies.meshes[ mesh ];

if ( group === undefined ) {
Expand Down

0 comments on commit 2698f7f

Please sign in to comment.