Skip to content

Commit

Permalink
Vector*: Add toJSON() methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jun 3, 2022
1 parent ca5f97c commit 710309c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/math/Vector2.js
Expand Up @@ -434,6 +434,12 @@ class Vector2 {

}

toJSON() {

return { x: this.x, y: this.y };

}

fromBufferAttribute( attribute, index, offset ) {

if ( offset !== undefined ) {
Expand Down
6 changes: 6 additions & 0 deletions src/math/Vector3.js
Expand Up @@ -696,6 +696,12 @@ class Vector3 {

}

toJSON() {

return { x: this.x, y: this.y, z: this.z };

}

fromBufferAttribute( attribute, index, offset ) {

if ( offset !== undefined ) {
Expand Down
6 changes: 6 additions & 0 deletions src/math/Vector4.js
Expand Up @@ -622,6 +622,12 @@ class Vector4 {

}

toJSON() {

return { x: this.x, y: this.y, z: this.z, w: this.w };

}

fromBufferAttribute( attribute, index, offset ) {

if ( offset !== undefined ) {
Expand Down

0 comments on commit 710309c

Please sign in to comment.