Skip to content

Commit

Permalink
Merge pull request #40 from fuzhenn/fix-transferable
Browse files Browse the repository at this point in the history
fix missing geometry attributes in transferable
  • Loading branch information
pissang authored Jan 17, 2018
2 parents 307692e + fa7cc34 commit c940d5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util/transferable.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ var transferableUtil = {
options.boundingBox = new BoundingBox(min, max);
}

const geometry = new Geometry(options);

//attributes
var attributes = {};
for (var p in object.attributes) {
if (object.attributes.hasOwnProperty(p)) {
var attr = object.attributes[p];
attributes[p] = new Geometry.Attribute(attr.name, attr.type, attr.size, attr.semantic);
attributes[p].value = attr.value;
geometry.attributes[p] = new Geometry.Attribute(attr.name, attr.type, attr.size, attr.semantic);
geometry.attributes[p].value = attr.value;
}
}
options.attributes = attributes;

return new Geometry(options);
return geometry;
}

}
Expand Down
2 changes: 2 additions & 0 deletions test/unit/util/transferable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@ describe('util.transferable.Spec', function () {
assert(geometry.getAttribute('position').value.length === 156);
assert(geometry.getAttribute('texcoord0').value.length === 104);
assert(geometry.getAttribute('normal').value.length === 156);
assert(geometry.getAttribute('texcoord0'));
assert(geometry.getAttribute('texcoord1'));
});
});

0 comments on commit c940d5a

Please sign in to comment.