提交 189c984c 编写于 作者: M Mr.doob

Merge pull request #5735 from WestLangley/dev-attrib

Added fromAttribute() method to the Vector* classes
......@@ -398,6 +398,19 @@ THREE.Vector2.prototype = {
},
fromAttribute: function ( attribute, index, offset ) {
if ( offset === undefined ) offset = 0;
index = index * attribute.itemSize + offset;
this.x = attribute.array[ index ];
this.y = attribute.array[ index + 1 ];
return this;
},
clone: function () {
return new THREE.Vector2( this.x, this.y );
......
......@@ -809,6 +809,20 @@ THREE.Vector3.prototype = {
},
fromAttribute: function ( attribute, index, offset ) {
if ( offset === undefined ) offset = 0;
index = index * attribute.itemSize + offset;
this.x = attribute.array[ index ];
this.y = attribute.array[ index + 1 ];
this.z = attribute.array[ index + 2 ];
return this;
},
clone: function () {
return new THREE.Vector3( this.x, this.y, this.z );
......
......@@ -648,6 +648,21 @@ THREE.Vector4.prototype = {
},
fromAttribute: function ( attribute, index, offset ) {
if ( offset === undefined ) offset = 0;
index = index * attribute.itemSize + offset;
this.x = attribute.array[ index ];
this.y = attribute.array[ index + 1 ];
this.z = attribute.array[ index + 2 ];
this.w = attribute.array[ index + 3 ];
return this;
},
clone: function () {
return new THREE.Vector4( this.x, this.y, this.z, this.w );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册